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()));
}
ResultsgetOrderId .......................... 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