Hi,

I am following an options tutorial listed here but can't seem to get the code working. I am new to coding/programming so apologies if this seems like an easy/silly question.

I keep getting the below error;

Runtime Error: TypeError : 'NoneType' object is not iterable at OnData df = pd.DataFrame([[x.Right in main.py:line 24 TypeError : 'NoneType' object is not iterable (Open Stacktrace)

I believe the relevant bit of code where this error is occurring is here;

def OnData(self,slice): optionchain = None for i in slice.OptionChains: if i.Key != self.symbol: continue optionchain = i.Value self.Log("underlying price:" + str(optionchain.Underlying.Price)) df = pd.DataFrame([[x.Right,float(x.Strike),x.Expiry,float(x.BidPrice),float(x.AskPrice)] for x in optionchain], index=[x.Symbol.Value for x in optionchain], columns=['type(call 0, put 1)', 'strike', 'expiry', 'ask price', 'bid price']) self.Log(str(df))

What am I doing wrong?

Thanks in advance for any help.

Cheers.

Author