Overall Statistics |
Total Trades 49 Average Win 0.90% Average Loss -0.52% Compounding Annual Return 2.972% Drawdown 4.400% Expectancy 1.053 Net Profit 12.420% Sharpe Ratio 0.482 Loss Rate 25% Win Rate 75% Profit-Loss Ratio 1.74 Alpha -0.094 Beta 6.269 Annual Standard Deviation 0.065 Annual Variance 0.004 Information Ratio 0.175 Tracking Error 0.065 Treynor Ratio 0.005 Total Fees $0.00 |
from QuantConnect.Python import PythonQuandl class RollingWindowAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2014,1,1) self.SetEndDate(2018,1,1) self.SetCash(25000) vix = 'CBOE/VIX' vxv = 'CBOE/VXV' self.AddData(QuandlVix, vix, Resolution.Daily) self.AddData[Quandl](vxv, Resolution.Daily) self.vix_sma = self.SMA(vix, 1, Resolution.Daily) self.vxv_sma = self.SMA(vxv, 1, Resolution.Daily) self.ratio = IndicatorExtensions.Over(self.vxv_sma, self.vix_sma) self.PlotIndicator("Ratio", self.ratio) self.PlotIndicator("Data", self.vix_sma, self.vxv_sma) def OnData(self, data): if not (self.vix_sma.IsReady and self.vxv_sma.IsReady and self.ratio.IsReady): return self.Log("VIX "+ str(self.vix_sma.Current.Value) + " VXV " + str(self.vxv_sma.Current.Value)+" ratio " + str(self.ratio.Current.Value)) if not self.Portfolio.Invested and self.ratio.Current.Value > 1: self.MarketOrder('CBOE/VIX', 100) elif self.ratio.Current.Value < 1: self.Liquidate() class QuandlVix(PythonQuandl): def __init__(self): self.ValueColumnName = "VIX Close" self.close = "VIX Close" pass