Hi, I was looking for some help to compare SPY's previous day's price. Basically I want to buy SPY at 9:45am if the current price is greater than yesterday's closing price. The code below is what I have. I'm not sure how to access the previous day's closing price. Thanks for the help!

class EmotionalFluorescentPinkSalmon(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2021, 1, 1)
        self.SetCash(100000)
        
        self.spy = self.AddEquity("SPY", Resolution.Minute).Symbol

    def OnData(self, data):
            
        if self.Time.hour == 9 and self.Time.minute == 45 and not self.Portfolio.Invested:
            self.SetHoldings(self.spy, 1)
        
        if self.Time.hour == 15 and self.Time.minute == 45:
            self.Liquidate(self.spy)