What Exactly Does the Interactive Brokers Tws Api keepUpToDate Function Return When Requesting Historical Bar Data?

According to the Interactive Brokers TWS API documentation on "Requesting Historical Bar Data":

keepUpToDate, Whether a subscription is made to return updates of unfinished real time bars as they are available (True), or all data is returned on a one-time basis (False). Available starting with API v973.03+ and TWS v965+. If True, and endDateTime cannot be specified.

I don't understand exactly what this means. Logically, I had assumed that this function would start a "5 Second Real Time Bars" subscription and close the "Historical Bar Data" subscription after historical bars were sent to the present.

However, this is not what happens. The post "Historical Bar Data" messages received appear randomly, sometimes a couple of seconds apart, sometimes milliseconds apart. The messages almost appear to be Ticks, except that most of these "Ticks" have identical price data.

1

1 Answer

I think I know what is going here or at least an example that might make sense to folks also trying to figure this out.

Have a look:

The yellow price slider on the Y-Axis moves up and down in sync with the last candle, which mutates with the "live" last price until the candle fully closes and the next one starts. The price updates of the last unfinished candle appear to match the HistoricalDataUpdateMessage data almost exactly.

I have handled the HistoricalDataUpdateMessage to produce similar action as what is seen on the TWS chart for my chart. The results are nearly identical.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest