Hi Support Team,
I would like to report a problem with IOrder.getOrginalAmount() method. From time to time it returns 0. After restart of Standalone API it works well again.
Please consider following code and returned results:
public void onMessage(IMessage m) throws JFException {
if (m.getOrder() != null) {
IOrder o = m.getOrder();
LOGGER.debug(m);
LOGGER.debug("getAmount ....................... " + o.getAmount());
LOGGER.debug("getOpenPrice .................... " + o.getOpenPrice());
LOGGER.debug("getProfitLossInPips ............. " + o.getProfitLossInPips());
LOGGER.debug("getClosePrice ................... " + o.getClosePrice());
LOGGER.debug("getOriginalAmount ............... " + o.getOriginalAmount());
LOGGER.debug("getRequestedAmount .............. " + o.getRequestedAmount());
LOGGER.debug("getProfitLossInAccountCurrency .. " + o.getProfitLossInAccountCurrency());
LOGGER.debug("getCommission ................... " + o.getCommission());
}
}
Good results:
12:23:33,363 DEBUG Message Type: NOTIFICATION; Text: ORDER_FILLED-Order FILLED at 1.29681 USD (#173120430 SELL 0.3 mil. EUR/USD @ MKT) - Position #44973967; Related Order: [jf89wdvie]-FILLED / EUR/USD / 1.29627 / 0.4 / 0.4
12:23:33,366 DEBUG getAmount ....................... 0.4
12:23:33,366 DEBUG getOpenPrice .................... 1.29627
12:23:33,367 DEBUG getProfitLossInPips ............. 5.4
12:23:33,429 DEBUG getClosePrice ................... 0.0
12:23:33,431 DEBUG getOriginalAmount ............... 0.4
12:23:33,434 DEBUG getRequestedAmount .............. 0.4
12:23:33,440 DEBUG getProfitLossInAccountCurrency .. 166.56
12:23:33,442 DEBUG getCommission ................... 13.2
12:23:33,447 DEBUG Message Type: ORDER_CLOSE_OK; Text: ; Related Order: [jf89wdvie]-FILLED / EUR/USD / 1.29627 / 0.1 / 0.1
12:23:33,450 DEBUG getAmount ....................... 0.1
12:23:33,453 DEBUG getOpenPrice .................... 1.29627
12:23:33,455 DEBUG getProfitLossInPips ............. 5.4
12:23:33,457 DEBUG getClosePrice ................... 1.29681
12:23:33,459 DEBUG getOriginalAmount ............... 0.4
12:23:33,461 DEBUG getRequestedAmount .............. 0.1
12:23:33,463 DEBUG getProfitLossInAccountCurrency .. 41.64
12:23:33,466 DEBUG getCommission ................... 23.1
After restart - bad result:
Order FILLED at 1.29664 USD (#173120540 BUY 0.4 mil. EUR/USD @ MKT) - Position #44974086
12:25:09,969 DEBUG Message Type: NOTIFICATION; Text: ORDER_FILLED-Order FILLED at 1.29664 USD (#173120540 BUY 0.4 mil. EUR/USD @ MKT) - Position #44974086; Related Order: [jf1kefrm1]-OPENED / EUR/USD / 0.0 / 0.4 / 0.4
12:25:09,969 DEBUG getAmount ....................... 0.4
12:25:09,969 DEBUG getOpenPrice .................... 0.0
12:25:09,970 DEBUG getProfitLossInPips ............. 0.0
12:25:09,977 DEBUG getClosePrice ................... 0.0
12:25:09,979 DEBUG getOriginalAmount ............... 0.0
12:25:09,981 DEBUG getRequestedAmount .............. 0.4
12:25:09,983 DEBUG getProfitLossInAccountCurrency .. 0.0
12:25:09,987 DEBUG getCommission ................... 0.0
12:25:09,995 DEBUG Message Type: ORDER_FILL_OK; Text: ; Related Order: [jf1kefrm1]-FILLED / EUR/USD / 1.29664 / 0.4 / 0.4
12:25:10,000 DEBUG getAmount ....................... 0.4
12:25:10,001 DEBUG getOpenPrice .................... 1.29664
12:25:10,004 DEBUG getProfitLossInPips ............. -0.4
12:25:10,006 DEBUG getClosePrice ................... 0.0
12:25:10,009 DEBUG getOriginalAmount ............... 0.0
12:25:10,011 DEBUG getRequestedAmount .............. 0.4
12:25:10,014 DEBUG getProfitLossInAccountCurrency .. -12.34
12:25:10,016 DEBUG getCommission ................... 13.2
Order FILLED at 1.29669 USD (#173120589 SELL 0.1 mil. EUR/USD @ MKT) - Position #44974086
12:25:53,167 DEBUG Message Type: NOTIFICATION; Text: ORDER_FILLED-Order FILLED at 1.29669 USD (#173120589 SELL 0.1 mil. EUR/USD @ MKT) - Position #44974086; Related Order: [jf1kefrm1]-FILLED / EUR/USD / 1.29664 / 0.4 / 0.4
12:25:53,167 DEBUG getAmount ....................... 0.4
12:25:53,168 DEBUG getOpenPrice .................... 1.29664
12:25:53,168 DEBUG getProfitLossInPips ............. 0.5
12:25:53,180 DEBUG getClosePrice ................... 0.0
12:25:53,181 DEBUG getOriginalAmount ............... 0.0
12:25:53,184 DEBUG getRequestedAmount .............. 0.4
12:25:53,186 DEBUG getProfitLossInAccountCurrency .. 15.42
12:25:53,190 DEBUG getCommission ................... 13.2
12:25:53,193 DEBUG Message Type: ORDER_CLOSE_OK; Text: ; Related Order: [jf1kefrm1]-FILLED / EUR/USD / 1.29664 / 0.3 / 0.3
12:25:53,197 DEBUG getAmount ....................... 0.3
12:25:53,199 DEBUG getOpenPrice .................... 1.29664
12:25:53,201 DEBUG getProfitLossInPips ............. 0.5
12:25:53,203 DEBUG getClosePrice ................... 1.29669
12:25:53,208 DEBUG getOriginalAmount ............... 0.0
12:25:53,209 DEBUG getRequestedAmount .............. 0.3
12:25:53,212 DEBUG getProfitLossInAccountCurrency .. 11.57
12:25:53,214 DEBUG getCommission ................... 16.5
After another restart - ok again.
Please investigate and correct.
Thanks and best regards,
kurak