Overall Statistics |
Total Trades 625 Average Win 5.02% Average Loss -0.22% Compounding Annual Return -2.009% Drawdown 54.700% Expectancy -0.247 Net Profit -22.554% Sharpe Ratio -0.022 Probabilistic Sharpe Ratio 0.003% Loss Rate 97% Win Rate 3% Profit-Loss Ratio 22.56 Alpha 0.004 Beta -0.09 Annual Standard Deviation 0.162 Annual Variance 0.026 Information Ratio -0.371 Tracking Error 0.247 Treynor Ratio 0.039 Total Fees $831.40 |
import numpy as np from QuantConnect.Python import PythonQuandl class VIXPredictsStockIndexReturns(QCAlgorithm): def Initialize(self): self.SetStartDate(2006, 1, 1) self.SetEndDate(2018, 8, 1) self.SetCash(100000) self.AddEquity("OEF", Resolution.Daily) self.vix = 'CBOE/VIX' self.AddData(QuandlVix, self.vix, Resolution.Daily) self.window = RollingWindow[float](252*2) hist = self.History([self.vix], 1000, Resolution.Daily) for close in hist.loc[self.vix]['vix close']: self.window.Add(close) def OnData(self, data): if not data.ContainsKey(self.vix): return self.window.Add(self.Securities[self.vix].Price) if not self.window.IsReady: return history_close = [i for i in self.window] if self.Securities[self.vix].Price > np.percentile(history_close, 90): self.SetHoldings("OEF", 1) elif self.Securities[self.vix].Price < np.percentile(history_close, 10): self.SetHoldings("OEF", -1) class QuandlVix(PythonQuandl): def __init__(self): self.ValueColumnName = "VIX Close"