Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ingest 报错问题 #25

Open
wqwangchn opened this issue Jul 10, 2018 · 2 comments
Open

ingest 报错问题 #25

wqwangchn opened this issue Jul 10, 2018 · 2 comments

Comments

@wqwangchn
Copy link

当ingest 数据时提示sid错误,具体描述如下:

  • Operating System: mac osx
  • Python Version: python 3.5

(zipline_chn_py3.5) bogon:zipline administrator$ zipline ingest -b tdx --minute False --start 20170601
Merging daily equity files: [####################################] 100% 600680 [2017-07-10 05:31:36.981322] WARNING: engine: no k line data for 601869
[2017-07-10 05:31:36.995383] WARNING: engine: no k line data for 603713
Merging daily equity files: [####################################] 100%
/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/data/us_equity_pricing.py:958: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
if not issubdtype(actual, expected):
[2017-07-10 05:33:29.916303] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2017-07-21T00:00:00.000000000'), 'sid': 1, 'amount': 0.15800000429153443}
[2017-07-10 05:33:29.916535] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2017-08-29T00:00:00.000000000'), 'sid': 2, 'amount': 0.7900000095367432}
[2017-07-10 05:33:29.916940] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-22T00:00:00.000000000'), 'sid': 6, 'amount': 0.1809999942779541}
[2017-07-10 05:33:29.917154] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-07T00:00:00.000000000'), 'sid': 8, 'amount': 0.05}
[2017-07-10 05:33:29.917301] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2017-08-16T00:00:00.000000000'), 'sid': 9, 'amount': 0.020000000298023225}
[2017-07-10 05:33:29.917461] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-29T00:00:00.000000000'), 'sid': 11, 'amount': 0.3}
[2017-07-10 05:33:29.917619] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2017-07-19T00:00:00.000000000'), 'sid': 12, 'amount': 0.1}
[2017-07-10 05:33:29.917783] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-27T00:00:00.000000000'), 'sid': 12, 'amount': 0.05}
[2017-07-10 05:33:29.917957] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-22T00:00:00.000000000'), 'sid': 14, 'amount': 0.010000000149011612}
[2017-07-10 05:33:29.918090] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-06T00:00:00.000000000'), 'sid': 16, 'amount': 0.16200000047683716}
[2017-07-10 05:33:29.918221] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2017-07-14T00:00:00.000000000'), 'sid': 18, 'amount': 0.06000000238418579}
[2017-07-10 05:33:29.918403] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-28T00:00:00.000000000'), 'sid': 21, 'amount': 0.05}
[2017-07-10 05:33:29.918534] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2017-08-01T00:00:00.000000000'), 'sid': 22, 'amount': 0.4960000038146973}
[2017-07-10 05:33:29.918662] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-05-23T00:00:00.000000000'), 'sid': 22, 'amount': 1.31899995803833}
[2017-07-10 05:33:29.918795] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2017-08-15T00:00:00.000000000'), 'sid': 23, 'amount': 0.04000000059604645}
[2017-07-10 05:33:29.918976] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-22T00:00:00.000000000'), 'sid': 27, 'amount': 0.0800000011920929}
[2017-07-10 05:33:29.919131] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-06-13T00:00:00.000000000'), 'sid': 28, 'amount': 0.3}
[2017-07-10 05:33:29.919308] WARNING: UsEquityPricing: Couldn't compute ratio for dividend {'ex_date': numpy.datetime64('2018-07-10T00:00:00.000000000'), 'sid': 31, 'amount': 0.0550000011920929}
Traceback (most recent call last):
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/bin/zipline", line 11, in
sys.exit(main())
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/main.py", line 440, in ingest
writer=writer
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/data/bundles/core.py", line 503, in ingest
pth.data_path([name, timestr], environ=environ),
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/data/bundles/tdx_bundle.py", line 326, in tdx_bundle
shares=shares
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/data/us_equity_pricing.py", line 1239, in write
self.write_dividend_data(dividends, stock_dividends)
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/data/us_equity_pricing.py", line 1149, in write_dividend_data
dividend_ratios = self.calc_dividend_ratios(dividends)
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/data/us_equity_pricing.py", line 1072, in calc_dividend_ratios
sid, prev_close_date, 'close')
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/data/us_equity_pricing.py", line 766, in get_value
ix = self.sid_day_index(sid, dt)
File "/Users/administrator/Application/anaconda3/envs/zipline_chn_py3.5/lib/python3.5/site-packages/zipline/data/us_equity_pricing.py", line 734, in sid_day_index
offset = day_loc - self._calendar_offsets[sid]
KeyError: 34

@JaysonAlbert
Copy link
Owner

这个错误原因是000034这只股票没有股票数据,具体可能是网络错误、股票停牌、股票未上市等原因导致的,具体要查一下。群文件里有个ingest成功的文件可以下载一下,解压到相应目录试一试。
0 32l 2m18snkw13 n 913

@jingmouren
Copy link

已经退市没数据的股票应该能做出判断,用0价格填入,再导入bundle,不然bundle里的都是幸存股,就出现幸存者偏差了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants