IB API: Worried about "tweaking" of bars

Discussion in 'Automated Trading' started by The Big D, Aug 6, 2010.

  1. It appears there's 3 different ways to get bar data out of IB:

    1) the 5 second bar event

    2) aggregating together the tick data

    3) requesting historical data

    I'm using the java version of the API, not that it probably matters.

    What I'm trying to do is make a trading system that reacts at the end of a 1min or 5min bar. I want to be sure that this data, at the time I act, is the same data that will later appear in IB historical bar data, since that's what I backtest on.

    The problem I have is that watching IB charts, it's obvious that their tick data doesn't just aggregate directly to bar data over time. Oftentimes the last bar in the chart will "adjust", presumably to reflect cleaned up data from some source other than the ticks. I'm worried that the differences between this and the tick data will cause my system to mis-fire.

    So what I'd really like to do is get new historical data delivered to me every 1 or 5 minutes. But the API seems to not like doing that - it appears you can't leave a historical data delivery running and just get new events every bar. So am I doing something wrong, or do I need to be aggregating the 5 second data into longer bars, or what?
  2. I think if you use 5 second bar data that it will probably always match the charts that I.B uses. The problem with it though is that if you use market orders when you trade they will potentially be up to 5 seconds delayed while the system waits for the next burst of data to come along. What would be nice is if the data still updated in real time but every 5 seconds it corrected itself with data that was guaranteed to match up and contained any ticks that may have been ommitted for whatever reason. Im not really sure if this is possible but I like the idea of 5 second bars since they are always accurate. What I cant figure out is if the use of them results in an up to 5 second delay in triggering an order since i dont actually use them. Id love to know though if anybody does use them if this is possible.
  3. maxpi


    Pay for Barchart.com data or something, screwing around with IB's data can kill a project...