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
-1.923
Tracking Error
0.186
Treynor Ratio
0
Total Fees
$0.00
class NumberStocksInUniverce(QCAlgorithm):
    
    def Initialize(self):
        self.SetStartDate(2020, 6, 1)  
        self.SetEndDate(2020,11,9)  
        self.SetCash(10000)  
        self.AddUniverse(self.CoarseSelection, self.FineSelection)
        self.UniverseSettings.Resolution = Resolution.Daily


    def CoarseSelection(self, coarse):
        
        AllSecurities = [ x for x in coarse ]
        self.Plot("Strategy Equity", "AllSecurities", len(AllSecurities))  
        
        Stocks = [x for x in AllSecurities if (x.HasFundamentalData) and (float(x.Price) > 0)]
        self.Plot("Strategy Equity", "Stocks", len(Stocks))
        
        StocksAboveFive = [x for x in Stocks if (x.HasFundamentalData) and (float(x.Price) > 5)]
        self.Plot("Strategy Equity", "StocksAboveFive", len(StocksAboveFive))
        
        TopDollarVolume = sorted(StocksAboveFive, key=lambda x: x.DollarVolume, reverse=True)[:500]
        self.Plot("Strategy Equity", "TopDollarVolume", len(TopDollarVolume))

        return  [x.Symbol for x in TopDollarVolume[:500]]
        
    def FineSelection(self, fine):
        
        top_pcf_ratio = sorted(fine, key=lambda x: x.ValuationRatios.PCFRatio, reverse=True)[:50]
        self.Plot("Strategy Equity", "PCFRatio", len(top_pcf_ratio))
        
        return [x.Symbol for x in top_pcf_ratio[:50]]
        '''
        top_roe = sorted(fine, key=lambda x: x.OperationRatios.ROE.OneMonth, reverse=True)[:50]
        self.Plot("Strategy Equity", "ROE", len(top_roe))
        
        return [x.Symbol for x in top_pcf_ratio[:50]]
        '''