Daily historic data with IB runs into error when more than 250 records retreived
I'm using the IB broker to request daily prices on QQQ going back a couple of years using the following call:
data = store.getdata(dataname='QQQ', timeframe=bt.TimeFrame.Days, compression=1, rtbar=False, fromdate=datetime.datetime.strptime('03/10/2015', "%d/%m/%Y"), sessionend=datetime.time(16, 0)) cerebro.resampledata(data, timeframe=bt.TimeFrame.Days, compression=1)
This gets the first 250 values just fine but breaks down afterwards. In my understanding the data request gets split up into multiple reqHistoricalData() calls and the sessionend parameter that I supplied gets dropped on the second request and ends up being None, thus generating an error:
09-May-18 13:40:11 ERROR Exception in message dispatch. Handler 'historicalData' for 'historicalData' Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/ib/opt/dispatcher.py", line 44, in __call__ results.append(listener(message)) File "/usr/local/lib/python2.7/site-packages/backtrader/stores/ibstore.py", line 937, in historicalData dteos = datetime.combine(dt, sessionend) TypeError: combine() argument 2 must be datetime.time, not None
Is there a way to submit a formal bug report on this? I didn't see Issues on github. I'd love to use this framework, but this is a real blocker at this point.
You may give the
developmentbranch a try. There is correction for this.
Thanks for the patch. This looks like it is working.