For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

ReplayData not working



  • cerebro.adddata(data) is working in below code, but when I replace that call with cerebro.replaydata(data,timeframe=bt.TimeFrame.Days,compression=1)
    Its not working, no errors also.
    Code Snippet:
    stockkwargs = dict(
    timeframe=bt.TimeFrame.Minutes,
    compression=5,
    historical=True, # only historical download
    fromdate=datetime.datetime(2020, 9, 1), # get data from..
    todate=datetime.datetime(2020, 9, 3) # get data from..
    )

    cerebro = bt.Cerebro(stdstats=False)
    store = bt.stores.IBStore(port=7496)
    data = store.getdata(dataname='TCS-STK-NSE-INR',**stockkwargs)
    cerebro.replaydata(data,timeframe=bt.TimeFrame.Days,compression=1)
    cerebro.addstrategy(IntraTrendStrategy)
    cerebro.run()



  • Could be the same behavior as the one reported in the following post:
    https://community.backtrader.com/topic/2988/next-not-triggering-on-ibkr-data-feed/2

    It seems the IB store was designed with live trading in mind. The capability of loading the historical data was added as a mean for backfilling the historical data during live trading . So in this regard it less suitable for pure backtesting scenario.

    Am I wrong ? Anyone having a different experience ?


Log in to reply
 

});