I am writing a test algo in Python and after making some changes in another function, my history call (Last line of my code below) stopped working all of a sudden.  I get the error: 

BacktestingRealTimeHandler.Run(): There was an error in a scheduled event EveryDay: 12. The error was NameError : name 'timedelta' is not defined

 

I am not a programmer just a hobbiest but I can't figure out why this error would be happening all of sudden?

Here is my code.

import numpy as np ### <summary> ### Basic template algorithm simply initializes the date range and cash. This is a skeleton ### framework you can use for designing an algorithm. ### </summary> class BasicTemplateAlgorithm(QCAlgorithm): '''Basic template algorithm simply initializes the date range and cash''' def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' #some Globals #stock="SPY" #bond="BNDX" #setting our benchmark aginst the SPY Ticker self.SetBenchmark("SPY") #Set Dates for backtesting self.SetStartDate(2019,1,1) #Set Start Date self.SetEndDate(2019,1,10) #Set End Date self.SetCash(100000) #Set Strategy Cash # Find more symbols here: http://quantconnect.com/data # Not sure if these need to be assigned to the variables or not but it started working once I assigned them to variables? They aren't referenced anywhere else. stockEquity=self.AddEquity("SPY", Resolution.Daily) #bondEquity=self.AddEquity(bond, Resolution.Daily) self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.At(12,0), self.HelloWorldDaily) def OnData(self, data): pass def HelloWorldDaily(self): slices = self.History(["SPY"], timedelta(7))