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:
backtrader/backtrader/cerebro.py
Line 1557 in d465c77
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.
I add this as a reference here, since this may look like the issue i encounter.
https://community.backtrader.com/topic/1367/error-__len__-should-return-0-on-livefeed/4
https://community.backtrader.com/topic/642/iqfeed-store-and-feed-help-needed/12