waditu / tushare

TuShare is a utility for crawling historical data of China stocks
BSD 3-Clause "New" or "Revised" License
12.79k stars 4.28k forks source link

ts.bar()取A股后复权数据随机挂死 #543

Open lushengsheng opened 6 years ago

lushengsheng commented 6 years ago

ts.bar()取A股后复权数据会随机挂死,函数一直不返回也不报错

重现方法: 连续调用ts.bar(code,conn=cc,adj=‘hfq’,factors=['vr', 'tor'])取所有A股个股,过几分钟便会重现。退出重新程序,刚才引起挂死的个股数据又可以拿到并继续往下跑,直到出现同样问题

补充: 不清楚是否除A股后复权数据之外也有同样问题。粗略看了代码,挂死期间heartbeat一直有来往,zipsize一直是2

lushengsheng commented 6 years ago

A股不复权数据也重现了,应该是普遍问题

jimmysoa commented 6 years ago

一个conn取300个股票,可以多申请几个conn,分开用

arstum commented 6 years ago

新接口不稳定,不一定300个,有时更多,有时更少。是共享接口吗? 而且翻墙会稳定些,但还是会出现。

shiquanwang commented 6 years ago

我用bar查询600665的日线,一定会报错。

In [9]: ll = ts.bar('600665', conn=cons, freq='D', adj='qfq', asset='E', start_date='2017-01-01', end_date='2017-12-31')
month must be in 1..12
month must be in 1..12
month must be in 1..12
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-9-b62999e8a311> in <module>()
----> 1 ll = ts.bar('600665', conn=cons, freq='D', adj='qfq', asset='E', start_date='2017-01-01', end_date='2017-12-31')

~/miniconda3/envs/cornerstone_py36/lib/python3.6/site-packages/tushare/stock/trading.py in bar(code, conn, start_date, end_date, freq, asset, market, adj, ma, factors, retry_count)
   1028         else:
   1029             return data
-> 1030     raise IOError(ct.NETWORK_URL_ERROR_MSG)
   1031 
   1032 
bjmwang commented 6 years ago

不能重现上面的错误,但取不回数据,如下:

In [15]: ll = ts.bar('600665', conn=ts.get_apis(), freq='D', adj='qfq', asset='E', start_date='2017-01-01', end_date='2017-12-31')

In [16]: type(ll)
Out[16]: NoneType

In [18]: ts.__version__
Out[18]: '1.2.11'