Hi everyone,

I've completed the bootcamp excercises. I'm striving to follow the recommended practices from the very beginning hence using the framework.

The code below is supposed to simply pick top N stocks by descending ROIC.

However at Runtime I receive a TypeError : OnSecuritiesChanged() missing 1 required positional argument: 'changes' TypeError: OnSecuritiesChanged() missing 1 required positional argument: 'changes'. As if OnSecuritiesChanged was called without 'changes' at some point.

What am I doing wrong?

from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
from QuantConnect.Data import Fundamental
from datetime import timedelta

class VentralTachyonGearbox(QCAlgorithm):

def Initialize(self):

self.nAssetsInPortfolio = 10

self.SetStartDate(2020, 11, 1)
self.SetCash(100000)

self.SetExecution(ImmediateExecutionModel())
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
self.UniverseSettings.Resolution = Resolution.Daily

self.AddUniverse(
self.CoarseSelectionFilter,
self.FineFundamentalSorter
)

self.AddAlpha(AllUp)

def CoarseSelectionFilter(self, coarse):
filtered = [x.Symbol for x in coarse if x.HasFundamentalData]
return filtered

def FineFundamentalSorter(self, fine):
sortedByROIC = sorted(fine, key=lambda x: x.OperationRatios.ROIC.ThreeMonths, reverse=True)
return [s.Symbol for s in sortedByROIC[:self.nAssetsInPortfolio]]


class AllUp(AlphaModel):
def __init__(self):
self.securities = []

def OnSecuritiesChanged(self, algorithm, changes):
if not changes:
return
for security in changes.AddedSecurities:
self.securities.append(security)
for security in changes.RemovedSecurities:
if symbol in self.securities:
self.secs.remove(security)

def Update(self, algorithm, data):
return Insight.Group(
[Insight.Price(x.Symbol, timedelta(1), InsightDirection.Up) for x in self.securities]
)