iPython magic for Zipline找不到数据绑定

2024-09-29 23:29:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个python2.7脚本,它在命令提示符下运行Zipline fine,使用--bundle=myBundle来加载我用extension.py注册的自定义数据包myBundle。在

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

问题:然而,当我尝试使用%ziplineIPython魔术来运行算法时,bundle参数--bundle似乎很难找到myBundle。在

^{pr2}$

运行此操作将显示错误

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

在使用IPython笔记本时,我们是否必须以不同的方式注册捆绑包?在


Tags: runpy脚本dataextensionzipline数据包start
1条回答
网友
1楼 · 发布于 2024-09-29 23:29:31

这是zipline中已知的(现已关闭)bug,另请参见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,
)

相关问题 更多 >

    热门问题