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.

Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders
 Post subject: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Fri 25 Aug, 2017, 07:07 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
Hello, something got broken in recent releases of JForex (i think during last 2 weeks or so) - IOrder.getProfitLossInUSD() returns NaN ('Not a Number' value) for yesterday's historic orders. For orders closed during today value is non-zero and is more-or-less nearby the value displayed in WEB reports.

Can this be fixed?

Example:

#92154402 CLOSED

    Action:       <BUY> USD/CHF
    Created:      2017-08-24 11:53:58.470
    Amount:       100 000
    Amount Req.:  100 000
    Amount Orig.: 100 000
    Open Price:   0.96415
    Fill endTime:    2017-08-24 11:53:58.470
    Filled:       #0: 2017-08-24 11:59:55.748 - 100 000 * 0.96415
    Commission:   8.0 $
    Profit$:      NaN $   <-- this comes from IOrder.getProfitLossInUSD()
    Profit.:      -3.8 pips
    Close endTime:   2017-08-24 12:32:50.810
    Closed:       #0: 2017-08-24 12:32:50.810 - 100 000 * 0.96377


 
 Post subject: Re: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Mon 04 Sep, 2017, 13:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We were unable to reproduce this problem.


 
 Post subject: Re: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Wed 06 Sep, 2017, 19:14 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
Can I help somehow? It is the permanent problem in my environment.


 
 Post subject: Re: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Thu 07 Sep, 2017, 08:14 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
Additional note - it looks like problem appears only on my LIVE account. I've rechecked same thing on DEMO account opened half year ago - all orders have non-NaN P/L in $, i.e. DEMO seems to be working correctly. So ... i would assume something wrong has happened on LIVE servers some time ago.

Today I've removed cache directory for everything to be reload - on LIVE problem reoccurs at fresh start too.


 
 Post subject: Re: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Tue 12 Sep, 2017, 10:54 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We were unable to reproduce this on LIVE
Here is a strategy to test the issue:


Attachments:
StrategyPrintHistory.java [2.04 KiB]
Downloaded 169 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: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Thu 14 Sep, 2017, 08:26 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
Behaviour appears to be more strange than I was thinking before - right now i see that some currency pairs do have non-NaN profit-in-USD for entire history, whereas some other pairs do have that problem.

The particular order for USD/CHF I've provided in initial post right now is non-NaN as well as all other orders for entire history of USD/CHF.

USD/CAD and some other pairs do have the problem now. Below is the output of your strategy for USD/CAD for 2017-09-01 (and all other orders for USD/CAD are NaN - from 2017-05-02 until latest one at 2017-09-11 ).

2017-09-14 10:05:45   jfcvdpgjz NaN
2017-09-14 10:05:45   jfuhd7u2f NaN
2017-09-14 10:05:45   jfrx6c2ad NaN
2017-09-14 10:05:45   jf1k6kmew NaN
2017-09-14 10:05:45   jfilz9f1a NaN
2017-09-14 10:05:45   jfn38dfoh NaN
2017-09-14 10:05:45   jf4vrrm1k NaN
2017-09-14 10:05:45   jf1298vi1 NaN
2017-09-14 10:05:45   USDCAD_70901_152041_M_old NaN
2017-09-14 10:05:45   USDCAD_70901_150156_M_old NaN
2017-09-14 10:05:45   USDCAD_70824_154228_M_old NaN
2017-09-14 10:05:45   USDCAD_70901_142713_M_old NaN
2017-09-14 10:05:45   USDCAD_70901_142042_M_old NaN
2017-09-14 10:05:45   USDCAD_70901_142017_M_old NaN
2017-09-14 10:05:45   USDCAD_70901_141953_M_old NaN
2017-09-14 10:05:45   USDCAD_70901_130127_M_old NaN
2017-09-14 10:05:45   USDCAD_70901_130143_M_old NaN
2017-09-14 10:05:45   USDCAD_70831_224308_M_old NaN
2017-09-14 10:05:45   USDCAD_70831_224259_M_old NaN
2017-09-14 10:05:45   USDCAD_70831_223455_M_old NaN
2017-09-14 10:05:45   USDCAD_70831_223444_M_old NaN
2017-09-14 10:05:45   historical order count: 21


 
 Post subject: Re: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Mon 18 Sep, 2017, 08:16 
User avatar

User rating: 0
Joined: Wed 05 Mar, 2014, 17:24
Posts: 30
Location: Russian Federation, Tomsk
mtnfx wrote:
USD/CAD and some other pairs do have the problem now.

I have the same problem with USDCAD.


 
 Post subject: Re: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Fri 06 Oct, 2017, 17:08 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This issue occurs when instrument is not subscribed. Please subscribe to instruments before requesting order history: https://www.dukascopy.com/wiki/en/development/strategy-api/instruments#synchronous-subscription


 
 Post subject: Re: Implementation in IOrder.getProfitLossInUSD() return NaN for historic orders Post rating: 0   New post Posted: Fri 06 Oct, 2017, 21:52 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
I suspect there should be some other reason because i tried to recheck this condition just now - i still have NaN as profit.

I rechecked following:
1. Restarted my plugin - ensured before that that USDCAD is in the subscribed instruments. Still NaN
2. Closed application and removed all files by mask o_L_*.bin from .cache folder (i suspect these are cached orders), restarted Jforex, ensured USDCAD is in subscribed instruments (BTW - plugin also subsribes to it), started plugin - sill NaN for USDCAD.


 

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