Overall Statistics
class HorizontalTransdimensionalAutosequencers(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 10, 15)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddUniverse(self.CoarseFilter, self.FineFilter)
    
        self.lastMonth = -1
        
        self.symbols = []
    def CoarseFilter(self, coarse):
        if self.Time.month == self.lastMonth:
            return Universe.Unchanged
            
        self.lastMonth = self.Time.month
        
        dv = sorted(coarse, key=lambda k:k.DollarVolume, reverse=True)
        self.Log(f'coarse {[c.Symbol.Value for c in dv[:5]]}')
        return [c.Symbol for c in dv[:5] ]
    

    def FineFilter(self, fine):
        self.Log(f'fine {[x.ValuationRatios.ForwardPERatio for x in fine]}')
        self.Log(f'fine {[x.Symbol.Value for x in fine]}')
        # fine = [x for x in fine if x.ValuationRatios.ForwardPERatio > 0]
        # fine = sorted(fine, key=lambda x: x.ValuationRatios.ForwardPERatio, reverse=False)
        self.symbols = [x.Symbol for x in fine]
        
        return self.symbols
        
        
    def OnSecuritiesChanged(self, changes):
        # pass
        self.Debug(f'added {[security.Symbol.Value for security in changes.AddedSecurities]}')