I'm new to the zipline. I was trying to run this custom algorithm of Paris-trading using my own data from a local csv. Here's the data format:
Input:
import pandas as pd
import pytz
from collections import OrderedDict
data = OrderedDict()
data['A'] = pd.read_csv('ohlcfetch.csv', index_col=1, parse_dates=['date'])
data['A'].fillna(method="ffill", inplace=True)
print data['A'].head()
Output:
date symbol open high low close volume
2017-09-01 A 64.90 65.180 64.21 64.38 1224667
2017-09-05 A 64.02 64.480 63.81 64.29 910613
2017-09-06 A 64.56 64.810 64.05 64.71 974511
2017-09-07 A 64.85 65.245 64.49 65.14 1075757
2017-09-08 A 65.15 65.680 64.83 65.02 1588439
Link to the algoritm: https://github.com/bartchr808/Quantopian_Pairs_Trader/blob/master/algo.py
I was trying something like this but couldn't figure it out after importing the data:
perf = zipline.run_algorithm(start=pd.to_datetime('2017-09-01').tz_localize(pytz.utc),
end=pd.to_datetime('2017-10-01').tz_localize(pytz.utc),
initialize=initialize,
capital_base=100000,
handle_data=my_handle_data,
data=panel)
Can someone please help me how I should run it now?