|
APICLIENT-205 getTimeOfLastTick returns -1 |
bobuc
|
Post subject: APICLIENT-205 getTimeOfLastTick returns -1 |
Post rating: 0
|
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
|
|
|
|
 |
API Support
|
Post subject: Re: Why getTimeOfLastTick return -1 ? |
Post rating: 0
|
Posted: Mon 23 Jul, 2012, 07:28
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Was it while working with the live data or back-testing?
|
|
|
|
 |
bobuc
|
Post subject: Re: Why getTimeOfLastTick return -1 ? |
Post rating: 0
|
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).
|
|
|
|
 |
bobuc
|
Post subject: Re: Why getTimeOfLastTick return -1 ? |
Post rating: 0
|
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.
|
|
|
|
 |
API Support
|
Post subject: Re: APICLIENT-205 getTimeOfLastTick returns -1 |
Post rating: 0
|
Posted: Tue 14 Aug, 2012, 13:41
|
|
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.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|