Overall Statistics |
Total Orders 1732 Average Win 0.33% Average Loss -0.24% Compounding Annual Return 65.214% Drawdown 25.800% Expectancy 0.372 Start Equity 1000000 End Equity 2150406.53 Net Profit 115.041% Sharpe Ratio 1.679 Sortino Ratio 2.141 Probabilistic Sharpe Ratio 80.438% Loss Rate 42% Win Rate 58% Profit-Loss Ratio 1.36 Alpha 0.259 Beta 1.271 Annual Standard Deviation 0.239 Annual Variance 0.057 Information Ratio 1.437 Tracking Error 0.201 Treynor Ratio 0.316 Total Fees $10493.77 Estimated Strategy Capacity $6000000.00 Lowest Capacity Asset GRAL YJLM306MVPET Portfolio Turnover 20.52% |
from AlgorithmImports import * class ShortingYesterdayTopDailyGainers(QCAlgorithm): def initialize(self): self.set_cash(1_000_000) self.set_start_date(2023, 2, 13) etf = self.add_equity("QQQ").symbol self.add_universe(self.universe.etf(etf)) self.settings.rebalance_portfolio_on_insight_changes = False self.universe_settings.schedule.on(self.date_rules.month_start()) self.schedule.on(self.date_rules.every_day(etf), self.time_rules.before_market_close(etf, 1), self.store_closes) self.schedule.on(self.date_rules.every_day(etf), self.time_rules.after_market_open(etf, 1), self.gap_check) self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel()) self.closes = {} self.gap_size = 0.05 # float(self.get_parameter("gap_size", 10))/100 self.insight_period = 10 # int(float(self.get_parameter("insight_period", 5))) def store_closes(self): self.closes = {security : security.price for security in self.active_securities.values if security.price > 0} def gap_check(self): if not self.closes: return gap = {security.symbol: ((security.price - close) / close) for (security, close) in self.closes.items() \ if ((security.price - close) / close) > self.gap_size} gap_rank = list(dict(sorted(gap.items(), key=lambda item: item[1], reverse=True)).keys())[:10] self.emit_insights([Insight.price(symbol, timedelta(self.insight_period), InsightDirection.UP) for symbol in gap_rank])