Overall Statistics |
Total Orders 6598 Average Win 0.05% Average Loss -0.05% Compounding Annual Return -16.423% Drawdown 25.800% Expectancy -0.160 Start Equity 100000 End Equity 76363.75 Net Profit -23.636% Sharpe Ratio -2.142 Sortino Ratio -2.896 Probabilistic Sharpe Ratio 0.009% Loss Rate 57% Win Rate 43% Profit-Loss Ratio 0.96 Alpha -0.11 Beta -0.582 Annual Standard Deviation 0.078 Annual Variance 0.006 Information Ratio -1.549 Tracking Error 0.172 Treynor Ratio 0.288 Total Fees $6598.00 Estimated Strategy Capacity $4700000.00 Lowest Capacity Asset CNTE SAI0XJNH6IJP Portfolio Turnover 11.11% |
from AlgorithmImports import * class ShortingYesterdayTopDailyGainers(QCAlgorithm): def initialize(self): self.set_start_date(2023, 2, 13) self.universe_settings.schedule.on(self.date_rules.week_start()) self._universe = self.add_universe(self.selection) self.schedule.on(self.date_rules.week_start(), self.time_rules.at(9, 31), self.rebalance) self.set_execution(SpreadExecutionModel(0.01)) self.add_risk_management(MaximumUnrealizedProfitPercentPerSecurity(0.05)) self.add_risk_management(MaximumDrawdownPercentPerSecurity(0.05)) self.last_prices = None def selection(self, fundamental): selected = [] prices = pd.DataFrame([[f.symbol, f.adjusted_price, f.market_cap] for f in fundamental], columns=["Symbol", "Price", "Cap"]).set_index("Symbol") prices = prices[(prices["Cap"] >= 1e10) & (prices["Price"] >= 5)] if isinstance(self.last_prices, pd.DataFrame) and not self.last_prices.empty: pct_chg = ((prices - self.last_prices) / self.last_prices).dropna() selected = list(pct_chg.nlargest(50, 'Price').index) self.last_prices = prices return selected def rebalance(self): self.set_holdings([PortfolioTarget(symbol, -0.01 if symbol in self._universe.members.keys else 0) for symbol in self.securities.keys()])