Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Multiple Signals with Fetcher

Can fetcher be used with multiple signals? Below is what my csv looks like:

Date, a, b, c, d  
11092016, 0, 2, 1, 0  

I didn't find something similar in other fetcher posts and the help documentation only uses one. Is it possible? I have some control over the csv file, but I'd like to import four signals.

1 response

I think I found my own answer. The problem with the CSV above is the lack of a symbol identifier. In my case, SPY is really only a placeholder. The signals that follow it have no relation, though the script fails without it.
New CSV:

Date,symbol,a,b,c,d  
11/09/2016,SPY,0,2,0,1

Working script:

def initialize(context):  

    schedule_function(my_rebalance,  
                      date_rules.every_day(),  
                      time_rules.market_open(minutes=10))

    fetch_csv('https://linktodropbox.csv',  
               date_column = 'Date',  
               date_format = '%d/%m/%Y',  
               symbol='SPY')  
    context.stock = symbol('SPY')  


def my_rebalance(context, data):

    a = data['SPY']['a']  
    b = data['SPY']['b']  
    c = data['SPY']['c']  
    d = data['SPY']['d']     

Is there better code for getting the signals out of the CSV instead "data[symbol][signal]"?