Dukascopy
 
 
Wiki JStore Search Login

Different results of IOrder retrived from getHistoricalOrderById and getOrdersHistory
 Post subject: Different results of IOrder retrived from getHistoricalOrderById and getOrdersHistory Post rating: 0   New post Posted: Sat 22 Dec, 2012, 22:23 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Hi Dukascopy Team,

There is another bug with IOrder data retrived from IHistory and not only for merged orders. Methods getHistoricalOrderById and getOrdersHistory returns different results for the same Order Id. Cosider following snippet and results.
public void onStart(IContext context) throws JFException {
    IHistory h = context.getHistory();
    Set<Instrument> ins = new HashSet();
    ins.add(Instrument.EURUSD);
    context.setSubscribedInstruments(ins);

    printIOrder(h.getHistoricalOrderById("44977981"));

    List<IOrder> tmp = h.getOrdersHistory(Instrument.EURUSD, 0, (new Date()).getTime());
    if (tmp.size() > 0) {
        for (IOrder lo : tmp) {
            if (lo.getId().equalsIgnoreCase("44977981")) {
                printIOrder(lo);
            }
        }
    }
}

private void printIOrder(IOrder o) {
    System.out.println("getOrderId .......................... " + o.getId());
    System.out.println("  getInstrument ..................... " + o.getInstrument());
    System.out.println("  getAmount ......................... " + o.getAmount());
    System.out.println("  getOpenPrice ...................... " + o.getOpenPrice());
    System.out.println("  getClosePrice ..................... " + o.getClosePrice());
    System.out.println("  getProfitLossInAccountCurrency .... " + o.getProfitLossInAccountCurrency());
    System.out.println("  getProfitLossInPips ............... " + o.getProfitLossInPips());
    System.out.println("  getCommission ..................... " + o.getCommission());
    System.out.println("  CloseTime ......................... " + new Date(o.getCloseTime()));
}

Results
getOrderId .......................... 44977981
  getInstrument ..................... EUR/USD
  getAmount ......................... 1.2
  getOpenPrice ...................... 1.29821
  getClosePrice ..................... 1.2984675
  getProfitLossInAccountCurrency .... 236.58
  getProfitLossInPips ............... 2.6
  getCommission ..................... 26.4
  CloseTime ......................... Tue Dec 11 13:04:43 CET 2012

getOrderId .......................... 44977981
  getInstrument ..................... EUR/USD
  getAmount ......................... 0.4
  getOpenPrice ...................... 1.29949
  getClosePrice ..................... 1.29906
  getProfitLossInAccountCurrency .... -130.43
  getProfitLossInPips ............... -4.3
  getCommission ..................... 9.9
  CloseTime ......................... Tue Dec 11 13:04:43 CET 2012


If you test another orderId, for exmaple 44967914, values generally are equal but there is a difference of 4 minutes in close time.

best regards,
kurak


 
 Post subject: Re: Different results of IOrder retrived from getHistoricalOrderById and getOrdersHistory Post rating: 0   New post Posted: Wed 09 Jan, 2013, 18:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Could you please provide:
  • open times of both orders.
  • order history between the open time and close time of the order which you get by using getHistoricalOrderById.


 
 Post subject: Re: Different results of IOrder retrived from getHistoricalOrderById and getOrdersHistory Post rating: 0   New post Posted: Wed 09 Jan, 2013, 23:12 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Please find attached two text files containing full code and results:
* problematic_trade_with_fill_time.txt (it appears that fill time differs too between both IOrders)
* orders_history_between_open_and_close.txt

regards,
kurak


Attachments:
problematic_trade_with_fill_time.txt [5.21 KiB]
Downloaded 352 times
orders_history_between_open_and_close.txt [7.05 KiB]
Downloaded 350 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

Jump to:  

  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com