# region imports
from AlgorithmImports import *
# endregion
from datetime import datetime
import numpy as np


class FuturesBasis(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(datetime(2011, 1, 1))
        self.SetEndDate(datetime(2022, 5, 1))
        self.SetCash(100000)
        self.futureSP500 = self.AddFuture(Futures.Indices.SP500EMini,Resolution.Daily)
 


 
    def OnData(self, data):
        
  
        self.symbol = self.futureSP500.Symbol
        self.current_contract= self.Securities[self.futureSP500.Mapped].Symbol


        if not self.Portfolio.Invested:
            self.MarketOrder(self.current_contract, 1)
            
        if self.Portfolio.Invested and  data.SymbolChangedEvents.ContainsKey(self.symbol):
            changed_event = data.SymbolChangedEvents[self.symbol]
            old_symbol = changed_event.OldSymbol
            new_symbol = changed_event.NewSymbol
            tag = f"Rollover - Symbol changed at {self.Time}: {old_symbol} -> {new_symbol}"
            quantity = self.Portfolio[old_symbol].Quantity

            # Rolling over: to liquidate any position of the old mapped contract and switch to the newly mapped contract
            self.Liquidate(old_symbol)
            self.MarketOrder(new_symbol, quantity)
             

Backtest Handled Error: ES W8Z0KK3PQJ9D: The security does not have an accurate price as it has not yet received a bar of data. Before placing a trade (or using SetHoldings) warm up your algorithm with SetWarmup, or use slice.Contains(symbol) to confirm the Slice object has price before using the data. Data does not necessarily all arrive at the same time so your algorithm should confirm the data is ready before using it.

The backtest is running,but getting the above error.I tried the above two solution,but still getting the error