For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Does anyone have a live IB feed working with a strategy?
Michael Serra last edited by
I am connecting to an IB paper account and I can see tick data flowing with debug turned on using the IBStore, but next() is not firing at all. I tried a whole bunch of parameters on the IBStore and Cerebro engine without any luck. Thoughts?
import backtrader as bt class TestStrategy(bt.Strategy): def __init__(self): print("init") def next(self): print("next") def run(): cerebro = bt.Cerebro() store = bt.stores.IBStore(port=7496, _debug=True) cerebro.broker = store.getbroker() data = store.getdata(dataname='ES', sectype='CONTFUT', exchange='GLOBEX', timeframe=bt.TimeFrame.Seconds) cerebro.resampledata(data, timeframe=bt.TimeFrame.Seconds, compression=5) cerebro.addstrategy(TestStrategy) cerebro.run() if __name__ == '__main__': run()