Dear all,
I'm using the latest ibapi version 9.81.1 post1 and running a script using python in visual studio code.
Context:
After I receive all the historical bar data I request, I then start receiving the real time 5 second bar data because of the KeepUpToDate argument being set to TRUE. I am using 1 minute bar size.
The logic of my code is such:
When bar.date is different by 1 minute or more from the last bar.date, I take the bar data of the previous minute that just passed which is made of twelve 5 second bars and store the resulting bar.high, bar.close, bar.low in a dictionary.
The problem:
When the minute passes and i store the bar data in the dictionary, I am actually storing the data of the 1st second of the NEXT 1-minute-bar which is currently being formed and not storing the bar data of the just elapsed minute. So I end up with bar.close = bar.high = bar.low = bar.open which is the bar data of even less than 1 second.
My solution:
Take the bar data of the PRE-LAST 5-second bar in the minute which is from the 50th second to the 55th second aka the eleventh 5-second bar. Now you can probably see the shortcoming: How do I get the bar data of the last 5-seconds of the minute?
The workaround I am currently attempting:
use IBApi.EClient.reqHistoricalData with?keepUpToDate = FALSE every minute to request the bar data of the previous minute. I haven't really gotten this to work yet but I am searching for some insight because this problem feels like a mistake I am making rather a problem with ibapi because it is hard to believe otherwise.
Regards,
Nader.