Overall Statistics |
Total Trades 336 Average Win 0.39% Average Loss -0.22% Compounding Annual Return 424.057% Drawdown 34.900% Expectancy 1.210 Net Profit 73.927% Sharpe Ratio 5.407 Probabilistic Sharpe Ratio 79.073% Loss Rate 20% Win Rate 80% Profit-Loss Ratio 1.78 Alpha 3.964 Beta -1.29 Annual Standard Deviation 0.775 Annual Variance 0.601 Information Ratio 3.714 Tracking Error 1.177 Treynor Ratio -3.251 Total Fees $437.25 Estimated Strategy Capacity $11000.00 |
# Volatility ETF SMA Portfolio # ------------------------------------------------------------------------------------ ASSETS = ['IVOL', 'SVXY', 'UVXY', 'VIXM', 'VIXY', 'VXX', 'XVZ']; MA_F = 5; MA_S = 50; # ------------------------------------------------------------------------------------ class SMA_Portfolio(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetEndDate(2020, 5, 1) self.SetCash(100000) self.MKT = self.AddEquity('SPY', Resolution.Daily).Symbol self.sma_slow = {} self.sma_fast = {} self.weight = {} self.SetWarmUp(MA_S) for sec in ASSETS: self.AddEquity(sec, Resolution.Minute).Symbol self.sma_fast[sec] = self.SMA(sec, MA_F, Resolution.Daily) self.sma_slow[sec] = self.SMA(sec, MA_S, Resolution.Daily) self.Schedule.On(self.DateRules.EveryDay('SPY'), self.TimeRules.AfterMarketOpen('SPY', 65), self.rebalance) def rebalance(self): for sec in ASSETS: if self.sma_fast[sec].Current.Value > self.sma_slow[sec].Current.Value: self.weight[sec] = 1.0/len(ASSETS) else: self.weight[sec] = 0 for sec, weight in self.weight.items(): self.SetHoldings(sec, weight)