I have a universe where I add stocks and options. in OnData I have to access both of the symbols at the same time, so I did a lookup dictionary. The problem is when I try to access the values(optinos symbol) in the dictionary for each stock symbol. When debugging the code i get the value I need but in the code it always throws me an error message. 

 def SelectCoarse(self, coarse):
        #---------------Parameters (not implemented yet) + adding tickers for testing------------#
        tickers = ["AAPL", "IBM"]
        symbols = [Symbol.Create(x, SecurityType.Equity, Market.USA) for x in tickers]
        for x in symbols:
            self.all_symbols.setdefault(x, [])
            option = self.AddOption(x)

            option.SetFilter(0, +5, timedelta(0), timedelta(60))
        return symbols
            #---> 'AAPL' : '?AAPL'

I have to acces both because I did some calculations with the stock symbols. For each stock I then have to acces the options symbol to check if it is invested or not(Option).


for symbol in self.all_symbols:
            if self.Portfolio[self.all_symbols[symbol]].Invested and bool(self.future_dates[symbol]) is True: 
                if self.Time > self.future_dates[symbol][0]:
                    del self.future_dates[symbol][0]
            if  not self.Portfolio[self.all_symbols[symbol]].Invested and bool(self.future_dates[symbol]) is True:
                if (self.Time >= (self.future_dates[symbol][0] - timedelta(days=self.days[symbol])) and self.first_time == True and self.Time < self.future_dates[symbol][0]): 
                    chains = data.OptionChains.get(self.all_symbols[symbol])
                    self.Debug("stock name: " + str(symbol.Value))
                    self.Debug("Option name: " + str(self.all_symbols[symbol].Value))

Error Code:

Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the 'list'>) method.

Does somebody know how to fix this problem?