sthoooon
12/12/2017 - 3:03 PM

Set Date Range

Initializing Analysis Dates

The date range for your backtest is defined in your Initialize method. You can set this with fixed dates or a datetime object. These methods are called self.SetStartDate() and self.SetEndDate() .

class BootCampTask(QCAlgorithm):

    def Initialize(self):
        # Date Range
        self.SetStartDate(2017, 01, 01)
        self.SetEndDate(2017, 10, 31)
        self.AddEquity("SPY", Resolution.Daily)
        
    def OnData(self, data):
        pass