我有一个 Python 2.7 脚本,可以在命令提示符下正常运行 Zipline,使用--bundle=myBundle
加载自定义数据包myBundle
我已经注册使用extension.py
.
zipline run -f myAlgo.py --bundle=myBundle --start 2016-6-1 --end 2016-7-1 --data-frequency=minute
Problem:但是当我尝试使用%zipline
IPython 运行算法的魔法,bundle 参数--bundle
似乎很难找到myBundle
.
%zipline --bundle=myBundle--start 2016-6-1 --end 2016-7-1 --data-frequency=minute
运行这个会报错
UnknownBundle: No bundle registered with the name u'myBundle'
使用 IPython Notebook 时,我们是否必须以不同的方式注册捆绑包?
这是 zipline 中的一个已知(现已关闭)错误,另请参阅https://github.com/quantopian/zipline/issues/1542 https://github.com/quantopian/zipline/issues/1542.
作为解决方法,您可以在 zipline magic 之前在单元格中加载以下内容:
import os
from zipline.utils.run_algo import load_extensions
load_extensions(
default=True,
extensions=[],
strict=True,
environ=os.environ,
)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)