【发布时间】:2016-12-10 20:19:42
【问题描述】:
我正在通过将以下内容添加到 $ZIPLINE_ROOT 目录中的 extenstion.py 来创建一个自定义的基本 yahoo 包:
equities = {
'AAPL',
'QQQ',
}
register(
'test-bundle', # name this whatever you like
yahoo_equities(equities),
)
当我运行捆绑包时,一切都很好。
zipline ingest -b test-bundle
zipline bundles
产生输出(我刚刚运行它一秒钟)
test-bundle 2016-12-10 20:13:11.014192
很好,一切都按预期进行。
当我使用一些基本策略运行 zipline 2 周时:
zipline run -f ./test_algo.py --start 2016-12-01 --end 2016-12-9 -o output.pickle --bundle test-bundle
它运行,直到它到达星期四 (12/08/2016) 日期:
Traceback (most recent call last):
File "/usr/local/lib64/python3.5/site-packages/pandas/core/indexing.py", line 1325, in _has_valid_type error()
File "/usr/local/lib64/python3.5/site-packages/pandas/core/indexing.py", line 1320, in error (key, self.obj._get_axis_name(axis)))
KeyError: 'the label [2016-12-08 00:00:00+00:00] is not in the [index]'
During handling of the above exception, another exception occurred:
.... zipline stack trace
但如果我运行它:
zipline run -f ./test_algo.py --start 2016-12-01 --end 2016-12-7 -o output.pickle --bundle test-bundle
然后我得到预期的成功输出:
[2016-12-10 20:17:11.519059] INFO: Performance: Simulated 5 trading days out of 5.
[2016-12-10 20:17:11.519495] INFO: Performance: first open: 2016-12-01 14:31:00+00:00
[2016-12-10 20:17:11.519770] INFO: Performance: last close: 2016-12-07 21:00:00+00:00
知道为什么我的包会下载到 T-2 数据。我希望看到 12/8 和 12/9 的数据,市场在正常日子开放,我在 yahoo Finance 中看到了那些日子的数据。
谢谢-
【问题讨论】:
标签: python python-3.5 quantitative-finance zipline