Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Cannot read instrument.getMarketInfo()
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=65&t=57782
Page 1 of 1

Author:  gipadm [ Thu 03 Feb, 2022, 12:34 ]
Post subject:  Cannot read instrument.getMarketInfo()

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!

Author:  vadim_berezhnoj [ Thu 10 Feb, 2022, 12:16 ]
Post subject:  Re: Cannot read instrument.getMarketInfo()

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.

  Page 1 of 1