Overall Statistics |
Total Orders 229 Average Win 2.93% Average Loss -1.22% Compounding Annual Return 11.065% Drawdown 22.900% Expectancy 0.435 Start Equity 100000 End Equity 169128.66 Net Profit 69.129% Sharpe Ratio 0.463 Sortino Ratio 0.426 Probabilistic Sharpe Ratio 12.030% Loss Rate 58% Win Rate 42% Profit-Loss Ratio 2.41 Alpha 0.042 Beta 0.44 Annual Standard Deviation 0.152 Annual Variance 0.023 Information Ratio 0.033 Tracking Error 0.161 Treynor Ratio 0.16 Total Fees $4023.44 Estimated Strategy Capacity $1600000.00 Lowest Capacity Asset SHY SGNKIKYGE9NP Portfolio Turnover 12.50% |
#region imports from AlgorithmImports import * #endregion class EtfSmaAlphaModel(AlphaModel): def __init__(self, main_symbol, alt_symbol): self._main_symbol = main_symbol self._alt_symbol = alt_symbol self._day = -1 def update(self, algorithm, data): if self._day == algorithm.time.day or not algorithm.is_market_open(self._main_symbol): return [] insights = [] if data.contains_key(self._main_symbol): period = timedelta(1) if data[self._main_symbol].close > self._sma.current.value: insights.append(Insight.price(self._main_symbol, period, InsightDirection.UP)) insights.append(Insight.price(self._alt_symbol, period, InsightDirection.FLAT)) else: insights.append(Insight.price(self._alt_symbol, period, InsightDirection.UP)) insights.append(Insight.price(self._main_symbol, period, InsightDirection.FLAT)) if insights: self._day = algorithm.time.day return insights def on_securities_changed(self, algorithm, changed): if self._main_symbol in [added.symbol for added in changed.added_securities]: self._sma = algorithm.SMA(self._main_symbol, 200, Resolution.HOUR)
#region imports from AlgorithmImports import * from alpha import EtfSmaAlphaModel #endregion class ParticleQuantumChamber(QCAlgorithm): def initialize(self): self.set_start_date(2015, 6, 15) self.set_end_date(2020, 6, 15) self.set_cash(100000) self._sso = Symbol.create('SSO', SecurityType.EQUITY, Market.USA) # SSO = 2x levered SPX self._shy = Symbol.create('SHY', SecurityType.EQUITY, Market.USA) # SHY = short term Treasury ETF self.set_warmup(200) self.set_benchmark('SPY') self.universe_settings.resolution = Resolution.HOUR self.set_alpha(EtfSmaAlphaModel(self._sso, self._shy)) self.set_universe_selection(ManualUniverseSelectionModel([self._sso, self._shy])) self.set_execution(ImmediateExecutionModel()) self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel())