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.706 Tracking Error 0.108 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class UniverseSelection(QCAlgorithm): sortedFilteredStocks = None def Initialize(self): self.SetStartDate(2021, 11, 1) # Set Start Date self.SetEndDate(2021, 11, 30) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.AddUniverse(self.CoarseSelectionFilter, self.FineSelectionFilter) self.UniverseSettings.Resolution = Resolution.Minute #self.UniverseSettings.ExtendedMarketHours = ExtendedMarketHours.Yes self.UniverseSettings.Leverage = 2 def CoarseSelectionFilter(self, coarse): sortedStocks = sorted(coarse, key=lambda c: c.DollarVolume, reverse=True) # options to sort, or filter by are DollarVolume, Volume, Price vs. SMA/EMA, relative volume "ref. examples" sortedFilteredStocks = [ c.Symbol for c in sortedStocks if ( c.HasFundamentalData and c.Price > 5 and c.Price < 500 )] selectedStocks = sortedFilteredStocks[:50] #top 10 in the list return selectedStocks def FineSelectionFilter(self, fine): #uses fundmental data sortedStocks = sorted(fine, key=lambda c: c.ValuationRatios.PERatio, reverse=False) # options to sort, or filter by are "ref. examples" sortedFilteredStocks = [ c.Symbol for c in sortedStocks if ( c.OperationRatios.ROE.OneYear > 0 and c.OperationRatios.ROA.OneYear > 0 )] selectedStocks = sortedFilteredStocks[:10] #top 10 in the list return selectedStocks def OnSecuritiesChanged(self, changes): #triggered when securities are added/removed from universe #for security in changes.AddedSecurities: # self.Debug(security.Symbol) for security in self.ActiveSecurities: self.Debug(security)