Dukascopy
 
 
Wiki JStore Search Login

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

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

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

Cannot read instrument.getMarketInfo()
 Post subject: Cannot read instrument.getMarketInfo() Post rating: 0   New post Posted: Thu 03 Feb, 2022, 12:34 

User rating: 0
Joined: Fri 28 Feb, 2020, 14:55
Posts: 9
Location: Bulgaria,
Any idea why
instrument.getMarketInfo()
returns null when run in the historical tester?

I am trying to read the value of
instrument.getMarketInfo().isOpenNow()
.

Thanks!


 
 Post subject: Re: Cannot read instrument.getMarketInfo() Post rating: 0   New post Posted: Thu 10 Feb, 2022, 12:16 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Hello.

1. Market Info is available only for CFD Stocks.
2. In Historical Tester com.dukascopy.api.instrument.IMarketInfo#isOpenNow will be evaluated for current system time (not for current time of test).
3. Use com.dukascopy.api.instrument.IMarketInfo#isOpenAt to obtain state at specified moment of time.
See also:
com.dukascopy.api.IHistory#getStartTimeOfCurrentBar(com.dukascopy.api.Instrument, com.dukascopy.api.Period)
java.time.Instant#ofEpochMilli
4. Use com.dukascopy.api.IDataService#isOfflineTime(long, com.dukascopy.api.Instrument) to obtain tradability state for any instrument.
See also:
com.dukascopy.api.IContext#getDataService
com.dukascopy.api.IHistory#getStartTimeOfCurrentBar(com.dukascopy.api.Instrument, com.dukascopy.api.Period)

Regards.


 

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