Experts,

I'm a QuantConnect beginner and have a question about when market orders are getting filled. I'm using the OnEndOfDay event to submit my market order so it was my understanding that the order should be submitted and filled the next trading day. 

However, what seems to be happening is that the order is submitted the next day but then filled a day later. In the sample below, the order is created on 11/03 and filled on 11/05. 11/04 was not a holiday. I don't understand why the filled order event is not coming on 11/04. Any guidance appreciated. Thanks!

class TestStrategy1(QCAlgorithm):
    def Initialize(self):
        self.SetBenchmark("SPY")
        self.SetStartDate(2022, 11, 1)
        self.SetEndDate(2022, 12, 31)
        
    def OnData(self, data: Slice):
        # Wait for the algorithm to warm up
        if self.IsWarmingUp:
            return

        #  Only trade once a day
        if self.previousDate is not None and self.previousDate.date() == self.Time.date():
            return

        self.previousDate = self.Time  
        
      def OnEndOfDay(self) -> None:
        # Wait for the algorithm to warm up
        if self.IsWarmingUp:
            return

        #  Check entry conditions
        self.checkTradeEntry(symbol)       
        
    def checkTradeEntry(self, symbol):
        # Get prices
        closePrice = self.Securities[symbol].Close
        openPrice = self.Securities[symbol].Open
        lowPrice = self.Securities[symbol].Low
        highPrice = self.Securities[symbol].High
        position = self.Portfolio[symbol].Quantity

		if (condition is True):
			quantity = 1
			createdMarketOrder(symbol, quantity)    
			
    def createMarketOrder(self, symbol, quantity):
        ticket = self.MarketOrder(symbol=symbol, quantity=quantity)

        self.log(f"Created market order:\n{self.ticketToString(ticket)}")
	
        
    def OnOrderEvent(self, orderevent):
        #  Handles the OnOrderEvent for order state changes
        if orderevent.Status != OrderStatus.Filled:
            return

        self.log(f"Filled market order:\n{self.ticketToString(ticket)}")
    
    
    def log(self, message):
        #  Internal logging method
        self.Debug(f"{self.Time.date()}: {message}")	      

Output:

2022-11-03: Created market order: Type: Market Order, Price: 214.98, OrderId: 1, Status: Order submitted to the market, Symbol: TSLA, Quantity: -4.0
2022-11-05: Filled market order, ticket Type: Market Order, Price: 214.98, OrderId: 1, Status: Completed, Filled, Symbol: TSLA, Quantity: -4.0