I am trying to get zipline to work with non-US, intraday data that I loaded into a pandas DataFrame:
BARC HSBA LLOY STAN Date 2014-07-01 08:30:00 321.250 894.55 112.105 1777.25 2014-07-01 08:32:00 321.150 894.70 112.095 1777.00 2014-07-01 08:34:00 321.075 894.80 112.140 1776.50 2014-07-01 08:36:00 321.725 894.80 112.255 1777.00 2014-07-01 08:38:00 321.675 894.70 112.290 1777.00
I followed the tutorial here , replacing โAAPLโ with my own character code, and historical calls with โ1mโ data instead of โ1dโ.
Then I make the final call with algo_obj.run(DataFrameSource(mydf)) , where mydf is the above framework.
However, there are all kinds of problems associated with TradingEnvironment . According to the source code:
# This module maintains a global variable, environment, which is
However, using context does not seem to work fully. I still get errors, for example, stating that my timestamps are before the market opens (and, indeed, looking at trading.environment.open_and_close , time for the US market.
My question is: has anyone managed to use zipline with non-US, intraday data? Could you point me to a resource and ideally a code example on how to do this?
nb I saw that there are tests on github that relate to trading calendars (tradincalendar_lse.py, tradingcalendar_tse.py, etc.) - but this seems to only process data at the daily level. I would need to fix:
- opening / closing time
- reference data for the standard
- and maybe more ...
source share