Dukascopy
 
 
Wiki JStore Search Login

getOriginalAmount() returns 0.0
 Post subject: getOriginalAmount() returns 0.0 Post rating: 0   New post Posted: Tue 11 Dec, 2012, 12:33 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
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


 
 Post subject: Re: getOriginalAmount() returns 0.0 Post rating: 0   New post Posted: Tue 11 Dec, 2012, 16:09 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Let me add scenario of how to reproduce.

1. Open JForex Desktop
2. Open new trade
3. Open application based on Standalone API
4. Partially close the trade from JForex Desktop
5. Results in application based on API -> message of ORDER_CLOSE_OK type will return IOrder which method getOriginalAmount returns 0.

6. Close application based on Standalone API
7. Close the trade completly
8. Open application based on Standalone API
9. Open new trade from JForex Desktop
10. Partially close the trade from JForex Desktop
11. Results in application based on API -> getOriginalAmount() returns correct value.


 
 Post subject: Re: getOriginalAmount() returns 0.0 Post rating: 0   New post Posted: Tue 11 Dec, 2012, 17:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Thank you for the reporting. The issue is under the investigation.


 
 Post subject: Re: getOriginalAmount() returns 0.0 Post rating: 0   New post Posted: Thu 10 Jan, 2013, 08:37 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Fixed in a new API version.


 

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