Hi All -
I'm trying to use Fetcher to pull some outside data into the backtester:
def rename_col(df):
df = df.rename(columns={'XLB': 'rank'})
df = df.fillna(method='ffill')
df = df[['rank', 'sid']]
log.info(' \n %s % df.head()')
return df
def initialize(context):
#Read the rankings
fetch_csv('https://www.dropbox.com/s/3cj153w85xs1mjo/XLB_Ranks.csv',
date_column='Date',
symbol=sid(19654),
post_func=rename_col)
def handle_data(context, data):
if 'rank' in data[sid(19654)]:
log.debug (str(data[sid(19654)]['rank']))
So... a few questions. First, this code is giving me the following error
File testalgorithm_sycheck.py:16, in initialize
File algoproxy.py:1411, in fetch_csv
File requests_csv.py:359, in __init_
File requests_csv.py:255, in load_df
File requests_csv.py:365, in fetch_data
File parsers.py:400, in parser_f
File parsers.py:205, in _read
File parsers.py:608, in read
File parsers.py:1028, in read
File parser.pyx:706, in pandas.parser.TextReader.read (pandas/parser.c:6745)
File parser.pyx:728, in pandas.parser.TextReader._read_low_memory (pandas/parser.c:6964)
File parser.pyx:781, in pandas.parser.TextReader._read_rows (pandas/parser.c:7568)
File parser.pyx:768, in pandas.parser.TextReader._tokenize_rows (pandas/parser.c:7451)
File parser.pyx:1661, in pandas.parser.raise_parser_error (pandas/parser.c:18744)
Also, if I'm doing this for 9 different sids, is there an easier way than creating, saving and importing each separately?
Thanks all.