import numpy as np
class BasicTemplateAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2010,1,1) #Set Start Date
self.SetEndDate(2010,2,2) #Set End Date
self.SetCash(100000) #Set Strategy Cash
self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
def CoarseSelectionFunction(self, coarse):
sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
return [ x.Symbol for x in sortedByDollarVolume[:500] ]
def FineSelectionFunction(self, fine):
sortedByPeRatio = sorted(fine, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
return [ x.Symbol for x in sortedByPeRatio ]
def OnData(self, data):
symbols = self.CoarseSelectionFunction(self, data)
I have attempted this but receieve the error:
Runtime Error: TypeError : CoarseSelectionFunction() takes 2 positional arguments but 3 were given
at OnData in main.py:line 35
TypeError : CoarseSelectionFunction() takes 2 positional arguments but 3 were given (Open Stacktrace)
How can I call the CoarseSelectionFunction and return the result to OnData?