Author |
Topic: Download Hisotrical Tick Data (GF API) (7 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
PNannis Posts: 17 Joined: Apr 16, 2014 |
I’m trying to request the Tick data for one historical trading day at a time. I have one live price feed subscription like this (just to receive live prices without and backfill (ESU24, in the development environment, username is PNannisTM).
GF.Api.Subscriptions.Duration duration = new GF.Api.Subscriptions.Duration(DateTime.UtcNow, null, 0, GF.Api.Subscriptions.Continuity.Continuous); GF.Api.Subscriptions.Ticks.ITickSubscription pTickSub = gfClient.Subscriptions.Ticks.Subscribe(e.Contracts[0].ID, duration); Then when the platform wants to pull a day of tick data I submit a new request like this (where LastQuoteTime is initialized to the end time of the range requested): GF.Api.Subscriptions.Duration duration = new GF.Api.Subscriptions.Duration( ConvertChartTimeToGFTime(dataRequest.DownloadFromTime), ConvertChartTimeToGFTime(dataRequest.LastQuoteTime), 65536, GF.Api.Subscriptions.Continuity.OneTime); dataRequest.TickSub = gfClient.Subscriptions.Ticks.Subscribe(contractId, duration); which results in the last 65536 ticks from the end time of the requested range. So then I re-submit the same request above but adjust the LastQuoteTime to one second earlier than the first tick received in the response. The response is again 65536 ticks but the range is just a huge overlap with the previous received range with the first tick in the response a few minutes earlier or the same as the LastQuoteTime and the last tick received a few minutes earlier or the same as the last tick received. What could be the problem here and is there any easier way to download a previous day's tick data (not far back, just one or two days) ? ?Peter Peter Nannis
|
||||
VPfau Moderator Posts: 164 Joined: |
Hello Peter,
I believe you have to send a time range (start, end) request or amount (start, amount) request. Try to skip "end" argument or "amount" argument in the second request. Please let me know if it helps. Vitaliy Pfau
|
||||
PNannis Posts: 17 Joined: Apr 16, 2014 |
So I've tried everything I can think of to make it work, I've been messing with combinations of your suggestions above to no avail. I'm just trying to download a simple time range and I've now dumbed it down to the snippet below.
I submit the request below and get 0 ticks in response, we're several hours into the globex session (Sunday 6.30 7.30PM Pacific). Why wouldn't the request below return any ticks? DateTime utcStart = DateTime.UtcNow.AddHours(-1); DateTime utcEnd = DateTime.UtcNow; GF.Api.Subscriptions.Duration duration = new GF.Api.Subscriptions.Duration( utcStart, utcEnd, 0, GF.Api.Subscriptions.Continuity.OneTime); dataRequest.TickSub = gfClient.Subscriptions.Ticks.Subscribe(contractId, duration); Peter Nannis
|
||||
VPfau Moderator Posts: 164 Joined: |
Hello Peter,
7:30PM Pacific is 10:30PM Eastern Time. We have ticks around that time. Let me write some code snippet that requests ticks. Be right back with you. Vitaliy Pfau
|
||||
PNannis Posts: 17 Joined: Apr 16, 2014 |
Tried the above again and got some ticks returned. Went back to my previous approach I initially posted (LastQuoteTime starts as the end of the range OR the earliest tick when repeating the requests). Now I get ticks returned back to 6.22 AM PT , prior to that no ticks get returned. (This is Dev environment, user is PNannisTM)
utcStart = ConvertChartTimeToGFTime(dataRequest.DownloadFromTime); utcEnd = ConvertChartTimeToGFTime(dataRequest.LastQuoteTime); GF.Api.Subscriptions.Duration duration = new GF.Api.Subscriptions.Duration( utcStart, utcEnd, 0, GF.Api.Subscriptions.Continuity.OneTime); dataRequest.TickSub = gfClient.Subscriptions.Ticks.Subscribe(contractId, duration); Peter Nannis
|
||||
VPfau Moderator Posts: 164 Joined: |
Peter,
I fetched data from our Trader and this what I got: 2024/06/28 16:59:59,5532.50 2024/06/28 16:59:59,5532.50 2024/06/28 16:59:59,5532.50 2024/06/28 16:59:59,5532.50 2024/06/28 16:59:59,5532.25 2024/07/01 09:22:13,5531.50 2024/07/01 09:22:14,5531.50 2024/07/01 09:22:14,5531.50 2024/07/01 09:22:14,5531.50 2024/07/01 09:22:16,5531.50 2024/07/01 09:22:16,5531.50 This is eastern time zone. That means that first tick available on a new session is 2024/07/01 13:22 UTC Please check the code snippet that I used to fetch 3x1000 ticks from the server. https://bitbucket.org/GainFuturesDev/workspace/snippets/AzkaAz/gfapi-loadticks-with-3x1000 Please let me know if this helps. Vitaliy Pfau
|
||||
PNannis Posts: 17 Joined: Apr 16, 2014 |
Yes, getting the same results, that explains why I wasn't seeing ticks last night. It would be SOOO much easier if you could adjust the design so that a user can request a bigger chunk (a full trading day) at a time and then received partial responses until the request is fulfilled or dropped. Especially since you have to create a new subscription for each 65536 tick chunk .. just a suggestion.
Peter Nannis
|
||||