Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Problem with fetcher in Live trading

The code below works during back test, and the vix value works live. vx1 however comes up nan in live.
(I have tried the vx1 part with and without fillna()) Note the Vx1 data file is ordered with the newest data at the top while the Vix data file has the newest data at the bottom.
I though I had it working once but it seems to have stopped.
Do I need to wait until the middle of the day for the quandl data?

To the folks at Q: Why not make these volatility things built in functions in your API. It would solve these issues and let us use them
in your contest.

Thanks for any suggestions!!

vixUrl = 'https://www.cboe.com/publish/scheduledtask/mktdata/datahouse/vixcurrent.csv'
vx1Url = 'https://www.quandl.com/api/v1/datasets/CHRIS/CBOE_VX1.csv'

fetch_csv(vixUrl, symbol='VIX', skiprows=1,date_column='Date', post_func=reformat_vix)
fetch_csv(vx1Url, date_column='Trade Date',date_format='%Y-%m-%d', symbol='v1', post_func=rename_col)
....
vix = data.current('VIX','price') #short term
vx1 = data.current('v1','Settle') #vix 1 month future
....

for vx1

def rename_col(df):
df = df.rename(columns={'Close': 'price'})
#df = df.sort(columns='Date', ascending=True)
df = df.fillna(method='ffill')
df = df[['price', 'Settle','sid']]
df = df.tshift(1, freq=trading_day)
#print df.tail()
return df

def reformat_vix(df):
df = df.rename(columns={'VIX Close':'price'})
#df = df.fillna(method='ffill')
df = df.tshift(1, freq=trading_day)
#print df.tail()
return df

1 response

I figured it out. The code is fine, Its just that the quandl (vx1) data is not available until mid day.