Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Unable to acces fetcher data: sid issue?

Does anyone know why I cannot link the sid vix to the fetched data so I can access it in def handle? It keeps failing and I can't figure this out.

Idea is to generate data frames from imported data and line it up with other price data by date so I can use it for signal generation.

import pandas as pd  
import numpy as np

def pre_funct(df):  
    df = df.rename(columns={'VIX Close': 'price'})  
    df = df.fillna(method='ffill')  
    df = df[['price', 'sid']] #why sid won't append?  
    log.info(' \n %s ' % df.head())  
    return df  
def initialize(context):  
    fetch_csv('https://www.quandl.com/api/v3/datasets/CBOE/VIX.csv',  
        date_column = 'Date',  
        date_format = '%y-%m-%d',  
        symbol = 'vix',  
        pre_func = pre_funct  
        )  
    context.spy = sid(8554)# SPY  

#def before_trading_start(context, data)  
def handle_data(context,data):  
    if 'price' in data['vix']:  
        Vix = data['vix'].price  
        record(Vix=Vix)

        SPY = data[context.spy].price  
        record(SPY=SPY)