Overall Statistics
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Python import PythonQuandl
from datetime import datetime, timedelta

class QuandlFuturesDataAlgorithm(QCAlgorithm):

    def Initialize(self):
        ''' Initialize the data and resolution you require for your strategy '''
        self.SetStartDate(2018, 1, 1)
        self.SetEndDate(datetime.now().date() - timedelta(1))
        self.SetCash(25000);

        # Symbol corresponding to the quandl code
        self.AddData(QuandlVix, "CBOE/VIX", Resolution.Daily)
        # self.AddData[Quandl]("CBOE/VXV", Resolution.Daily)


    def OnData(self, data):
        '''Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.'''
        if not data.ContainsKey("CBOE/VIX"): return 
        
        self.Plot("VIX", "Price", data["CBOE/VIX"].Price)
        self.Debug("vix close: %s" % (data["CBOE/VIX"].Price))
        # self.Plot("VXV", "Close", data["CBOE/VXV"].Price)
        
class QuandlVix(PythonQuandl):
    
    def __init__(self):
        self.ValueColumnName = "vix close"