2016-11-24
实际策略中经常需要过滤掉一些出现暂停上市,退市,被立案等风险较大的股票。人工跟踪略显累啊。
然后写了一个小爬虫,通过抓取东方财富网的公司公告,通过检测风险提示的公告的标题来判断是否将该股票添加到黑名单。
这样时不时运行一下应该OK了。不知道大家有没有更好更方便的办法。
Python用得不是很熟,正则不太会用,大家将就看吧。
-2016-11-25回测测试-
抓取代码更新,返回的列表带抓取的日期。
设定固定黑名单,在回测中使用,就是一种未来函数,这个大家都知道。
为了避免这个未来函数,又想看看黑名单在策略中的作用。。。。
那就用按日期更新黑名单的方式,把它从未来拉回现实吧
回测测试:
策略用的是 论坛里很火爆的 二八轮动小市值优化版2.0.6 改过的。
1.初始黑名单为空
2.初始日期为昨天。(实际上因策略问题,虽然回测从1.1开始,但到2月多才第一次抓取,所以实际第一次抓了1个多月的黑名单)
3.保存每个股票被公告为风险股票时的日期,在后续继续公告,会更新时间。
4.每个股票有效时间为60天,即60天没有再次被公告风险,从黑名单中删除。
5.调仓前抓取黑名单
实测结果,在其它参数条件都一样的情况下,用不用动态抓取黑名单的结果,基本没啥差别!!
应了那句话,虽然看起来很厉害,然并卵!!!
再次更新:
考虑到是否是金额太小,选股数太少,导致黑名单功能没有发挥出来,继续改,改成动态的持股数,平均20W一只股。再跑。。
结果依然是然并卵!!!!!
小市值策略收益,回撤,基本上和这个黑名单,关系不大。
量化不相信猜测,只相信数据!
为了避免这个方法占用大量平台带宽。。我就不帖策略里的实现代码了,有心测试其它策略的人,我发的研究的代码改改就行了。
PS:慎用啊,哪天因访问太多,东方财富网把平台IP封了就哭了。
import urllib2import reimport time,datetime# 论坛里得到的黑名单def get_blacklist():# 黑名单一览表,更新时间 2016.7.10 by 沙米# 科恒股份、太空板业,一旦2016年继续亏损,直接面临暂停上市风险blacklist = ["600656.XSHG","300372.XSHE","600403.XSHG","600421.XSHG","600733.XSHG","300399.XSHE", "600145.XSHG","002679.XSHE","000020.XSHE","002330.XSHE","300117.XSHE","300135.XSHE", "002566.XSHE","002119.XSHE","300208.XSHE","002237.XSHE","002608.XSHE","000691.XSHE", "002694.XSHE","002715.XSHE","002211.XSHE","000788.XSHE","300380.XSHE","300028.XSHE", "000668.XSHE","300033.XSHE","300126.XSHE","300340.XSHE","300344.XSHE","002473.XSHE"]return blacklist'''抓取发布过暂停上市风险提示公告的股票,以添加到黑名单-'''# 抓取两个日期之间公告的黑名单 def get_days_black_list(sdate,edate,old_black_list = []):day_count = (edate-sdate).daysnew_black_list = old_black_listfor i in range(0,day_count):#print "正在抓取 %s 的数据"%(sdate.strftime('%Y-%m-%d'))tmp_list = get_day_black_list(sdate)new_black_list = [x for x in new_black_list if x[0] not in [y[0] for y in tmp_list]]new_black_list = new_black_list + tmp_listsdate += datetime.timedelta(1)return new_black_list # 抓取指定日期的黑名单def get_day_black_list(view_date):page = 1new_black_list,max_page = get_page_black_list(page,view_date)for i in range(2,max_page+1):tmp_list,m = get_page_black_list(i,view_date)# 从new_black_list中删除掉 tmp_list出现的Stock。以tmp_list更新的日期为准,相当于去重复new_black_list = [x for x in new_black_list if x[0] not in [y[0] for y in tmp_list]]new_black_list = new_black_list + tmp_listif len(new_black_list) > 0:print '%s 发现风险股票:'%(view_date)+ ' '.join([x[0] for x in new_black_list])return new_black_list# 抓取指定页,指定日期的黑名单def get_page_black_list(page,view_date):#print "抓取 %s 的第 %d 页"%(view_date,page)# 直接访问该日期的 风险提示页url = 'http://data.eastmoney.com/Notice/noticelist.aspx?type=4&market=all&page=%d&date=%s'for i in range(0,3):try:response = urllib2.urlopen(url%(page,view_date.strftime('%Y-%m-%d')))html = response.read().decode("gbk").strip()breakexcept:html = ''if html == '':return [],0# response = urllib2.urlopen(url%(page,view_date.strftime('%Y-%m-%d')))# html = response.read().decode("gbk").strip()dr = re.compile(r'<[^>]+>',re.S) #去除html标签#从网页中解析出到底该日期有多少页公告 呃,正则不太会用,土办法解决pages = html[html.find('<span class="at">1</span>'):html.find('<span class="txt">')]pages = [x.strip() for x in dr.sub('|',pages).strip().split('|')]pages = [x for x in pages if x.isdigit()]if(len(pages)>0):max_page = int(pages[-1])else:max_page = 0# 先去除多余的内容,只保留公告的table,依旧土办法解决# 获取table定义之后的字符串html = html[html.find('<table class="tableCont" id="dt">'):]# 获取 表格正文 开始之后的字符串html = html[html.find('<tbody>')+len('<tbody>'):]# 获取表格结束之前的字符串html = html[:html.find('</tbody>')]#print html# 进行一些预处理,好方便后面分割成listhtml = html.replace('<tr>','<tr class="odd">')html = html.replace('<td class="title">','<td>')# 分割每行sl = list(html.split('<tr class="odd">'))sl = sl[1:] #分割后第一行为空字符串,去掉# 再次分割为二维listsl = [list(x.split('<td>')) for x in sl]# 去除HTML标签sl = [[dr.sub('',y) for y in x] for x in sl]# 风险提示公告中出以下字样的,将被认为是黑名单,不完善。filter_strs = ['暂停上市','终止上市','立案进展暨','退市风险','立案调查']tmp_list = [x[1].strip() for x in sl if (len(x) > 4) and len([y for y in filter_strs if x[4].find(y) >= 0]) > 0]# 为股票代码添加沪深标识new_black_list=[x.encode("gbk")+'.XSHG' for x in tmp_list if x.startswith('60')]new_black_list+=[x.encode("gbk")+'.XSHE' for x in tmp_list if x.startswith('00') or x.startswith('30')]new_black_list = list(set(new_black_list))#添加扫描到该风险股票的公告日期new_black_list = [[x,view_date] for x in new_black_list]#print new_black_listreturn new_black_list,max_page'''抓取股票公告,以发现暂停上市风险是否被撤销-'''# 抓取指定股票的公告 返回二维list 第一列为 公告标题,第二列为 公告类型,第三列为 日期def get_stock_announcement(stock):stock = stock[:6]try:response = urllib2.urlopen("http://data.eastmoney.com/notice/%s.html"%(stock))except: return []html = response.read().decode("gbk").strip()html = html[html.find('<div class="cont">'):]html = html[:html.find('</ul>')]sl = html.split('<li>')sl = [x.split('</span>') for x in sl]sl = sl[1:]dr = re.compile(r'<[^>]+>',re.S) #去除html标签sl = [[dr.sub('',y) for y in x][0:-1] for x in sl] return sl# 判断stock是否被解除了黑名单,好像不太好用,找不出来。放弃def stock_is_lifting_of_blacklist(stock):sl = get_stock_announcement(stock)#包含以下字符串将认为已解除风险,不完善。filter_strs = ['撤销风险警示','撤销股票退市风险警示','暂停上市风险已解除','解除暂停上市']tmp_list = [x[0].strip() for x in sl if (len(x) > 1) and len([y for y in filter_strs if x[0].find(y) >= 0]) > 0]return len(tmp_list) > 0 '''获取新黑名单-'''edate = datetime.date.today()sdate = edate - datetime.timedelta(20) # 测试获取最近N天公告的股票黑名单new_black_list = get_days_black_list(sdate,edate)print "抓取 %s 到 %s 被公告有风险的股票:"%(sdate.strftime('%Y-%m-%d'),edate.strftime('%Y-%m-%d'))print new_black_list# 判断黑名单中,哪些被解除风险了#repeal_list = [x for x in new_black_list if stock_is_lifting_of_blacklist(x)]#print "已解除风险的股票"#print ["['%s','%s']"%(x[0],x[1].strftime('%Y-%m-%d')) for x in repeal_list]#new_black_list = [x for x in new_black_list if x[0] not in [y[0] for y in repeal_list]]print "新的黑名单"print ["['%s','%s']"%(x[0],x[1].strftime('%Y-%m-%d')) for x in new_black_list]print "使用纯Stock列表"print [x[0] for x in new_black_list]
2016-11-28 发现风险股票:300117.XSHE 2016-11-29 发现风险股票:000526.XSHE 300344.XSHE 2016-11-30 发现风险股票:300135.XSHE 2016-12-02 发现风险股票:002207.XSHE 300208.XSHE 2016-12-03 发现风险股票:300340.XSHE 300028.XSHE 2016-12-05 发现风险股票:300372.XSHE 2016-12-06 发现风险股票:000033.XSHE 300344.XSHE 2016-12-09 发现风险股票:002667.XSHE 2016-12-10 发现风险股票:300340.XSHE 300028.XSHE 000511.XSHE 2016-12-13 发现风险股票:300344.XSHE 2016-12-14 发现风险股票:000788.XSHE 000670.XSHE 600649.XSHG 300311.XSHE 2016-12-16 发现风险股票:600301.XSHG 2016-12-17 发现风险股票:300340.XSHE 抓取 2016-11-28 到 2016-12-18 被公告有风险的股票: [['300117.XSHE', datetime.date(2016, 11, 28)], ['000526.XSHE', datetime.date(2016, 11, 29)], ['300135.XSHE', datetime.date(2016, 11, 30)], ['002207.XSHE', datetime.date(2016, 12, 2)], ['300208.XSHE', datetime.date(2016, 12, 2)], ['300372.XSHE', datetime.date(2016, 12, 5)], ['000033.XSHE', datetime.date(2016, 12, 6)], ['002667.XSHE', datetime.date(2016, 12, 9)], ['300028.XSHE', datetime.date(2016, 12, 10)], ['000511.XSHE', datetime.date(2016, 12, 10)], ['300344.XSHE', datetime.date(2016, 12, 13)], ['000788.XSHE', datetime.date(2016, 12, 14)], ['000670.XSHE', datetime.date(2016, 12, 14)], ['600649.XSHG', datetime.date(2016, 12, 14)], ['300311.XSHE', datetime.date(2016, 12, 14)], ['600301.XSHG', datetime.date(2016, 12, 16)], ['300340.XSHE', datetime.date(2016, 12, 17)]] 新的黑名单 ["['300117.XSHE','2016-11-28']", "['000526.XSHE','2016-11-29']", "['300135.XSHE','2016-11-30']", "['002207.XSHE','2016-12-02']", "['300208.XSHE','2016-12-02']", "['300372.XSHE','2016-12-05']", "['000033.XSHE','2016-12-06']", "['002667.XSHE','2016-12-09']", "['300028.XSHE','2016-12-10']", "['000511.XSHE','2016-12-10']", "['300344.XSHE','2016-12-13']", "['000788.XSHE','2016-12-14']", "['000670.XSHE','2016-12-14']", "['600649.XSHG','2016-12-14']", "['300311.XSHE','2016-12-14']", "['600301.XSHG','2016-12-16']", "['300340.XSHE','2016-12-17']"] 使用纯Stock列表 ['300117.XSHE', '000526.XSHE', '300135.XSHE', '002207.XSHE', '300208.XSHE', '300372.XSHE', '000033.XSHE', '002667.XSHE', '300028.XSHE', '000511.XSHE', '300344.XSHE', '000788.XSHE', '000670.XSHE', '600649.XSHG', '300311.XSHE', '600301.XSHG', '300340.XSHE']
import urllib2import reimport time,datetime'''抓取限制股解禁-'''# 从东方财富网的 限售解禁 网页 http://data.eastmoney.com/dxf/default.html 抓取解禁股数据。# 测试可抓取未来日期的解禁数据,比如 2017年 2018年。# 返回一个以code为key的dict,code属性为各值的dictdef get_ban_shares_by_time(year,month):url = 'http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=FD&sty=BST&st=3&sr=true&fd=%d&stat=%d&js=LoadDataResult([(x)])'html=''for i in range(0,3):try:response = urllib2.urlopen(url%(year,month))html = response.read()breakexcept:html = ''if html == '':return {}html = html[18:-3]sl = list(html.split('","'))# print sl#ban_shares = {}for x in sl:csl = list(x.split(','))''' 0 : 10000594 不知道干啥的 1 : 000005 股票代码 2 : 2 3 : 世纪星源 名称 4 : 2016-12-31 日期 5 : 37479453.00 数量 6 : 0.03541 总股本比例 7 : 6.93 最新收盘价 8 : 259732609.29 市值 '''try:# 这个有时候没有数据,直接转换会报错,先尝试转化market_cap = float(csl[8])except:market_cap = 0td = {"name" : csl[2] # 名称 , "date" : datetime.datetime.strptime(csl[4], "%Y-%m-%d") # 解禁日期 , "count" : float(csl[5]) # 解禁股数 , "capital_ratio" : float(csl[6]) # 解禁股数占总股本比例 ,'price':csl[7] # 最新收盘价,注:是否有实时更新不清楚,慎用 ,'market_cap':market_cap} # 当前市值ban_shares[normalize_code(csl[1])] = tdreturn ban_shares# 测试抓取限售解禁名单year = 2016month = 12ban_shares = get_ban_shares_by_time(year,month)print '%d-%d月解禁股票名单: '%(year,month)print ban_shares.keys()print '详情:'print ban_shares
2016-12月解禁股票名单: ['002368.XSHE', '600057.XSHG', '002137.XSHE', '300451.XSHE', '603306.XSHG', '002596.XSHE', '600380.XSHG', '000908.XSHE', '300067.XSHE', '000971.XSHE', '300084.XSHE', '002719.XSHE', '600023.XSHG', '002460.XSHE', '300490.XSHE', '002052.XSHE', '300353.XSHE', '601608.XSHG', '601226.XSHG', '002680.XSHE', '300497.XSHE', '300059.XSHE', '002509.XSHE', '603166.XSHG', '300263.XSHE', '002279.XSHE', '002562.XSHE', '002442.XSHE', '300339.XSHE', '300048.XSHE', '000915.XSHE', '002467.XSHE', '603002.XSHG', '600076.XSHG', '000156.XSHE', '300493.XSHE', '600406.XSHG', '000685.XSHE', '002171.XSHE', '300145.XSHE', '002738.XSHE', '600797.XSHG', '603696.XSHG', '600679.XSHG', '600552.XSHG', '002645.XSHE', '600758.XSHG', '002261.XSHE', '002270.XSHE', '600965.XSHG', '300491.XSHE', '600200.XSHG', '000555.XSHE', '000426.XSHE', '603299.XSHG', '000989.XSHE', '300204.XSHE', '300136.XSHE', '000718.XSHE', '002472.XSHE', '002475.XSHE', '002196.XSHE', '002027.XSHE', '603999.XSHG', '600162.XSHG', '000413.XSHE', '600617.XSHG', '002786.XSHE', '000005.XSHE', '603936.XSHG', '600731.XSHG', '002780.XSHE', '002787.XSHE', '300256.XSHE', '002252.XSHE', '002036.XSHE', '600536.XSHG', '002548.XSHE', '002554.XSHE', '601677.XSHG', '000917.XSHE', '600396.XSHG', '600366.XSHG', '002047.XSHE', '600313.XSHG', '603456.XSHG', '002354.XSHE', '600823.XSHG', '000582.XSHE', '600705.XSHG', '000656.XSHE', '600729.XSHG', '002785.XSHE', '600196.XSHG', '300334.XSHE', '600074.XSHG', '002373.XSHE', '002009.XSHE', '002555.XSHE', '002004.XSHE', '600645.XSHG', '002059.XSHE', '601155.XSHG', '300242.XSHE', '300496.XSHE', '300106.XSHE', '002421.XSHE', '002783.XSHE', '600522.XSHG', '300144.XSHE', '600466.XSHG', '300390.XSHE', '300420.XSHE', '600693.XSHG', '603800.XSHG', '002168.XSHE', '002170.XSHE', '002129.XSHE', '600236.XSHG', '600623.XSHG', '603778.XSHG', '002520.XSHE', '002174.XSHE', '603958.XSHG', '600970.XSHG', '300303.XSHE', '000636.XSHE', '603866.XSHG', '603996.XSHG', '300389.XSHE', '300038.XSHE', '002551.XSHE', '600590.XSHG', '300053.XSHE', '300182.XSHE', '300103.XSHE', '300467.XSHE', '600225.XSHG', '600190.XSHG', '601599.XSHG', '300410.XSHE', '300125.XSHE', '601968.XSHG', '002779.XSHE', '000999.XSHE', '300027.XSHE', '002454.XSHE', '002777.XSHE', '603979.XSHG', '300083.XSHE', '300051.XSHE', '603009.XSHG', '300422.XSHE', '300366.XSHE', '002781.XSHE', '300355.XSHE', '000513.XSHE', '000875.XSHE', '600566.XSHG', '300009.XSHE', '300439.XSHE', '002733.XSHE', '300018.XSHE', '300026.XSHE', '002121.XSHE', '603567.XSHG', '002446.XSHE', '002348.XSHE', '002624.XSHE', '300315.XSHE', '002512.XSHE', '300248.XSHE', '300398.XSHE', '000587.XSHE', '000973.XSHE', '300404.XSHE', '603118.XSHG', '002225.XSHE', '300494.XSHE', '300022.XSHE', '300159.XSHE', '300495.XSHE', '600579.XSHG', '300409.XSHE', '002085.XSHE', '600677.XSHG', '601016.XSHG', '300032.XSHE', '002131.XSHE', '600703.XSHG', '300231.XSHE', '601992.XSHG', '603508.XSHG', '002642.XSHE', '600634.XSHG', '002253.XSHE', '300040.XSHE', '002361.XSHE', '000605.XSHE', '300247.XSHE', '300425.XSHE', '002017.XSHE', '002631.XSHE', '002146.XSHE', '000792.XSHE', '002327.XSHE', '300492.XSHE'] 详情: {'002368.XSHE': {'count': 38765120.0, 'market_cap': 1230404908.8, 'name': '2', 'price': '31.74', 'date': datetime.datetime(2016, 12, 27, 0, 0), 'capital_ratio': 0.09328}, '600057.XSHG': {'count': 121076232.0, 'market_cap': 1472286981.12, 'name': '1', 'price': '12.16', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.10342}, '002137.XSHE': {'count': 45531086.0, 'market_cap': 618312147.88, 'name': '2', 'price': '13.58', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.07899}, '300451.XSHE': {'count': 1543116.0, 'market_cap': 51790355.84, 'name': '2', 'price': '35.71', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.00731}, '603306.XSHG': {'count': 1560000.0, 'market_cap': 53118000.0, 'name': '1', 'price': '34.05', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.00729}, '002596.XSHE': {'count': 12431626.0, 'market_cap': 334535055.66, 'name': '2', 'price': '26.91', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.03821}, '600380.XSHG': {'count': 1180000.0, 'market_cap': 12071400.0, 'name': '1', 'price': '10.23', 'date': datetime.datetime(2016, 12, 21, 0, 0), 'capital_ratio': 0.00074}, '000908.XSHE': {'count': 38643000.0, 'market_cap': 412320810.0, 'name': '2', 'price': '10.67', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.04392}, '300067.XSHE': {'count': 720000.0, 'market_cap': 5925600.0, 'name': '2', 'price': '8.23', 'date': datetime.datetime(2016, 12, 13, 0, 0), 'capital_ratio': 0.00133}, '000971.XSHE': {'count': 1029000.0, 'market_cap': 24335850.0, 'name': '2', 'price': '23.65', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.00201}, '300084.XSHE': {'count': 9825563.0, 'market_cap': 3239758.08, 'name': '2', 'price': '11.52', 'date': datetime.datetime(2016, 12, 2, 0, 0), 'capital_ratio': 0.02554}, '002719.XSHE': {'count': 72500.0, 'market_cap': 3853375.0, 'name': '2', 'price': '53.15', 'date': datetime.datetime(2016, 12, 21, 0, 0), 'capital_ratio': 0.00067}, '600023.XSHG': {'count': 10613090267.0, 'market_cap': 57098425636.46, 'name': '1', 'price': '5.38', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.78033}, '002460.XSHE': {'count': 8163268.0, 'market_cap': 233142934.08, 'name': '2', 'price': '28.56', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.01085}, '300490.XSHE': {'count': 42836958.0, 'market_cap': 1070923950.0, 'name': '2', 'price': '25.00', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.21418}, '002052.XSHE': {'count': 63000000.0, 'market_cap': 876330000.0, 'name': '2', 'price': '13.91', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.08445}, '300353.XSHE': {'count': 19727384.0, 'market_cap': 313665405.6, 'name': '2', 'price': '15.90', 'date': datetime.datetime(2016, 12, 1, 0, 0), 'capital_ratio': 0.03816}, '601608.XSHG': {'count': 16992692.0, 'market_cap': 89891340.68, 'name': '1', 'price': '5.29', 'date': datetime.datetime(2016, 12, 15, 0, 0), 'capital_ratio': 0.00392}, '601226.XSHG': {'count': 37500000.0, 'market_cap': 326250000.0, 'name': '1', 'price': '8.70', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.03247}, '002680.XSHE': {'count': 27200000.0, 'market_cap': 477360000.0, 'name': '2', 'price': '17.55', 'date': datetime.datetime(2016, 12, 23, 0, 0), 'capital_ratio': 0.02806}, '300497.XSHE': {'count': 36171000.0, 'market_cap': 2268645120.0, 'name': '2', 'price': '62.72', 'date': datetime.datetime(2016, 12, 22, 0, 0), 'capital_ratio': 0.32285}, '300059.XSHE': {'count': 277894635.0, 'market_cap': 5102145480.24, 'name': '2', 'price': '18.36', 'date': datetime.datetime(2016, 12, 28, 0, 0), 'capital_ratio': 0.0781}, '002509.XSHE': {'count': 190435556.0, 'market_cap': 2414722862.76, 'name': '2', 'price': '12.68', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.12225}, '603166.XSHG': {'count': 71818711.0, 'market_cap': 1366710070.33, 'name': '1', 'price': '19.03', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.12131}, '300263.XSHE': {'count': 27017812.0, 'market_cap': 0, 'name': '2', 'price': '7.32', 'date': datetime.datetime(2016, 12, 6, 0, 0), 'capital_ratio': 0.03063}, '002279.XSHE': {'count': 18669569.0, 'market_cap': 259161179.13, 'name': '2', 'price': '17.01', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.03448}, '002562.XSHE': {'count': 102893884.0, 'market_cap': 1337620492.0, 'name': '2', 'price': '13.00', 'date': datetime.datetime(2016, 12, 2, 0, 0), 'capital_ratio': 0.19035}, '002442.XSHE': {'count': 72629372.0, 'market_cap': 1008821977.08, 'name': '2', 'price': '13.89', 'date': datetime.datetime(2016, 12, 2, 0, 0), 'capital_ratio': 0.15131}, '300339.XSHE': {'count': 3123000.0, 'market_cap': 94095990.0, 'name': '2', 'price': '30.13', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.00873}, '300048.XSHE': {'count': 49655172.0, 'market_cap': 417103444.8, 'name': '2', 'price': '8.40', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.06307}, '000915.XSHE': {'count': 187000.0, 'market_cap': 8261660.0, 'name': '2', 'price': '44.18', 'date': datetime.datetime(2016, 12, 8, 0, 0), 'capital_ratio': 0.00104}, '002467.XSHE': {'count': 61635220.0, 'market_cap': 672440250.2, 'name': '2', 'price': '10.91', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.07734}, '603002.XSHG': {'count': 5584680.0, 'market_cap': 27732326.4, 'name': '1', 'price': '6.48', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.0091}, '600076.XSHG': {'count': 110987791.0, 'market_cap': 1102108764.63, 'name': '1', 'price': '9.93', 'date': datetime.datetime(2016, 12, 7, 0, 0), 'capital_ratio': 0.10731}, '000156.XSHE': {'count': 4137931.0, 'market_cap': 77006895.91, 'name': '2', 'price': '18.61', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.00289}, '300493.XSHE': {'count': 31806000.0, 'market_cap': 1577577600.0, 'name': '2', 'price': '49.60', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.26505}, '600406.XSHG': {'count': 223199749.0, 'market_cap': 3631459916.23, 'name': '1', 'price': '16.27', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.09189}, '000685.XSHE': {'count': 73481564.0, 'market_cap': 793600891.2, 'name': '2', 'price': '10.80', 'date': datetime.datetime(2016, 12, 13, 0, 0), 'capital_ratio': 0.04981}, '002171.XSHE': {'count': 18054328.0, 'market_cap': 298257498.56, 'name': '2', 'price': '16.52', 'date': datetime.datetime(2016, 12, 23, 0, 0), 'capital_ratio': 0.0406}, '300145.XSHE': {'count': 34581644.0, 'market_cap': 840071802.28, 'name': '2', 'price': '24.46', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.05178}, '002738.XSHE': {'count': 825000.0, 'market_cap': 21928500.0, 'name': '2', 'price': '26.58', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.00429}, '600797.XSHG': {'count': 9035047.0, 'market_cap': 162630846.0, 'name': '1', 'price': '18.00', 'date': datetime.datetime(2016, 12, 28, 0, 0), 'capital_ratio': 0.00988}, '603696.XSHG': {'count': 4500000.0, 'market_cap': 192060000.0, 'name': '1', 'price': '42.68', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.0375}, '600679.XSHG': {'count': 4619890.0, 'market_cap': 202813171.0, 'name': '1', 'price': '43.90', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.01149}, '600552.XSHG': {'count': 11452331.0, 'market_cap': 211066460.33, 'name': '1', 'price': '18.43', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.02986}, '002645.XSHE': {'count': 4905862.0, 'market_cap': 143790815.22, 'name': '2', 'price': '29.31', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.02342}, '600758.XSHG': {'count': 247664478.0, 'market_cap': 2721832613.22, 'name': '1', 'price': '10.99', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.1858}, '002261.XSHE': {'count': 86996472.0, 'market_cap': 1109205018.0, 'name': '2', 'price': '12.75', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.07827}, '002270.XSHE': {'count': 56007257.0, 'market_cap': 832827911.59, 'name': '2', 'price': '14.87', 'date': datetime.datetime(2016, 12, 28, 0, 0), 'capital_ratio': 0.11065}, '600965.XSHG': {'count': 147948545.0, 'market_cap': 2231064058.6, 'name': '1', 'price': '15.08', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.18071}, '300491.XSHE': {'count': 17350828.0, 'market_cap': 1514727284.4, 'name': '2', 'price': '87.30', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.21413}, '600200.XSHG': {'count': 101610762.0, 'market_cap': 1985474289.48, 'name': '1', 'price': '19.54', 'date': datetime.datetime(2016, 12, 28, 0, 0), 'capital_ratio': 0.14076}, '000555.XSHE': {'count': 3209364.0, 'market_cap': 73654903.8, 'name': '2', 'price': '22.95', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.0035}, '000426.XSHE': {'count': 230414746.0, 'market_cap': 2124423958.12, 'name': '2', 'price': '9.22', 'date': datetime.datetime(2016, 12, 26, 0, 0), 'capital_ratio': 0.13304}, '603299.XSHG': {'count': 189300905.0, 'market_cap': 3485029661.05, 'name': '1', 'price': '18.41', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.33838}, '000989.XSHE': {'count': 255150324.0, 'market_cap': 5526556039.5, 'name': '2', 'price': '21.66', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.29349}, '300204.XSHE': {'count': 2046207.0, 'market_cap': 33227144.18, 'name': '2', 'price': '17.74', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.00428}, '300136.XSHE': {'count': 768000.0, 'market_cap': 20697600.0, 'name': '2', 'price': '26.95', 'date': datetime.datetime(2016, 12, 24, 0, 0), 'capital_ratio': 0.0008}, '000718.XSHE': {'count': 378486055.0, 'market_cap': 3572908359.2, 'name': '2', 'price': '9.44', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.12472}, '002472.XSHE': {'count': 1040000.0, 'market_cap': 12188800.0, 'name': '2', 'price': '11.72', 'date': datetime.datetime(2016, 12, 26, 0, 0), 'capital_ratio': 0.00154}, '002475.XSHE': {'count': 4116420.0, 'market_cap': 80476011.0, 'name': '2', 'price': '19.55', 'date': datetime.datetime(2016, 12, 20, 0, 0), 'capital_ratio': 0.00194}, '002196.XSHE': {'count': 18215463.0, 'market_cap': 450286245.36, 'name': '2', 'price': '24.72', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.06868}, '002027.XSHE': {'count': 3036046444.0, 'market_cap': 46846196630.92, 'name': '2', 'price': '15.43', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.3475}, '603999.XSHG': {'count': 43200000.0, 'market_cap': 1424304000.0, 'name': '1', 'price': '32.97', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.15}, '600162.XSHG': {'count': 610465051.0, 'market_cap': 2643313670.83, 'name': '1', 'price': '4.33', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.2173}, '000413.XSHE': {'count': 579178885.0, 'market_cap': 6533137822.8, 'name': '2', 'price': '11.28', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.11724}, '600617.XSHG': {'count': 672932532.0, 'market_cap': 7254212694.96, 'name': '1', 'price': '10.78', 'date': datetime.datetime(2016, 12, 23, 0, 0), 'capital_ratio': 0.62041}, '002786.XSHE': {'count': 42900000.0, 'market_cap': 1048905000.0, 'name': '2', 'price': '24.45', 'date': datetime.datetime(2016, 12, 23, 0, 0), 'capital_ratio': 0.11253}, '000005.XSHE': {'count': 37479453.0, 'market_cap': 259732609.29, 'name': '2', 'price': '6.93', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.03541}, '603936.XSHG': {'count': 14250000.0, 'market_cap': 468540000.0, 'name': '1', 'price': '32.88', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.08515}, '600731.XSHG': {'count': 71000000.0, 'market_cap': 719230000.0, 'name': '1', 'price': '10.13', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.21692}, '002780.XSHE': {'count': 31010400.0, 'market_cap': 1925431639.05, 'name': '2', 'price': '73.95', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.45955}, '002787.XSHE': {'count': 17479293.0, 'market_cap': 821177185.14, 'name': '2', 'price': '46.98', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.12133}, '300256.XSHE': {'count': 77870524.0, 'market_cap': 957807445.2, 'name': '2', 'price': '12.30', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.12173}, '002252.XSHE': {'count': 3751970.0, 'market_cap': 70658175.12, 'name': '2', 'price': '21.36', 'date': datetime.datetime(2016, 12, 20, 0, 0), 'capital_ratio': 0.00076}, '002036.XSHE': {'count': 134262514.0, 'market_cap': 2596637020.76, 'name': '2', 'price': '19.34', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.23065}, '600536.XSHG': {'count': 9850546.0, 'market_cap': 247544220.98, 'name': '1', 'price': '25.13', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.01992}, '002548.XSHE': {'count': 10134634.0, 'market_cap': 147256232.02, 'name': '2', 'price': '14.53', 'date': datetime.datetime(2016, 12, 23, 0, 0), 'capital_ratio': 0.02661}, '002554.XSHE': {'count': 16000000.0, 'market_cap': 132960000.0, 'name': '2', 'price': '8.31', 'date': datetime.datetime(2016, 12, 21, 0, 0), 'capital_ratio': 0.01494}, '601677.XSHG': {'count': 65000000.0, 'market_cap': 943800000.0, 'name': '1', 'price': '14.52', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.12725}, '000917.XSHE': {'count': 40181957.0, 'market_cap': 585852933.06, 'name': '2', 'price': '14.58', 'date': datetime.datetime(2016, 12, 26, 0, 0), 'capital_ratio': 0.02835}, '600396.XSHG': {'count': 295980782.0, 'market_cap': 1521341219.48, 'name': '1', 'price': '5.14', 'date': datetime.datetime(2016, 12, 24, 0, 0), 'capital_ratio': 0.20098}, '600366.XSHG': {'count': 8438227.0, 'market_cap': 169439598.16, 'name': '1', 'price': '20.08', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.01514}, '002047.XSHE': {'count': 473023037.0, 'market_cap': 4602514150.01, 'name': '2', 'price': '9.73', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.37449}, '600313.XSHG': {'count': 75378409.0, 'market_cap': 512573154.0, 'name': '1', 'price': '6.80', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.06965}, '603456.XSHG': {'count': 27586206.0, 'market_cap': 620965497.06, 'name': '1', 'price': '22.51', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.06225}, '002354.XSHE': {'count': 11747209.0, 'market_cap': 913580443.93, 'name': '2', 'price': '77.77', 'date': datetime.datetime(2016, 12, 13, 0, 0), 'capital_ratio': 0.04022}, '600823.XSHG': {'count': 212335692.0, 'market_cap': 1598887753.23, 'name': '1', 'price': '7.53', 'date': datetime.datetime(2016, 12, 24, 0, 0), 'capital_ratio': 0.07925}, '000582.XSHE': {'count': 690026949.0, 'market_cap': 11323342233.09, 'name': '2', 'price': '16.41', 'date': datetime.datetime(2016, 12, 26, 0, 0), 'capital_ratio': 0.72326}, '600705.XSHG': {'count': 153154258.0, 'market_cap': 964871825.4, 'name': '1', 'price': '6.30', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.01706}, '000656.XSHE': {'count': 44260000.0, 'market_cap': 240640425.0, 'name': '2', 'price': '5.49', 'date': datetime.datetime(2016, 12, 15, 0, 0), 'capital_ratio': 0.00828}, '600729.XSHG': {'count': 33435047.0, 'market_cap': 832198319.83, 'name': '1', 'price': '24.89', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.08225}, '002785.XSHE': {'count': 47788771.0, 'market_cap': 1739033376.69, 'name': '2', 'price': '36.39', 'date': datetime.datetime(2016, 12, 23, 0, 0), 'capital_ratio': 0.23894}, '600196.XSHG': {'count': 876975.0, 'market_cap': 20047648.5, 'name': '1', 'price': '22.86', 'date': datetime.datetime(2016, 12, 6, 0, 0), 'capital_ratio': 0.00036}, '300334.XSHE': {'count': 15037707.0, 'market_cap': 287069826.63, 'name': '2', 'price': '19.09', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.05448}, '600074.XSHG': {'count': 7739404.0, 'market_cap': 109048202.36, 'name': '1', 'price': '14.09', 'date': datetime.datetime(2016, 12, 28, 0, 0), 'capital_ratio': 0.00317}, '002373.XSHE': {'count': 88174274.0, 'market_cap': 1274118259.3, 'name': '2', 'price': '14.45', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.07984}, '002009.XSHE': {'count': 3551766.0, 'market_cap': 51536124.66, 'name': '2', 'price': '14.51', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.00959}, '002555.XSHE': {'count': 191522864.0, 'market_cap': 3232905944.32, 'name': '2', 'price': '16.88', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.09187}, '002004.XSHE': {'count': 151394800.0, 'market_cap': 1388290316.0, 'name': '2', 'price': '9.17', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.0744}, '600645.XSHG': {'count': 24250000.0, 'market_cap': 649900000.0, 'name': '1', 'price': '26.80', 'date': datetime.datetime(2016, 12, 6, 0, 0), 'capital_ratio': 0.06281}, '002059.XSHE': {'count': 29299422.0, 'market_cap': 440370312.66, 'name': '2', 'price': '15.03', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.04009}, '601155.XSHG': {'count': 13623667.0, 'market_cap': 173974227.59, 'name': '1', 'price': '12.77', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.00614}, '300242.XSHE': {'count': 134424060.0, 'market_cap': 2070130524.0, 'name': '2', 'price': '15.40', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.21087}, '300496.XSHE': {'count': 140450984.0, 'market_cap': 6091484554.36, 'name': '2', 'price': '52.28', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.34846}, '300106.XSHE': {'count': 795011.0, 'market_cap': 13014330.07, 'name': '2', 'price': '16.37', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.00376}, '002421.XSHE': {'count': 27656913.0, 'market_cap': 175068259.29, 'name': '2', 'price': '6.33', 'date': datetime.datetime(2016, 12, 23, 0, 0), 'capital_ratio': 0.01435}, '002783.XSHE': {'count': 21932000.0, 'market_cap': 1915321560.0, 'name': '2', 'price': '87.33', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.26275}, '600522.XSHG': {'count': 68181818.0, 'market_cap': 730909088.96, 'name': '1', 'price': '10.72', 'date': datetime.datetime(2016, 12, 7, 0, 0), 'capital_ratio': 0.02612}, '300144.XSHE': {'count': 21753681.0, 'market_cap': 456827301.0, 'name': '2', 'price': '21.00', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.01498}, '600466.XSHG': {'count': 7635320.0, 'market_cap': 82156043.2, 'name': '1', 'price': '10.76', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.00357}, '300390.XSHE': {'count': 15969791.0, 'market_cap': 201219328.8, 'name': '2', 'price': '12.60', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.04635}, '300420.XSHE': {'count': 3758393.0, 'market_cap': 93884657.14, 'name': '2', 'price': '24.98', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.01549}, '600693.XSHG': {'count': 629200.0, 'market_cap': 6222788.0, 'name': '1', 'price': '9.89', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.0007}, '603800.XSHG': {'count': 15600000.0, 'market_cap': 451932000.0, 'name': '1', 'price': '28.97', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.075}, '002168.XSHE': {'count': 2460000.0, 'market_cap': 38007000.0, 'name': '2', 'price': '15.45', 'date': datetime.datetime(2016, 12, 28, 0, 0), 'capital_ratio': 0.00298}, '002170.XSHE': {'count': 18296625.0, 'market_cap': 166682253.75, 'name': '2', 'price': '9.11', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.02056}, '002129.XSHE': {'count': 347976307.0, 'market_cap': 2877764058.89, 'name': '2', 'price': '8.27', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.1316}, '600236.XSHG': {'count': 2475944002.0, 'market_cap': 15301333932.36, 'name': '1', 'price': '6.18', 'date': datetime.datetime(2016, 12, 13, 0, 0), 'capital_ratio': 0.40834}, '600623.XSHG': {'count': 287178206.0, 'market_cap': 4115263691.98, 'name': '1', 'price': '14.33', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.13563}, '603778.XSHG': {'count': 40481639.0, 'market_cap': 1046855158.68, 'name': '1', 'price': '25.86', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.20241}, '002520.XSHE': {'count': 61280071.0, 'market_cap': 754970474.72, 'name': '2', 'price': '12.32', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.1106}, '002174.XSHE': {'count': 28229385.0, 'market_cap': 717026379.0, 'name': '2', 'price': '25.40', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.03277}, '603958.XSHG': {'count': 2154.0, 'market_cap': 67247.88, 'name': '1', 'price': '31.22', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 1e-05}, '600970.XSHG': {'count': 43264817.0, 'market_cap': 322322886.65, 'name': '1', 'price': '7.45', 'date': datetime.datetime(2016, 12, 21, 0, 0), 'capital_ratio': 0.02466}, '300303.XSHE': {'count': 65717415.0, 'market_cap': 583570645.2, 'name': '2', 'price': '8.88', 'date': datetime.datetime(2016, 12, 14, 0, 0), 'capital_ratio': 0.0947}, '000636.XSHE': {'count': 62073352.0, 'market_cap': 590938311.04, 'name': '2', 'price': '9.52', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.06934}, '603866.XSHG': {'count': 14164740.0, 'market_cap': 563807876.4, 'name': '1', 'price': '42.71', 'date': datetime.datetime(2016, 12, 22, 0, 0), 'capital_ratio': 0.03147}, '603996.XSHG': {'count': 28125000.0, 'market_cap': 628593750.0, 'name': '1', 'price': '22.35', 'date': datetime.datetime(2016, 12, 22, 0, 0), 'capital_ratio': 0.0937}, '300389.XSHE': {'count': 694797.0, 'market_cap': 14958957.88, 'name': '2', 'price': '21.53', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.00217}, '300038.XSHE': {'count': 56000.0, 'market_cap': 2339680.0, 'name': '2', 'price': '41.78', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.00029}, '002551.XSHE': {'count': 888314.0, 'market_cap': 14655291.66, 'name': '2', 'price': '19.71', 'date': datetime.datetime(2016, 12, 15, 0, 0), 'capital_ratio': 0.002}, '600590.XSHG': {'count': 1680000.0, 'market_cap': 8047200.0, 'name': '1', 'price': '19.16', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.00252}, '300053.XSHE': {'count': 12987843.0, 'market_cap': 181699923.57, 'name': '2', 'price': '13.99', 'date': datetime.datetime(2016, 12, 8, 0, 0), 'capital_ratio': 0.02084}, '300182.XSHE': {'count': 4551376.0, 'market_cap': 45734887.0, 'name': '2', 'price': '11.00', 'date': datetime.datetime(2016, 12, 2, 0, 0), 'capital_ratio': 0.00178}, '300103.XSHE': {'count': 63414333.0, 'market_cap': 1539700005.24, 'name': '2', 'price': '24.28', 'date': datetime.datetime(2016, 12, 13, 0, 0), 'capital_ratio': 0.2995}, '300467.XSHE': {'count': 673334.0, 'market_cap': 29074562.12, 'name': '2', 'price': '43.18', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.00404}, '600225.XSHG': {'count': 609071.0, 'market_cap': 4044231.44, 'name': '1', 'price': '6.64', 'date': datetime.datetime(2016, 12, 2, 0, 0), 'capital_ratio': 0.00065}, '600190.XSHG': {'count': 440504130.0, 'market_cap': 1836902222.1, 'name': '1', 'price': '4.17', 'date': datetime.datetime(2016, 12, 20, 0, 0), 'capital_ratio': 0.22}, '601599.XSHG': {'count': 2458320.0, 'market_cap': 21030681.6, 'name': '1', 'price': '8.88', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.00275}, '300410.XSHE': {'count': 3818000.0, 'market_cap': 178311587.22, 'name': '2', 'price': '48.06', 'date': datetime.datetime(2016, 12, 6, 0, 0), 'capital_ratio': 0.02108}, '300125.XSHE': {'count': 1885133.0, 'market_cap': 57025273.25, 'name': '2', 'price': '30.25', 'date': datetime.datetime(2016, 12, 24, 0, 0), 'capital_ratio': 0.01598}, '601968.XSHG': {'count': 30000000.0, 'market_cap': 310500000.0, 'name': '1', 'price': '10.35', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.036}, '002779.XSHE': {'count': 11880000.0, 'market_cap': 159489000.0, 'name': '2', 'price': '35.80', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.09}, '000999.XSHE': {'count': 652990.0, 'market_cap': 16135382.9, 'name': '2', 'price': '24.71', 'date': datetime.datetime(2016, 12, 8, 0, 0), 'capital_ratio': 0.00067}, '300027.XSHE': {'count': 3548120.0, 'market_cap': 40803380.0, 'name': '2', 'price': '11.50', 'date': datetime.datetime(2016, 12, 15, 0, 0), 'capital_ratio': 0.00127}, '002454.XSHE': {'count': 880000.0, 'market_cap': 11109000.0, 'name': '2', 'price': '13.80', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.00209}, '002777.XSHE': {'count': 4020000.0, 'market_cap': 383910000.0, 'name': '2', 'price': '95.50', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.05025}, '603979.XSHG': {'count': 10080000.0, 'market_cap': 184161600.0, 'name': '1', 'price': '18.27', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.0224}, '300083.XSHE': {'count': 31886416.0, 'market_cap': 234365157.6, 'name': '2', 'price': '7.35', 'date': datetime.datetime(2016, 12, 21, 0, 0), 'capital_ratio': 0.0224}, '300051.XSHE': {'count': 4964539.0, 'market_cap': 72829787.13, 'name': '2', 'price': '14.67', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.01342}, '603009.XSHG': {'count': 1651500.0, 'market_cap': 55495125.0, 'name': '1', 'price': '40.50', 'date': datetime.datetime(2016, 12, 20, 0, 0), 'capital_ratio': 0.01258}, '300422.XSHE': {'count': 1263200.0, 'market_cap': 37564774.0, 'name': '2', 'price': '34.97', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.00887}, '300366.XSHE': {'count': 36825842.0, 'market_cap': 1513542024.0, 'name': '2', 'price': '41.10', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.1401}, '002781.XSHE': {'count': 47443500.0, 'market_cap': 1742599755.0, 'name': '2', 'price': '36.73', 'date': datetime.datetime(2016, 12, 22, 0, 0), 'capital_ratio': 0.21086}, '300355.XSHE': {'count': 56753688.0, 'market_cap': 535187277.84, 'name': '2', 'price': '9.43', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.0566}, '000513.XSHE': {'count': 498560.0, 'market_cap': 28717056.0, 'name': '2', 'price': '57.60', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.00117}, '000875.XSHE': {'count': 165968695.0, 'market_cap': 1100372447.85, 'name': '2', 'price': '6.63', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.11363}, '600566.XSHG': {'count': 610824301.0, 'market_cap': 18288079571.94, 'name': '1', 'price': '29.94', 'date': datetime.datetime(2016, 12, 26, 0, 0), 'capital_ratio': 0.75445}, '300009.XSHE': {'count': 665861.0, 'market_cap': 0, 'name': '2', 'price': '20.91', 'date': datetime.datetime(2016, 12, 13, 0, 0), 'capital_ratio': 0.00122}, '300439.XSHE': {'count': 171804.0, 'market_cap': 5205661.2, 'name': '2', 'price': '30.30', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.00049}, '002733.XSHE': {'count': 8962893.0, 'market_cap': 194674035.96, 'name': '2', 'price': '21.72', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.0256}, '300018.XSHE': {'count': 32037070.0, 'market_cap': 363300373.8, 'name': '2', 'price': '11.34', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.06663}, '300026.XSHE': {'count': 92522406.0, 'market_cap': 517200249.54, 'name': '2', 'price': '5.59', 'date': datetime.datetime(2016, 12, 14, 0, 0), 'capital_ratio': 0.03072}, '002121.XSHE': {'count': 3967500.0, 'market_cap': 34834650.0, 'name': '2', 'price': '8.78', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.00333}, '603567.XSHG': {'count': 144000000.0, 'market_cap': 2913120000.0, 'name': '1', 'price': '20.23', 'date': datetime.datetime(2016, 12, 8, 0, 0), 'capital_ratio': 0.16958}, '002446.XSHE': {'count': 15378171.0, 'market_cap': 383839148.16, 'name': '2', 'price': '24.96', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.0343}, '002348.XSHE': {'count': 5328000.0, 'market_cap': 40759200.0, 'name': '2', 'price': '7.65', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.00563}, '002624.XSHE': {'count': 21448556.0, 'market_cap': 418287996.08, 'name': '2', 'price': '30.64', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.01631}, '300315.XSHE': {'count': 83993173.0, 'market_cap': 827332754.05, 'name': '2', 'price': '9.85', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.03031}, '002512.XSHE': {'count': 24406995.0, 'market_cap': 360048476.12, 'name': '2', 'price': '15.38', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.02228}, '300248.XSHE': {'count': 13000000.0, 'market_cap': 341510000.0, 'name': '2', 'price': '26.27', 'date': datetime.datetime(2016, 12, 13, 0, 0), 'capital_ratio': 0.04005}, '300398.XSHE': {'count': 8932950.0, 'market_cap': 534637057.5, 'name': '2', 'price': '59.85', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.08589}, '000587.XSHE': {'count': 18981528.0, 'market_cap': 279218276.88, 'name': '2', 'price': '14.71', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.01788}, '000973.XSHE': {'count': 48590874.0, 'market_cap': 375607456.02, 'name': '2', 'price': '7.73', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.05023}, '300404.XSHE': {'count': 1840000.0, 'market_cap': 65246400.0, 'name': '2', 'price': '35.46', 'date': datetime.datetime(2016, 12, 6, 0, 0), 'capital_ratio': 0.0138}, '603118.XSHG': {'count': 3638800.0, 'market_cap': 134303064.0, 'name': '1', 'price': '39.48', 'date': datetime.datetime(2016, 12, 20, 0, 0), 'capital_ratio': 0.01024}, '002225.XSHE': {'count': 7618738.0, 'market_cap': 55769162.16, 'name': '2', 'price': '7.32', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.00865}, '300494.XSHE': {'count': 59940000.0, 'market_cap': 2017580400.0, 'name': '2', 'price': '33.66', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.24975}, '300022.XSHE': {'count': 1189043.0, 'market_cap': 10237660.23, 'name': '2', 'price': '8.61', 'date': datetime.datetime(2016, 12, 14, 0, 0), 'capital_ratio': 0.00313}, '300159.XSHE': {'count': 393069857.0, 'market_cap': 6249810726.3, 'name': '2', 'price': '15.90', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.26374}, '300495.XSHE': {'count': 37500000.0, 'market_cap': 1641375000.0, 'name': '2', 'price': '43.77', 'date': datetime.datetime(2016, 12, 21, 0, 0), 'capital_ratio': 0.16618}, '600579.XSHG': {'count': 115281624.0, 'market_cap': 1581663881.28, 'name': '1', 'price': '13.72', 'date': datetime.datetime(2016, 12, 25, 0, 0), 'capital_ratio': 0.28074}, '300409.XSHE': {'count': 10350000.0, 'market_cap': 89760375.0, 'name': '2', 'price': '34.69', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.04814}, '002085.XSHE': {'count': 105964274.0, 'market_cap': 2042991202.72, 'name': '2', 'price': '19.28', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.05815}, '600677.XSHG': {'count': 18051147.0, 'market_cap': 312465354.57, 'name': '1', 'price': '17.31', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.03459}, '601016.XSHG': {'count': 300000000.0, 'market_cap': 2838000000.0, 'name': '1', 'price': '9.46', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.14438}, '300032.XSHE': {'count': 15356082.0, 'market_cap': 237865710.18, 'name': '2', 'price': '15.49', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.01886}, '002131.XSHE': {'count': 99423076.0, 'market_cap': 1608665369.68, 'name': '2', 'price': '16.18', 'date': datetime.datetime(2016, 12, 14, 0, 0), 'capital_ratio': 0.06188}, '600703.XSHG': {'count': 249489115.0, 'market_cap': 3173501542.8, 'name': '1', 'price': '12.72', 'date': datetime.datetime(2016, 12, 15, 0, 0), 'capital_ratio': 0.06117}, '300231.XSHE': {'count': 5580375.0, 'market_cap': 93616281.0, 'name': '2', 'price': '18.26', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.01629}, '601992.XSHG': {'count': 919811322.0, 'market_cap': 4047169816.8, 'name': '1', 'price': '4.40', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.08614}, '603508.XSHG': {'count': 25200000.0, 'market_cap': 1954764000.0, 'name': '1', 'price': '77.57', 'date': datetime.datetime(2016, 12, 24, 0, 0), 'capital_ratio': 0.1575}, '002642.XSHE': {'count': 37402042.0, 'market_cap': 767489901.84, 'name': '2', 'price': '20.52', 'date': datetime.datetime(2016, 12, 9, 0, 0), 'capital_ratio': 0.05883}, '600634.XSHG': {'count': 177753390.0, 'market_cap': 3012919960.5, 'name': '1', 'price': '16.95', 'date': datetime.datetime(2016, 12, 26, 0, 0), 'capital_ratio': 0.30874}, '002253.XSHE': {'count': 16757695.0, 'market_cap': 434024300.5, 'name': '2', 'price': '25.90', 'date': datetime.datetime(2016, 12, 12, 0, 0), 'capital_ratio': 0.07427}, '300040.XSHE': {'count': 24360330.0, 'market_cap': 268450836.6, 'name': '2', 'price': '11.02', 'date': datetime.datetime(2016, 12, 19, 0, 0), 'capital_ratio': 0.07039}, '002361.XSHE': {'count': 28744665.0, 'market_cap': 200925208.35, 'name': '2', 'price': '6.99', 'date': datetime.datetime(2016, 12, 13, 0, 0), 'capital_ratio': 0.03332}, '000605.XSHE': {'count': 4795171.0, 'market_cap': 99068232.86, 'name': '2', 'price': '20.66', 'date': datetime.datetime(2016, 12, 26, 0, 0), 'capital_ratio': 0.02459}, '300247.XSHE': {'count': 1556316.0, 'market_cap': 12824043.84, 'name': '2', 'price': '8.24', 'date': datetime.datetime(2016, 12, 14, 0, 0), 'capital_ratio': 0.00193}, '300425.XSHE': {'count': 2943882.0, 'market_cap': 88743014.29, 'name': '2', 'price': '30.83', 'date': datetime.datetime(2016, 12, 5, 0, 0), 'capital_ratio': 0.01667}, '002017.XSHE': {'count': 1872258.0, 'market_cap': 25780992.66, 'name': '2', 'price': '13.77', 'date': datetime.datetime(2016, 12, 20, 0, 0), 'capital_ratio': 0.0054}, '002631.XSHE': {'count': 3560000.0, 'market_cap': 44431200.0, 'name': '2', 'price': '18.36', 'date': datetime.datetime(2016, 12, 16, 0, 0), 'capital_ratio': 0.00548}, '002146.XSHE': {'count': 524079165.0, 'market_cap': 4538525568.9, 'name': '2', 'price': '8.66', 'date': datetime.datetime(2016, 12, 31, 0, 0), 'capital_ratio': 0.12053}, '000792.XSHE': {'count': 266884531.0, 'market_cap': 5180228746.71, 'name': '2', 'price': '19.41', 'date': datetime.datetime(2016, 12, 29, 0, 0), 'capital_ratio': 0.14369}, '002327.XSHE': {'count': 501003.0, 'market_cap': 4478966.82, 'name': '2', 'price': '8.94', 'date': datetime.datetime(2016, 12, 30, 0, 0), 'capital_ratio': 0.00059}, '300492.XSHE': {'count': 3900000.0, 'market_cap': 205335000.0, 'name': '2', 'price': '52.65', 'date': datetime.datetime(2016, 12, 23, 0, 0), 'capital_ratio': 0.04688}}
import urllib2import time,datetime'''抓取股东减持列表-'''# 从 http://data.eastmoney.com/executive/gdzjc.html 页抓取增减持股票# 参数 page 为指定抓取第几页def get_reduction_of_shareholders_by_page(page):url = 'http://data.eastmoney.com/DataCenter_V3/gdzjc.ashx?pagesize=50&page=%d&js=varfswIAGDF¶m=&sortRule=-1&sortType=BDJZ&tabid=all&code=&name=&rt=49402498'url = url%(page)html=''for i in range(0,3):try:response = urllib2.urlopen(url)html = response.read().decode("gbk").strip()breakexcept:html = ''if html == '':return {}html = html[html.find('[')+1:-3]sl = list(html.split('","'))# 因增减持股票是会存在重复的,同一只股票多个股票减持,或多次公告,都会出现。所以用list,而不是dictr_dec = []r_add = []for x in sl:csl = list(x.split(','))''' 0: 002248 代码 1: 华东数控 名称 2: 11.60 最新价 3: 0.78 跌涨幅(%) 4: 山东省高新技术创业投资有限公司 股东名称 5: 减持 增减类型 6: 122.86, 变动信息 变动数量(万股) 7: 0.52 变动信息 占流通股比例(%) 8: 二级市场 9: 3257.0886 变动后 持股总数(万股) 10: 10.59 变动后 占总股本比例 11: 3257.0886 变动后 持流通股数(万股) 12: 13.75 变动后 占流通股比例(%) 13: 2016-12-03 变动开始日 14: 2016-12-14 变动截止日 15: 2016-12-16 公告日 16: 0.3995 变动信息 占总股票比例(%) '''# 这里随便取了几列信息。需要哪个自己按这种方式取吧td = {"code":normalize_code(csl[0]) ,"name" : csl[1] # 名称 , "date" : csl[15] # 公告日期 , "count" : csl[6] # 增减持数 , "capital_ratio" : csl[7] # 变动信息 占流通股比例(%) ,'price':csl[2] # 最新收盘价,注:是否有实时更新不清楚,慎用 } if csl[5] == u'减持':r_dec.append(td)else:r_add.append(td)return r_dec,r_add# 测试抓取最新的第一页的数据r_dec,r_add = get_reduction_of_shareholders_by_page(1)l_dec = list(set([x['code'] for x in r_dec])) # 获取股票代码,并去除重复l_add = list(set([x['code'] for x in r_add]))print '减持的股票:'print l_decprint '增持的股票:'print l_add
减持的股票: [u'000806.XSHE', u'600678.XSHG', u'002248.XSHE', u'000783.XSHE', u'600837.XSHG', u'000619.XSHE', u'300278.XSHE', u'002491.XSHE', u'300413.XSHE', u'002761.XSHE', u'002576.XSHE', u'300058.XSHE', u'300378.XSHE', u'300070.XSHE', u'002058.XSHE', u'002697.XSHE'] 增持的股票: [u'000806.XSHE', u'300131.XSHE', u'002159.XSHE', u'300129.XSHE', u'603030.XSHG', u'300174.XSHE', u'601222.XSHG', u'600196.XSHG', u'300197.XSHE', u'600900.XSHG', u'600137.XSHG', u'002691.XSHE', u'002290.XSHE', u'300145.XSHE', u'002537.XSHE', u'600273.XSHG', u'300185.XSHE', u'000735.XSHE', u'002697.XSHE']
本社区仅针对特定人员开放
查看需注册登录并通过风险意识测评
5秒后跳转登录页面...