For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Replay data not working at all with Interactive brokers
-
Replay data looping through only Higher TimeFrame completely ignoring lower TimeFrame.
I am ready to pay to solve this issue. I have posted this issue so many times now. Please help
class IntraTrendStrategy(bt.Strategy): def log(self, txt, dt=None): ''' Logging function fot this strategy''' dt = dt or self.datas[0].datetime.datetime(0) print('%s, %s' % (dt.isoformat(), txt)) def __init__(self): pass def start(self): self.counter = 0 def prenext(self): self.counter += 1 self.log('prenext len %d - counter %d' % (len(self), self.counter)) def next(self): self.counter += 1 self.log('---next len %d - counter %d' % (len(self), self.counter)) stockkwargs = dict( timeframe=bt.TimeFrame.Minutes, compression=15, historical=True, # only historical download fromdate=datetime.datetime(2020, 9, 1), # get data from.. todate=datetime.datetime(2020, 9, 13) # get data from.. ) cerebro = bt.Cerebro(stdstats=False) store = bt.stores.IBStore(port=7496,clientId=5) data = store.getdata(dataname='TCS-STK-NSE-INR',**stockkwargs) cerebro.replaydata(data,timeframe=bt.TimeFrame.Days,compression=1) cerebro.addstrategy(IntraTrendStrategy) cerebro.run()
Output
2020-09-01T23:59:59.999989, ---next len 1 - counter 1
2020-09-02T23:59:59.999989, ---next len 2 - counter 2
2020-09-03T23:59:59.999989, ---next len 3 - counter 3
2020-09-04T23:59:59.999989, ---next len 4 - counter 4
2020-09-07T23:59:59.999989, ---next len 5 - counter 5
2020-09-08T23:59:59.999989, ---next len 6 - counter 6
2020-09-09T23:59:59.999989, ---next len 7 - counter 7
2020-09-10T23:59:59.999989, ---next len 8 - counter 8
2020-09-11T23:59:59.999989, ---next len 9 - counter 9 -
Nobody using this feature? no one facing this issue?