Hi folks, Below is my snippet.  While checking if the data is present using if condition, the slice contains the symbol, hence not going inside the if loop. And in the next line while trying to access the TradeBar, it is throwing an error like “data is not present at this moment”. 

for symbol in self.symbols:

            # check if symbol is present in slice else continue to the next iteration

            if not(slice.ContainsKey(symbol) and slice[symbol]):

                self.Log(f"{self.Time} | {symbol} not present in slice.")

                continue            

            trade_bar = slice.Bars[symbol]

            self.Log(f"{trade_bar}")

 

I also tried accessing with data using the below code

def OnData(self, data):

        if not data.Bars.ContainsKey(self.symbols[0]):

            self.Log(f"{self.symbols[0]} not present in slice.")

            return

       

        bar = data.Bars[self.symbols[0]]

        self.Log("Bar close {} high {}".format(bar.Close,bar.High))

Its returning with “symbol not present in slice”. 

My question is slice is having the information whereas tradebar is not having the information. How is it possible? Could you please help me out on this? Am I missing something?