Hi,

Simple question. I'm trying to modify the "EqualWeightingPortfolioConstructionModel" in order to assign equal amounts of cash from current balance to all securities in my Universe. The process would be to take current balance at market open, divide it by the number of securities in Universe (I already added "for added in changes.AddedSecurities: self.securities.append(added)" in OnSecuritiesChanged method to collect those securities), and then once there are insights for some of those securities create the target to buy as many shares as possible with that amount of cash. Doing the below I at least fix the weight to all securities in the Universe (and not just the ones with insights as per the original model) but the algo is still constantly buying and selling to adjust that target percent. How can I create those targets correctly?

     # Give equal cash to each security in our Universe
        count = len([x.Symbol for x in self.securities])
        percent = 0 if count == 0 else 1.0 / count

        errorSymbols = {}
        for insight in lastActiveInsights:
            target = PortfolioTarget.Percent(algorithm, insight.Symbol, insight.Direction * percent)
            if not target is None:
                targets.append(target)
            else:
                errorSymbols[insight.Symbol] = insight.Symbol

 

Thanks!

Emilio