backtrader2/backtrader

Intraday + Daily datasets Date misalignment ?

Closed this issue · 1 comments

I'm running 2 datasets - one intraday (1-minute), 1 daily (resampled from the intraday dataset, though the problem also occurs with any other daily dataset).

The intraday dataset is loaded first, the daily - second.
Signals are generated using the 2nd dataset (daily), trades are executed on the intraday dataset.

I'm running the buy/sell logic via timer, next() method is skipped (there's nothing in there)
self.add_timer(
when=dtm.time(9, 45),
offset=dtm.timedelta(),
repeat=dtm.timedelta(),
weekdays=[],
weekcarry=True
)

Inside notify_timer, I'm logging this:
currentIntradayDate = self.data0.datetime.date(0)
currentDailyDate = self.data1.datetime.date(0)
self.log("Daily DB Date: {} | Intraday DB Date: {}" .format(currentDailyDate, currentIntradayDate))

This is what I see:
Daily DB Date: 2020-05-18 | Intraday DB Date: 2020-05-19

So, for some reason the Daily db date is not the same as the intraday one.

Any ideas on why this is the case, and what could be done to fix it? (Already tried oldsync=True, which made the backtest not run at all)

Regards
D

Seems to be by design.

Closing with 'won't fix' - feel free to re-open if not agreed.

Community discussion:

https://community.backtrader.com/topic/2974/intraday-daily-datasets-date-misalignment