I am writing my code based on the Sector Weighted Portfolio Construction Bootcamp - I changed to select the Technology sector only and instead of MarketCap I am using RevenueGrowth to sort and select the fine universe. I am getting the error when the algorithm processed around 2K data points (not sure if this is relevant to the issue, but this is what I observed. It doesn't happen right away after running a backtest).

I only use AssetClassification in two places and I can't see why they can be None. I am new and any insight is much appreciated!

def SelectFine(self, algorithm, fine): filtered = [f for f in fine if f and f.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology] self.technology = sorted(filtered, key=lambda f: f.OperationRatios.RevenueGrowth.ThreeMonths, reverse=True)[:10]


def OnSecuritiesChanged(self, algorithm, changes): algorithm.Log("ADDED SECURITIES") for security in changes.AddedSecurities: if security.Fundamentals: print_stock(algorithm, security) sectorCode = security.Fundamentals.AssetClassification.MorningstarSectorCode if sectorCode not in self.symbolBySectorCode: self.symbolBySectorCode[sectorCode] = list() self.symbolBySectorCode[sectorCode].append(security.Symbol) algorithm.Log("REMOVED SECURITIES") for security in changes.RemovedSecurities: print_stock(algorithm, security) algorithm.Log(security.Fundamentals.AssetClassification.MorningstarSectorCode) if security.Fundamentals: sectorCode = security.Fundamentals.AssetClassification.MorningstarSectorCode if sectorCode in self.symbolBySectorCode: symbol = security.Symbol if symbol in self.symbolBySectorCode[sectorCode]: self.symbolBySectorCode[sectorCode].remove(symbol)