Overall Statistics
from QuantConnect.Python import PythonQuandl
from datetime import datetime, timedelta

class RollingWindowAlgorithm(QCAlgorithm):

    def Initialize(self):

        self.SetStartDate(2018,1,1)
        self.SetEndDate(2018,3,1)
        self.SetCash(25000)
        vix = 'CBOE/VIX'
        vxv = 'CBOE/VXV'
        self.AddData(QuandlVix, vix, Resolution.Daily)
        self.AddData[Quandl](vxv, Resolution.Daily)
        self.AddEquity("SPY", Resolution.Hour)
        self.vix_ema = self.EMA(vix, 10, Resolution.Daily, Field.Close)
        self.vxv_ema = self.EMA(vxv, 10, Resolution.Daily)
        self.PlotIndicator("Data", self.vix_ema, self.vxv_ema)
        # self.SetWarmUp(timedelta(10)) # Warm up 10 days of data.

    def OnData(self, data):
        
        if not (self.vix_ema.IsReady and self.vxv_ema.IsReady): return 
        if not (data.ContainsKey("SPY")): return 
        self.Log("SPY " + str(data["SPY"].Value) + "VIX "+ str(self.vix_ema.Current.Value) + " VXV " + str(self.vxv_ema.Current.Value))

class QuandlVix(PythonQuandl):
    def __init__(self):
        self.ValueColumnName = "VIX Close"
        self.Close = "VIX Close" 
        pass