For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Issue using Jupyter w/ IB Data Store
I tried this code:
from __future__ import (absolute_import, division, print_function, unicode_literals) import datetime import backtrader as bt # from __future__ import (absolute_import, division, print_function, # unicode_literals) # import backtrader as bt # LOGIN TO IB REQUIRED class St(bt.Strategy): def __init__(self): self.sma = bt.indicators.SimpleMovingAverage(self.data) def run(args=None): cerebro = bt.Cerebro(stdstats=False) cerebro.addstrategy(St) store = bt.stores.IBStore(port=7496) data = store.getdata(dataname='GBP.USD', sectype='CASH', fromdate=datetime.datetime(2019, 9, 11), todate=datetime.datetime(2019, 9, 12), timeframe=bt.TimeFrame.Minutes, compression=5) cerebro.adddata(data) cerebro.addstrategy(St) cerebro.run() if __name__ == '__main__': run()
And get this as a response to the cell:
Server Version: 76 TWS Time at connection:20210103 17:14:29 Greenwich Mean Time
The kernel stays running for a bit (its latest version) and then no new data comes before it stops. The above message is also what comes before the dataframe when I simply print the IB data it is working fine.
But when I try to produce an indicator/backtest on it; nothing happens. Any ideas on the issue? As IBStore is built in would backtest usually know which columns to use or should I be matching them as if its CSV?