Hello QuantConnect community,

I'm trying to get options data using the GetOptionContractList method, but it's not returning any data or contracts. When I go to print out the length or list of the contract list, it's always 0. This isn't just for SPY, but for any equity or ticker in my universe. How do I go about fixing this? Thanks!

class Algorithm(QCAlgorithm): def Initialize(self): self.SetCash(10000) self.SetStartDate(2021, 3, 14) self.SetEndDate(2021, 3, 15) self.AddEquity("SPY") self.SetSecurityInitializer(lambda x: x.SetDataNormalizationMode(DataNormalizationMode.Raw)) def OnData(self, data): contracts = self.OptionChainProvider.GetOptionContractList("SPY", self.Time) self.Debug("Contracts: " + str(len(contracts))

 

Author