I have a very simple, buy-at-open and sell-at-close algorithm and have been testing various schedules with it. In theory, using self.TimeRules.AfterMarketOpen(symbol, 0) and self.TimeRules.At(9, 30) interchangeably should yield the exact same results, all else equal. However, the difference in returns between the two are more than 2x. Code below for both. What could be causing this in the LEAN engine?

class BuyOpenSellCloseSPY(QCAlgorithm):

    def Initialize(self):
        self.SetTimeZone("America/New_York")
        self.SetStartDate(2017, 1, 1)
        self.SetCash(100000)
        self.ticker = self.AddEquity("SPY", Resolution.Minute, extendedMarketHours = True).Symbol

        self.Schedule.On(self.DateRules.EveryDay(self.ticker), self.TimeRules.AfterMarketOpen(self.ticker, 0), self.BuyOnOpen)
        self.Schedule.On(self.DateRules.EveryDay(self.ticker), self.TimeRules.BeforeMarketClose(self.ticker, 0), self.SellOnClose)
        
        
    def BuyOnOpen(self):
        self.SetHoldings(self.ticker, 1)
    
    def SellOnClose(self):
        self.Liquidate()

And again here, modified:

class BuyOpenSellCloseSPY(QCAlgorithm):

    def Initialize(self):
        self.SetTimeZone("America/New_York")
        self.SetStartDate(2017, 1, 1)
        self.SetCash(100000)
        self.ticker = self.AddEquity("SPY", Resolution.Minute, extendedMarketHours = True).Symbol

        self.Schedule.On(self.DateRules.EveryDay(self.ticker), self.TimeRules.At(9, 30), self.BuyOnOpen)
        self.Schedule.On(self.DateRules.EveryDay(self.ticker), self.TimeRules.BeforeMarketClose(self.ticker, 0), self.SellOnClose)
        
        
    def BuyOnOpen(self):
        self.SetHoldings(self.ticker, 1)
    
    def SellOnClose(self):
        self.Liquidate()