Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IOrder.getProfitLossInAccountCurrency returns Double.NaN
 Post subject: IOrder.getProfitLossInAccountCurrency returns Double.NaN Post rating: 0   New post Posted: Wed 14 May, 2014, 12:56 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
API 2.9.9
Sometimes (not always) the IOrder.getProfitLossInAccountCurrency method returns Double.NaN

My account currency is USD and this issue happens even for instruments with USD as a quote (secondary) currency.


 
 Post subject: Re: IOrder.getProfitLossInAccountCurrency returns Double.NaN Post rating: 0   New post Posted: Wed 14 May, 2014, 13:51 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Could you please provide more information about the position and at what moment/event do you check the PL parameter?


 
 Post subject: Re: IOrder.getProfitLossInAccountCurrency returns Double.NaN Post rating: 0   New post Posted: Wed 14 May, 2014, 22:40 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
API Support wrote:
Could you please provide more information about the position and at what moment/event do you check the PL parameter?

2014-05-14 13:10:28, Position ID 61345225

Both getProfitLossInPips and getProfitLossInUSD methods have returned NaN at the same time as well.


 
 Post subject: Re: IOrder.getProfitLossInAccountCurrency returns Double.NaN Post rating: 0   New post Posted: Thu 15 May, 2014, 16:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We could not replicate this. Could you please provide an example strategy which demonstrates this?


 
 Post subject: Re: IOrder.getProfitLossInAccountCurrency returns Double.NaN Post rating: 0   New post Posted: Thu 15 May, 2014, 19:20 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
API Support wrote:
We could not replicate this. Could you please provide an example strategy which demonstrates this?
The attached strategy is the one that has unveiled a bug. Strategy's log is attached as well.
IMPORTANT: Keep some positions open and let strategy run long enough.


Attachments:
DemoNaN.java [1.19 KiB]
Downloaded 115 times
Messages Tab.txt [393 Bytes]
Downloaded 110 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.
 
 Post subject: Re: IOrder.getProfitLossInAccountCurrency returns Double.NaN Post rating: 0   New post Posted: Mon 19 May, 2014, 08:36 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
The issue has happened again for several times on my account.

Could connection problems cause the issue?

Is this issue related to that one Profit and Loss value N/A ?


 
 Post subject: Re: IOrder.getProfitLossInAccountCurrency returns Double.NaN Post rating: 0   New post Posted: Mon 19 May, 2014, 13:27 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
hebasto wrote:
Could connection problems cause the issue?
It appears to be the case, we managed to replicate this by disconnecting from internet. The reason for that is because you check the price values, before the platform has received actual last ticks after the reconnect. In order to fix this consider checking the PL values in the onTick method of the respective instrument.


 

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