Hi all,
I am stuck on getting the historical data for Cboe/VIX and Cboe/VXV for EMA. SetWarmUp does not work with PythonQuandl at this point. Is there a way to fix it or get around?
Runtime Error: A data subscription for type 'PythonQuandl' was not found. (Open Stacktrace)
from QuantConnect.Python import PythonQuandl
from datetime import datetime, timedelta
from decimal import Decimal
import numpy as np
class RollingWindowAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2018,1,2)
self.SetEndDate(2018,3,15)
self.SetCash(25000)
self.vix = 'CBOE/VIX'
self.vxv = 'CBOE/VXV'
self.AddData(QuandlVix, self.vix, Resolution.Daily)
self.AddData[Quandl](self.vxv, Resolution.Daily)
period = 8
self.ratio_ema = ExponentialMovingAverage(period)
self.ratio_ema.Updated += self.EmaUpdated
self.emaWin = RollingWindow[IndicatorDataPoint](2)
self.SetWarmUp(timedelta(8))
def EmaUpdated(self, sender, updated):
'''Adds updated values to rolling window'''
self.emaWin.Add(updated)
def OnData(self, data):
if data.ContainsKey(self.vix) and data.ContainsKey(self.vxv):
self.ratio_ema.Update(datetime.now(), data[self.vix].VixClose / data[self.vxv].Value)
# self.Log("ratio" + str(self.ratio_window))
if self.ratio_ema.IsReady:
self.Log("ratio_ema:{0}".format(self.ratio_ema.Current.Value))
class QuandlVix(PythonQuandl):
def __init__(self):
self.ValueColumnName = "VIX Close"
self.Close = "VIX Close"
pass