waditu / tushare

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

获取龙虎榜数据出错 #131

Closed kernel8liang closed 8 years ago

kernel8liang commented 8 years ago

ts.top_list('2015-05-22') raise IOError(ct.NETWORK_URL_ERROR_MSG)

这个接口时而能用,时而不能用。

jimmysoa commented 8 years ago

tushare什么版本?

kernel8liang commented 8 years ago

0.5.0 我在每次获取以后加了一个5秒的睡眠,就可以用了。

984958198 commented 8 years ago

目前仍然有出错的情况 version = '0.5.0' Traceback (most recent call last): File "C:/Users/sa/Desktop/tushare-master/test_unittest.py", line 43, in <module> td = ts.top_list() File "C:\Users\sa\Desktop\tushare-master\tushare\stock\billboard.py", line 93, in top_list raise IOError(ct.NETWORK_URL_ERROR_MSG) IOError: 获取失败,请检查网络和URL

原因: 原网页http://data.eastmoney.com/DataCenter_V3/stock2016/TradeDetail/pagesize=200,page=1,sortRule=-1,sortType=,startDate=2016-09-07,endDate=2016-09-07,gpfw=0,js=vardata_tab_1.html 会出现为空数据 "Smoney":"" 而代码里会将它转换为float 解决办法: tushare\stock\billboard.py 第75行添加 df['sell'] = [s if s else 0 for s in df['sell']] 将不标准数据默认为0

jimmysoa commented 8 years ago

@984958198 直接提交pull request吧