Hi Christian,
The url you are using points to an html page that offers a download button, rather than the raw file.
If you use https://www.dropbox.com/s/skmcidbnkjtwysx/finpythtrend.csv?dl=1 the raw file is returned.
I took the liberty of looking at your file, and I noticed you have symbols as columns (observation format). To use it with fetcher, you need to convert it to record format, where 'symbol' is a column, and each row specifies the symbol. If you have N symbols you will have N rows for each date in your dataset. You can either reformat the file before using it with fetcher, or you can use a pre_func to do the transformation when you pull the data into your algorithm.
Here is a dummy data sample that is also in observation style:
date,GPS,HON,NFLX
2002-02-15,128.00,128.18,127.41
2002-02-18,129.39,129.65,128.95
2002-02-19,128.73,129.37,128.52
2002-02-20,129.57,129.70,128.54
2002-02-21,128.64,129.05,127.72
and here is an algorithm that uses a pre_func to reformat the data into record format:
import numpy as np
from pandas import DataFrame
def unpivot(frame):
"""
Function to convert observation data into record data format.
Copied from the unpivot function from:
http://pandas.pydata.org/pandas-docs/dev/reshaping.html
"""
frame = frame.set_index('date')
N, K = frame.shape
data = {'value' : frame.values.ravel('F'),
'variable' : np.asarray(frame.columns).repeat(N),
'date' : np.tile(np.asarray(frame.index), K)}
return DataFrame(data, columns=['date', 'symbol', 'value'])
def initialize(context):
fetch_csv('http://yourserver.com/sample.csv', pre_func=unpivot)
def handle_data(context, data):
print data[sid(25090)]['value']
The observation format is very common, and we're considering adding it to the next iteration of fetch_csv. There's a thread and a specification shared that you can review if you'd like to weigh in on the direction - https://www.quantopian.com/posts/proposed-changes-to-fetcher-and-universe-selection
Thanks for your question, and I hope you have smooth sailing from here.
thanks,
fawce