I'm working on a new algorithm that starts by getting the past N days worth of opening quotes, including today.  I can get the historical data just fine, but I'm struggling to figure out how to get the current day's opening price.  In the below code, which is called right after warmup finishes, the current price/opening price are 0.0.  The backtest starts at 10am, so if I add an event to run at market open, the event doesn't fire.

The below code set to run from Oct 3 to 4, 2022 produces this output:

2022-10-03 11:00:00 :time 2022-09-15 392.905585 2022-09-16 391.282255 2022-09-17 384.180000 2022-09-20 382.270000 2022-09-21 385.100000 2022-09-22 386.060000 2022-09-23 376.500000 2022-09-24 370.580000 2022-09-27 366.410000 2022-09-28 368.010000 2022-09-29 364.440000 2022-09-30 366.830000 2022-10-01 361.870000

2022-10-03 11:00:00 :2022-10-03 10:00:00 SPY

2022-10-03 11:00:00 :2022-10-03 10:00:00 open: 0.0

2022-10-03 11:00:00 :2022-10-03 10:00:00 price now: 0.0

2022-10-04 09:31:00 :2022-10-04 09:30:00 print price

2022-10-04 09:31:00 :2022-10-04 09:30:00 spy open is : 366.38

Would appreciate any advice--I'm not seeing a good answer to this on the forum.  Thanks!

def _BuildHistory(self, sym):
        # get the history for the time period.  Remember if we print this,
        # it will be off by 1 day as the time is the END of the period (so actual
        # day is 1 before date printed with it)
        try:
            historyDF = self.History([sym], self.NUM_DAYS+1, Resolution.Daily)
        except:
            self.Debug('Failed to load history for '+sym)
            return
        
        try:
            equityHistory = historyDF.loc[sym]
        except:
            self.Debug('No history located for '+sym)
            return

        try:
            openPrices = equityHistory['open']
        except:
            self.Debug('Failed to get open history for '+sym)
            return
            
		self.Log(openPrices)
        self.Log(str(self.Time) +' '+str(self.Securities[sym]))
        self.Log(str(self.Time) +' '+'open: '+str(self.Securities[sym].Open))
        self.Log(str(self.Time) +' '+'price now: '+str(self.Securities[sym].Price))

def _PrintPrice(self):
        self.Log(str(self.Time) +' '+'print price')
        self.Log(str(self.Time) +' '+'spy open is : '+str(self.Securities['SPY'].Open))

def _Initialize(self):
        self.AddEquity("SPY", Resolution.Minute)
        self._BuildHistory('SPY')
        if self.Securities['SPY'].Open < 0.001:
            self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 0), self._PrintPrice)
        else:
            self.Log(str(self.Time) +' '+'spy price: '+str(self.Securites['SPY'].Open))
        return