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 3.616 Tracking Error 0.058 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 |
class TestingAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 5, 1) self.SetEndDate(2021, 5, 5) self.SetCash(100000) self.UniverseSettings.Resolution = Resolution.Daily self.AddUniverse(self.CoarseFilter, self.FineFilter) # Add a stock to be able to schedule a function; schedule 1 day after month start, 60 mins after market open self.aapl = self.AddEquity("AAPL") self.Schedule.On(self.DateRules.MonthStart("AAPL", 1), self.TimeRules.AfterMarketOpen("AAPL", 60), self.ScheduledFunc) # Filters by dollar volume and .HasFundamentalData def CoarseFilter(self, coarse): filtered = [x.Symbol for x in coarse if x.DollarVolume > 500000 and x.HasFundamentalData] return filtered # Filters out financials, real esate, sorts by marketcap def FineFilter(self, fine): sortedByMktCap = sorted(fine, key=lambda x: x.MarketCap, reverse=True) self.testingvar = [x for x in sortedByMktCap if x.AssetClassification.MorningstarSectorCode not in [103, 104]] self.second_filt = [x.Symbol for x in self.testingvar] self.tickers = [x.Symbol.Value for x in self.testingvar] return self.second_filt # Testing Function def ScheduledFunc(self): self.Log("Testing Scheduled Function") self.mktcap = [x.MarketCap for x in self.testingvar] self.Log(self.tickers[:5]) self.Log(self.mktcap[:5]) return