class TwelveMonthCycle(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2018, 1, 1)
self.SetEndDate(2018, 8, 1)
self.SetCash(100000)
self.AddEquity("SPY", Resolution.Daily)
self.UniverseSettings.Resolution = Resolution.Daily
self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
def CoarseSelectionFunction(self, coarse):
coarse = [x for x in coarse if (x.HasFundamentalData)
and (x.Market == "usa")]
return [i.Symbol for i in coarse]
def FineSelectionFunction(self, fine):
self.filtered_fine=[i for i in fine if i.FinancialStatements.FormType != None]
for i in self.filtered_fine:
self.Debug(i.FinancialStatements.FormType)
symbols = [i.Symbol for i in self.filtered_fine]
self.filtered_fine = symbols
return symbols
def OnData(self, data):
pass