IB TWS API - how soon is the latest price bar available?

Discussion in 'Automated Trading' started by elitetradesman, Oct 22, 2011.

  1. So let's say the time is 3:30PM and you call reqHistoricalData() to request all 5 minute bars between 3:15 and 3:30. Will the return values include the price bar closing at 3:30?

    If not, when's the earliest time the latest price bar become available?

    Basically, I'd like to take action as soon as a 5 minute bar is closed.

    Thanks in advance.
  2. They are usually available 1-3 seconds after they complete. You can also get 5sec bars and build your own bars. The bars come thru with the start time of the bar and are usually available on the IB message queue and are received 1-2 seconds after completion.


    In my app I used historical data request to get a day of data and then build my own bars (on anytime frame you specify) from the 5sec bars during the trading day.

    I also calculate some indicators 2 SMA, Vwap, Heikin Ashi bars, 5bar pivots (using quadratic fit)) that are updated every 5sec as the bar forms. I have the structure in place to add any indicator you want and assign that to your strategy.

    Look for another video this week as I have now completed configuration to allow you to assign indicators to strategies and trade symbols on candles from 30'sec 1min, 2, 5, 15, 30, 60, daily bars.

    I also represent the results on a chart that updates every 5 seconds. The charts now also show any trades that the strategy made.

  3. Thank you, James.