Dukascopy
 
 
Wiki JStore Search Login

APICLIENT-205 getTimeOfLastTick returns -1
 Post subject: APICLIENT-205 getTimeOfLastTick returns -1 Post rating: 0   New post Posted: Sun 22 Jul, 2012, 20:42 

User rating: 0
Joined: Wed 27 Jun, 2012, 15:37
Posts: 11
Tested now (sunday 19:30 GMT):

history.getTimeOfLastTick(Instrument.fromString("EUR/USD")) returns -1.

It should return friday closing time, no ?

Why -1 ?

Thanks


 
 Post subject: Re: Why getTimeOfLastTick return -1 ? Post rating: 0   New post Posted: Mon 23 Jul, 2012, 07:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Was it while working with the live data or back-testing?


 
 Post subject: Re: Why getTimeOfLastTick return -1 ? Post rating: 0   New post Posted: Mon 23 Jul, 2012, 11:40 

User rating: 0
Joined: Wed 27 Jun, 2012, 15:37
Posts: 11
While working with live data ansd starting the strategy out of market hours (sunday before market openning).


 
 Post subject: Re: Why getTimeOfLastTick return -1 ? Post rating: 0   New post Posted: Tue 24 Jul, 2012, 13:19 

User rating: 0
Joined: Wed 27 Jun, 2012, 15:37
Posts: 11
It occurs also when starting strategy during market hours.


 
 Post subject: Re: APICLIENT-205 getTimeOfLastTick returns -1 Post rating: 0   New post Posted: Tue 14 Aug, 2012, 13:41 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Yes, you are right, it should return last Friday's tick time for specified instrument on weekend at any case.
Currently, to avoid this problem, please use a time delay at least couple of seconds between subscribing to instruments and using IHistory#getTimeOfLastTick/getLastTick(...) methods:

IClient.setSubscribedInstruments(...)
or
IContext.setSubscribedInstruments(...)

try { //sleep for a 1 second to give the platform a chance to get the tick from API TimeUnit.SECONDS.sleep(2); } catch (InterruptedException e) { LOGGER.error(e.getMessage(), e); }

history.getTimeOfLastTick(Instrument.fromString("EUR/USD"))

We have reduced the time delay on weekend fake tick creation (used when server doesn't send last ticks by some reason).
As well we are going to to revise "last tick" logic considerably to make this more fail-safe.


 

Jump to:  

cron
  © 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