1 hour data from reqHistoricalData() different to chart ?? #74
Replies: 2 comments
-
It also depends on the symbol and the platform. Futures would show full hour boundaries as expected because they run 1800-1700 ET. The problem with hour charts is a full RTH equity trading day is 6.5 hours, so what does it do with the remaining 30 minutes? One platform I tested gives 10:30, 11:30, ... bars until the last 30 minutes of the day then it counts 15:30 -> 16:00 as the final "1 hour bar." So, I think it may just be per-platform? If you want RTH hourly charts on 30 minute boundaries (impossible for the entire day), you probably need to request 30 minute bars then combine them manually, then decide how to handle the first or last 30 minutes of the day.
It's basically the opposite of the other platform I tested which makes the last bar 15:30-1600, so here they are just moving it first to make all the other hours flat. |
Beta Was this translation helpful? Give feedback.
-
Matt, thanks for the clarification. I use to the API to trade stocks and options, but taking into consideration the many different asset classes one can trade I now understand why the hourly data works this way. I will find a solution using the 30 minute data. |
Beta Was this translation helpful? Give feedback.
-
Hello,
for long term analysis, I tried to fetch 1 hour data using the
reqHistoricalData()
method. I was then a little puzzled with the result because the data / values were different from the 1 hour chart. It took me a few minutes to see why....On the 1 hour chart, the time of each hour is 09:30, 10:30, 11:30, 12:30 and so on.
The hours provided by the
reqHistoricalData()
method are 09:30, 10:00, 11:00, 12:00 etc...The historical data resp. the method switches to full hours after the first half hour, which I can kind of understand, because I asked for hourly data, but this doesn´t happen on the chart.
I tried to change the values in
reqHistoricalData()
but they seem to be correct.bars = ib.reqHistoricalData( contract, endDateTime = '', durationStr = "1 Y", barSizeSetting = "1 hour", whatToShow = 'TRADES', useRTH = True, formatDate = 1, keepUpToDate = True)
Has anyone else faced this problem? What am I doing wrong? Or is this a bug?
Beta Was this translation helpful? Give feedback.
All reactions