Any luck with minute Data?

99 views
Skip to first unread message

Andy Visser

unread,
Mar 15, 2017, 4:45:39 PM3/15/17
to Zipline Python Opensource Backtester
I'm trying to run a zipline backtest using minute data from a csv. On the data.history request it's throwing an error:

 File "C:\Users\Andy\Anaconda2\lib\site-packages\zipline\assets\assets.py", line 391, in lookup_asset_types
    self.asset_router.c.sid.in_(map(int, assets))
ValueError: invalid literal for int() with base 10: 'D'


I'm using the following to request the data:

context.rawMinHistory = data.history(context.ticker, ['close', 'open', 'high', 'low'], 160, '1m')


I've set a conditition where it can't request the history unless it's iterated through handle_data 170 times to avoid and problems with the data request being outside the available history data available from the csv. I've also got the

Has anybody had any luck using minute data at all? If so I'd love to heard your solution. I've currently got a few years worth of minute data for USD/JPY (2010-2016) and would like to backtest on it.

Aside from initialize() and handle_data() this is the code that runs it (also not including the imports)


data = OrderedDict()
data['USDJPY'] = pd.read_csv('USDJPY_small2.csv', index_col=0, parse_dates=['Date'])
print data['USDJPY'].head()
type(data['USDJPY'])

panel = pd.Panel(data)
panel.minor_axis = ['Open', 'High', 'Low', 'Close', 'Volume', 'Price']
panel.major_axis = panel.major_axis.tz_localize(pytz.utc)

algo_obj = TradingAlgorithm(initialize=initialize, handle_data=handle_data, data_frequency='minute')

perf_manual = algo_obj.run(panel)
perf_manual.to_csv('output.csv')

Andy Visser

unread,
Mar 18, 2017, 5:43:03 PM3/18/17
to Zipline Python Opensource Backtester
I got the minute data to work, but now zipline is ignoring any data outside of regular market hours. Does anybody know of a way to adjust the trading calendar?
Reply all
Reply to author
Forward
0 new messages