stockkwargs = dict( timeframe = bt.TimeFrame.Days, rtbar = False, # use RealTime 5 seconds bars historical = True, # only historical download what = 'TRADES', # historical - what to show TRADES MIDPOINT BID ASK BID_ASK HISTORICAL_VOLATILITY OPTION_IMPLIED_VOLATILITY useRTH = False, # historical - download only Regular Trading Hours qcheck = 0.5, # timeout in seconds (float) to check for events backfill_start = True, # do backfilling at the start backfill = True, # do backfilling when reconnecting fromdate = datetime.datetime(2017,1,2), # get data from.. latethrough = False, # let late samples through tradename = None # use a different asset as order target )
That combination of parameters seems overly complex. See Docs - Interactive Brokers (or the data feeds reference quoted above, which uses the same source)timeframe defaults already to Days (all data feeds default actually to this) rtbar defaults already to False as has no role in historical downloads what defaults already to TRADES for an asset like *-STK-* useRTH -> default already to False qcheck defaults already to 0.5 and plays no role in historical downloads backfill_start defaults already to True and plays no roles in historical downloads backfill defaults already to True and plays no role in historical downloads latethrough defaults already to Falseand plays no role in historical downloads tradename defaults already to None and plays no role in data fetching at all
Missing and could play a role:todate which defaults to None to indicate until now and can specified to indicate what the ending data of the historical download has to be
With that in mind and for a daily historical download like the above the parameters can be simplified to:stockkwargs = dict( historical=True, fromdate=datetime.datetime(2017, 1, 2), # get data from )
From the docs quoted above:- ``historical`` (default: ``False``) If set to ``True`` the data feed will stop after doing the first download of data. The standard data feed parameters ``fromdate`` and ``todate`` will be used as reference. The data feed will make multiple requests if the requested duration is larger than the one allowed by IB given the timeframe/compression chosen for the data.