I attempted to connect to an Interactive Brokers data feed to backtest a strategy of mine.
My code is below:
ibstore = bt.stores.IBStore(host='127.0.0.1', port=7497, clientId=3921)
data = ibstore.getdata(dataname=ticker_name, historical=True, fromdate=datetime(2000, 1, 1), todate=datetime(2016, 12, 31), timeframe=bt.TimeFrame.Seconds, compression=5)
cerebro.adddata(data)
print("---- Starting Backtest ----")
cerebro.run()
print("---- Plotting Results ----")
cerebro.plot()
When I run, I get the following error:
Traceback (most recent call last):
File "<PATH_TO>/Backtest.py", line 62, in
cerebro.plot()
File "/Users/Tim/miniconda3/lib/python3.5/site-packages/backtrader/cerebro.py", line 665, in plot
plotter.show()
File "/Users/Tim/miniconda3/lib/python3.5/site-packages/backtrader/plot/plot.py", line 707, in show
self.mpyplot.show()
AttributeError: 'Plot_OldSync' object has no attribute 'mpyplot'
Is backtesting with IB officially supported? If so, where is my code incorrect?