prenext datas not correct?
Aris L last edited by Aris L
Say I have two data feeds with different starting dates, I wanted to start processing as long as one has data, therefore I try to use prenext, since next is only called when both feeds starts to have data.
However, when I try to access the date in prenext. I gets the last date instead of the correct prenext date. The code is simply:
def prenext(self): for i, d in enumerate(self.datas): dt, dn = self.datetime.date(), d._name
say feed 1 starts from 2018-01-01, feed 2 starts from 01-20, both until 2018-06-13. The dt in the prenext above however, always returns the last day of the feed 2018-06-13. The earlier feed's close price is correct though; but the latter feed's close price is incorrect and shows the 2018-06-13's price.
How to understand this? How to fetch the data for the correct date, and price. If the price is not available for a feed, how can we tell that it's not started (since it's not showing nan, but showing a seemingly legitimate price)?
It's not because it's incorrect. If one data feed is not moving forward it delivers the last known data points (
To check if a data feed has moved, you have to check its length ... with
If a data feed has not started yet, its