Here's the example I found on Github showing how to use weekly data. It shows that the weekly data is not ready at the beginning.

  1. self.Consolidate("SPY", Calendar.Weekly, self.CalendarTradeBarHandler)
  2. self.weekly_window = RollingWindow[TradeBar](3)
  3. def CalendarTradeBarHandler(self, tradeBar):
  4. self.Debug(f'{self.Time} :: {tradeBar.Time} {tradeBar.High}')
  5. if self.weekly_window.isReady:
  6. self.Debug("Ready " + str(self.weekly_window[1].High))

And in the documentation, you use the History data to warm up

  1. spy = self.AddEquity("SPY", Resolution.Daily).Symbol
  2. history_trade_bar = self.History[TradeBar](spy, 10, Resolution.Daily)

I tried replacing Resolution.Daily to Calendar.Weekly or Resolution.Weekly but it doesn't compile. Is there any API I can use to warmup the self.weekly_window please? Thank you.

Author

Williamtong3190

April 2023