Overall Statistics |
Total Orders 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Start Equity 100000 End Equity 100000 Net Profit 0% Sharpe Ratio 0 Sortino 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.975 Tracking Error 0.105 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
# region imports from AlgorithmImports import * # endregion class SleepyBrownChicken(QCAlgorithm): def Initialize(self): self.SetStartDate(2024, 1, 1) # self.SetEndDate(2020, 1, 1) self.SetCash(100000) self.SetBenchmark("SPY") self.SetWarmUp(1) self.UniverseSettings.Resolution = Resolution.Daily # self.UniverseSettings.Resolution = Resolution.Monthly self.AddUniverse(self.CoarseSelectionFunction, self.SelectFine) self.SetBrokerageModel(InteractiveBrokersBrokerageModel()) self.SetExecution(ImmediateExecutionModel()) self.SPY = self.AddEquity("SPY",Resolution.Hour).Symbol self.rebalence_flag = 0 self.first_month_trade_flag = 1 self.Schedule.On(self.DateRules.MonthEnd("SPY", 2), self.TimeRules.At(1, 0), Action(self.monthly_rebalance)) def monthly_rebalance(self): self.rebalence_flag = 1 def CoarseSelectionFunction(self, coarse): if not (self.rebalence_flag or self.first_month_trade_flag): return Universe.Unchanged coarse = [x for x in coarse] self.Log("coarse size: " + str(len(coarse))) coarse = [x for x in coarse if x.HasFundamentalData] self.Log("coarse with fundamental size: " + str(len(coarse))) sortedByDollarVolume = sorted([x for x in coarse if x.HasFundamentalData and x.DollarVolume > 3000000 and x.Price >0], key = lambda x: x.DollarVolume, reverse=True)[:200] return [x.Symbol for x in sortedByDollarVolume] def SelectFine(self, fine): if not (self.rebalence_flag or self.first_month_trade_flag): return Universe.Unchanged self.rebalence_flag = 0 self.first_month_trade_flag = 0 return [x.Symbol for x in fine] def on_data(self, data: Slice): return #pass