backtrader2/backtrader

cerebro will break if having non resampled data mixed with resampled data in _runnext

Closed this issue · 2 comments

When having different feeds:

  • 1 tick data feed
  • 1 or more resampled feeds

and _runnext is called because dt for resampled feed moved forward, Cerebro will break at the following block:

dt0 = min((d for i, d in enumerate(dts)

since the code:

(d for i, d in enumerate(dts) if d is not None and i not in rsonly)

will sometimes not return any data feeds (resampled feed is in rsonly)

i fixed this by changing it to the code below, but I am not sure about the consequences of this.

(d for i, d in enumerate(dts) if (d is not None and (i not in rsonly or not onlyresample)))

I tried to write some code to reproduce the issue but its hard to reproduce it. I will open another issue when having some testing code.