Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0.073
Tracking Error
0.382
Treynor Ratio
0
Total Fees
$0.00
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]}')