How do I run different data feeds at different timeframes in live trading
I have a usecase.
I noticed that index data values are wrong if requested as 1-second snapshot. So, I need to use 5-second real time bars on index values.
I use the index values to calculate the option strike price to be traded. I also use the futures levels in the mix for monitoring exit opportunities.
So, I want to use 5s real time bars for index, but tick-by-tick update or 1s snapshot update for futures and options.
I tried this with the backtrader code and when I keep all the data as 5-second real time bars, I am able to receive data.
But when I keep the index data as 5s bar and futures/options as tick-updates resampled to 1 second snapshot, (of course the 1s resampled data feeds added first and then the 5s rtb added), I receive no data.
Is this something inherent to interactive brokers?
run-out last edited by
@run-out I went through the ib-api docs. Nothing there signifies that we can't use two different timeframe data from within backtrader. I am able to do this in ib-insync, but not in backtrader.
ultra1971 last edited by
@hercp, at RTB 5sec level TWS api still deliver a OLHC bar.
But the TWS api implementation under 5 sec deliver price based on tick data. The IBStore (based on IBPy2) pull tickers with tick code= 233 for non "CASH" symbols, take a look into function def reqMktData() and IBData feed take this and calculate a price usinf function def _load_rtvolume():
The IB API tick type documentation is here: