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.

history.getBar() returns wrong values the first time it's called
 Post subject: history.getBar() returns wrong values the first time it's called Post rating: 0   New post Posted: Sat 19 Sep, 2015, 11:06 

User rating: 6
Joined: Tue 02 Jul, 2013, 16:52
Posts: 38
Hello Support team :)

Here is a problem I am having with getBar().
You should be able to reproduce it easily by starting a new instance/connection, and running the following code:
        Instrument instrument = Instrument.EURUSD;
        Period period = Period.FOUR_HOURS;

        IBar latestBar1 = history.getBar(instrument, period, OfferSide.BID, 1);
        IBar latestBar2 = history.getBar(instrument, period, OfferSide.BID, 1);

        log.info("price close 1 : {} {}", latestBar1.getClose(), new DateTime(latestBar1.getTime()));
        log.info("price close 2 : {} {}", latestBar2.getClose(), new DateTime(latestBar2.getTime()));

        assertEquals(latestBar1, latestBar2);

Here is what I get right now (Saturday 09:50am UTC):
2015-09-19 09:50:54,333|  INFO |         statsTest:127 | price close 1 : 1.12821 2015-09-18T16:00:00.000Z
2015-09-19 09:50:54,366|  INFO |         statsTest:128 | price close 2 : 1.12974 2015-09-19T04:00:00.000Z


Running that test on Daily returns:
2015-09-19 10:40:27,943|  INFO |         statsTest:127 | price close 1 : 1.14022 2015-09-17T00:00:00.000Z
2015-09-19 10:40:27,944|  INFO |         statsTest:128 | price close 2 : 1.12974 2015-09-18T00:00:00.000Z
Here it's pretty clear that the 2nd value is the correct one and there is a big difference obviously.

Other examples:
If you start a new connection/instance and call indicators.ema() before history.getBar(), history.getBar() returns the correct value.
But if you do it the other way around: calling history.getBar() before indicators.ema(), history.getBar() returns the wrong value.

This is with DDS2-jClient-JForex 2.43.2


 
 Post subject: Re: history.getBar() returns wrong values the first time it's called Post rating: 0   New post Posted: Tue 29 Sep, 2015, 15:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We were unable to reproduce this. Please use latest SDK versions JClient 2.45.15/ API 2.12.22


 
 Post subject: Re: history.getBar() returns wrong values the first time it's called Post rating: 0   New post Posted: Tue 29 Sep, 2015, 15:09 

User rating: 6
Joined: Tue 02 Jul, 2013, 16:52
Posts: 38
Thank you for the answer.
Unfortunately, I can't use the version your suggested because all version posterior to 2.43.2 are not working properly.
See the following thread, and all other related threads from users having similar issues:
https://www.dukascopy.com/swiss/english ... 16&t=53045


 

Jump to:  

  © 1998-2025 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