I want to select the top 4 momentum security and pass them to insight.

Tryed with debug but did not get any insight

What is wrong with that line of code, does not accept security as symbol?

for security in ordered:
    insights.append(Insight.Price(security, timedelta(1), InsightDirection.Up))

Thanks

 

class MOMAlphaModel(AlphaModel): 
    def __init__(self):
        self.mom = []
    def OnSecuritiesChanged(self, algorithm, changes):
        for security in changes.AddedSecurities:
            symbol = security.Symbol
            self.mom.append({"symbol":symbol, "indicator":algorithm.MOM(symbol, 100, Resolution.Daily)})
            
    def Update(self, algorithm, data):
        insights = []
        
        ordered = sorted(self.mom, key=lambda kv: kv["indicator"].Current.Value, reverse=True)[:4]
        for security in ordered:
            insights.append(Insight.Price(security, timedelta(1), InsightDirection.Up))
        return insights