API Support Forum
OEC API > API Support > Minimum DateStart in SubscribeTicks
Author Topic: Minimum DateStart in SubscribeTicks
(4 messages, Page 1 of 1)
Moderators: VPfau
CZendejas116
Posts: 51
Joined: Apr 13, 2011


Posted: May 27, 2011 @ 03:35 PM             Msg. 1 of 4
Hi,

To retrieve historical ticks, we have to SubscribeTicks and after that catch them in OnReceivedTicks. When I use SubscribeTicks I need to specify a StartDate, but I think this parameter has a limit, I mean, I only can retreive ticks from few hours in the past.

I ran some examples as follows:

***(1)
SubscribeTicks(contract, DateTime.UtcNow) run at 2011/05/27 19:02
First tick received with datetime: 2011/05/27 19:02:14

***(2)
SubscribeTicks(contract, DateTime.UtcNow.AddHours(-4)) run at 2011/05/27 19:07
First tick received with datetime: 2011/05/27 15:27:58

***(3)
SubscribeTicks(contract, new DateTime(2011, 5, 24)) run at 2011/05/27 19:08
First tick received with datetime: 2011/05/27 15:29:04

***(4)
SubscribeTicks(contract, DateTime.UtcNow.AddHours(-10)) run at 2011/05/27 19:10
First tick received with datetime: 2011/05/27 15:30:23

***(5)
SubscribeTicks(contract, DateTime.UtcNow.AddHours(-5)) run at 2011/05/27 19:12
First tick received with datetime: 2011/05/27 15:30:32

***(6)
SubscribeTicks(contract, DateTime.UtcNow.AddHours(-3)) run at 2011/05/27 19:14
First tick received with datetime: 2011/05/27 16:14:34

***(7)
SubscribeTicks(contract, DateTime.UtcNow.AddHours(-3.5)) run at 2011/05/27 19:15
First tick received with datetime: 2011/05/27 15:46:04


So, what is that limit? how much in the past can I ask to server for ticks?
I think that limit is around 4 hours.
Is there a way can I ask for older ticks? let´s say 6 or 8 hours in the past?

Thanks a lot!

Claudia Zendejas
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 01, 2011 @ 10:00 AM             Msg. 2 of 4
You can get up to 3 days back, but every requests will be limited by 65536 ticks. You can workaround this limitation by requesting one more request.

Victor Vins
Software Developer
CZendejas116
Posts: 51
Joined: Apr 13, 2011


Posted: Jun 03, 2011 @ 02:45 PM             Msg. 3 of 4
Hi,

How can I ask for that 3 days?

By now I use:
oecClient.SubscribeTicks(contract, DateTime.UtcNow.AddHours(-5));

Then I received ticks into an array in this event:
OnTicksReceived(Subscription Subscription, Ticks Ticks)

But, what you are saying is I need to use RequestTicks method?
How should I use it?

Thanks in advance.

Claudia Zendejas
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 03, 2011 @ 02:51 PM             Msg. 4 of 4
That's right - you need to call RequestTicks for the next 5 hours. The response will come the same way and with the same limitations as if you would use SubscribeTicks.

Victor Vins
Software Developer