iPython magic for Zipline cannot find data bundle

狂风中的少年 提交于 2019-12-10 18:18:18

问题


I have a Python 2.7 script that runs Zipline fine on the command prompt, using --bundle=myBundle to load the custom data bundle myBundle which I have registered using extension.py.

zipline run -f myAlgo.py --bundle=myBundle --start 2016-6-1 --end 2016-7-1 --data-frequency=minute

Problem: However when I try to use the %zipline IPython magic to run the algorithm, the bundle argument --bundle seems to have difficulty finding myBundle.

%zipline --bundle=myBundle--start 2016-6-1 --end 2016-7-1 --data-frequency=minute

Running this will give the error

UnknownBundle: No bundle registered with the name u'myBundle'

Do we have to register the bundle differently when using IPython notebook?


回答1:


It is a known (now closed) bug in zipline, see also https://github.com/quantopian/zipline/issues/1542.

As a workaround you can load the following in the cell before the zipline magic:

import os

from zipline.utils.run_algo import load_extensions

load_extensions(
    default=True,
    extensions=[],
    strict=True,
    environ=os.environ,
)


来源:https://stackoverflow.com/questions/40076616/ipython-magic-for-zipline-cannot-find-data-bundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!