Back

Runtime Error: A data subscription for type 'PythonQuandl' was not found.

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
Update Backtest








For custom data, you could use the history price to initialize the indicator. I attached an example. You could refer to Github

https://github.com/QuantConnect/Lean/blob/5db949a31c080ffa948ef3f15de27733b6e76411/Algorithm.Python/WarmupHistoryAlgorithm.py
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed