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.908 Tracking Error 0.248 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
# region imports from AlgorithmImports import * import time # endregion class TestRemoveUniverse(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 5, 9) # Set Start Date self.SetEndDate(2021, 5, 15) self.SetCash(100000) # Set Strategy Cash self.AddEquity("SPY", resolution=Resolution.Minute, extendedMarketHours=True) # Add universe self.UniverseSettings.Resolution = Resolution.Minute self.UniverseSettings.ExtendedMarketHours = True self.UniverseSettings.FillForward = True self.coarse_universe = self.AddUniverse(self.CoarseUniverseSelection) self.AddUniverseSelection(ScheduledUniverseSelectionModel( self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY", -5), self.ScheduledSymbolSelect)) self.cur_time = time.time() self.all_daily_symbols = [] self.num_sub_to = 10 self.UniverseSettings.MinimumTimeInUniverse = timedelta(minutes=1) def OnData(self, data: Slice): if (self.Time.hour == 8 and self.Time.minute == 31): self.Debug(f"Time: {self.Time} | Length of slice: {len(data.Bars.Values)}") if (self.Time.hour == 9 and self.Time.minute == 31): self.Debug(f"Time: {self.Time} | Length of slice: {len(data.Bars.Values)}") def CoarseUniverseSelection(self, coarse): self.all_daily_symbols = [] self.cur_time = time.time() symbols = [] for stock in coarse: if (stock.AdjustedPrice > 1): self.all_daily_symbols.append(stock.Symbol) # Return temporary symbols return self.all_daily_symbols[:self.num_sub_to] def ScheduledSymbolSelect(self, date): # Overwrite current universe and only subscribe to the following symbols return self.all_daily_symbols[100:102]