【问题标题】:iPython magic for Zipline cannot find data bundleZipline 的 iPython 魔法无法找到数据包
【发布时间】:2016-10-16 23:27:40
【问题描述】:

我有一个 Python 2.7 脚本,可以在命令提示符下正常运行 Zipline,使用 --bundle=myBundle 加载我使用 extension.py 注册的自定义数据包 myBundle

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

问题:但是,当我尝试使用%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 笔记本时,我们是否必须以不同的方式注册捆绑包?

【问题讨论】:

    标签: python python-2.7 ipython zipline


    【解决方案1】:

    这是 zipline 中的一个已知(现已关闭)错误,另请参阅 https://github.com/quantopian/zipline/issues/1542

    作为一种解决方法,您可以在滑索魔术之前在单元格中加载以下内容:

    import os
    
    from zipline.utils.run_algo import load_extensions
    
    load_extensions(
        default=True,
        extensions=[],
        strict=True,
        environ=os.environ,
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多