Skip to content

Latest commit

 

History

History
208 lines (188 loc) · 15.1 KB

97.md

File metadata and controls

208 lines (188 loc) · 15.1 KB

涨停股票封单统计

来源:https://uqer.io/community/share/559e49d5f9f06c6dd1e17ed5

import pandas as pd

today = Date.todaysDate()
cal = Calendar('China.SSE')
yesterday = cal.advanceDate(today, '-1B',  BizDayConvention.Following).strftime('%Y%m%d')
allSecList = DataAPI.EquGet(equTypeCD = 'A', field = ['secID'])['secID'].tolist()
precls = {}
uplimit, dnlimit = [], []


for i in range(0, len(allSecList), 200):
    sub = allSecList[i:min(len(allSecList), i+200)]
    df_precls = DataAPI.MktEqudGet(secID = sub, beginDate = yesterday, endDate = yesterday, field = 'secID,closePrice')
    df_lasprx = DataAPI.MktTickRTSnapshotGet(securityID = sub, field = 'shortNM,lastPrice,bidBook,askBook')
    for j in range(len(df_precls)):
        precls[df_precls.at[j,'secID']] = df_precls.at[j,'closePrice']
    for j in range(len(df_lasprx)):
        if df_lasprx.at[j,'lastPrice'] > 0:
            sec = df_lasprx.at[j,'ticker']+'.'+df_lasprx.at[j,'exchangeCD']
            if df_lasprx.at[j,'bidBook_volume1'] == 0 and df_lasprx.at[j,'askBook_volume1'] > 0:
                bang = df_lasprx.at[j,'askBook_volume1'] * df_lasprx.at[j,'askBook_price1']
                dnlimit.append([df_lasprx.at[j,'shortNM'], sec, precls[sec], df_lasprx.at[j,'lastPrice'],df_lasprx.at[j,'askBook_volume1'], bang/10000])
            if df_lasprx.at[j,'askBook_volume1'] == 0 and df_lasprx.at[j,'bidBook_volume1'] > 0:
                bang = df_lasprx.at[j,'bidBook_volume1'] * df_lasprx.at[j,'bidBook_price1']
                uplimit.append([df_lasprx.at[j,'shortNM'], sec, precls[sec], df_lasprx.at[j,'lastPrice'],df_lasprx.at[j,'bidBook_volume1'], bang/10000])
name, sec, precls, latprx, bangvol, bang = zip(*uplimit)
df_uplimit = pd.DataFrame({'简称': name, '代码': sec, '前收': precls, '最新价': latprx,'封单量': bangvol, '封单金额(万)': bang}).sort(columns='封单金额(万)').reset_index()
df_uplimit = df_uplimit.loc[:, ['简称', '代码','前收','最新价','封单量','封单金额(万)']]
print '涨停股票数量:', len(uplimit) , '个, 收盘封单总金额:', df_uplimit.sum()['封单金额(万)']/10000 , '亿'
df_uplimit

涨停股票数量1280 收盘封单总金额644.57280353 亿
简称 代码 前收 最新价 封单量 封单金额(万)
0 科达股份 600986.XSHG 24.86 27.35 8095 22.139825
1 *ST夏利 000927.XSHE 7.11 7.47 61912 46.248264
2 宝诚股份 600892.XSHG 35.60 39.16 14200 55.607200
3 *ST古汉 000590.XSHE 17.97 18.87 35228 66.475236
4 永艺股份 603600.XSHG 96.55 106.21 7500 79.657500
5 法拉电子 600563.XSHG 27.52 30.27 27485 83.197095
6 天润乳业 600419.XSHG 37.46 41.21 30361 125.117681
7 光大证券 601788.XSHG 20.09 22.09 65049 143.758290
8 S佳通 600182.XSHG 19.59 20.57 80503 165.594671
9 *ST华锦 000059.XSHE 7.57 7.95 220596 175.373820
10 鄂尔多斯 600295.XSHG 8.40 9.24 248700 229.798800
11 富煌钢构 002743.XSHE 24.32 26.75 91387 244.460225
12 良信电器 002706.XSHE 52.81 58.09 47519 276.037871
13 洋河股份 002304.XSHE 64.26 70.69 41128 290.733832
14 *ST水井 600779.XSHG 9.76 10.25 284700 291.817500
15 滨海能源 000695.XSHE 14.06 15.47 189000 292.383000
16 中钢国际 000928.XSHE 18.03 19.83 167224 331.605192
17 金地集团 600383.XSHG 12.64 13.90 273600 380.304000
18 百花村 600721.XSHG 10.21 11.23 361831 406.336213
19 XD吉林森 600189.XSHG 9.85 10.73 392689 421.355297
20 兖州煤业 600188.XSHG 9.74 10.71 422093 452.061603
21 时代万恒 600241.XSHG 11.14 12.25 381174 466.938150
22 银座股份 600858.XSHG 9.19 10.11 480700 485.987700
23 金山开发 600679.XSHG 11.39 12.53 393526 493.088078
24 远程电缆 002692.XSHE 16.67 18.34 271064 497.131376
25 苏 泊 尔 002032.XSHE 21.88 24.07 206600 497.286200
26 万向德农 600371.XSHG 15.93 17.52 292926 513.206352
27 洛阳玻璃 600876.XSHG 10.60 11.66 448678 523.158548
28 东方证券 600958.XSHG 23.18 25.50 205700 524.535000
29 东兴证券 601198.XSHG 20.52 22.57 236032 532.724224
... ... ... ... ... ... ...
1250 金龙汽车 600686.XSHG 14.42 15.86 15154357 24034.810202
1251 浩物股份 000757.XSHE 7.43 8.17 30249462 24713.810454
1252 湖北能源 000883.XSHE 5.03 5.53 45428493 25121.956629
1253 上海莱士 002252.XSHE 70.82 77.90 3266870 25448.917300
1254 保利地产 600048.XSHG 9.38 10.32 24812739 25606.746648
1255 贵州百灵 002424.XSHE 46.51 51.16 5007138 25616.518008
1256 掌趣科技 300315.XSHE 9.70 10.67 25399058 27100.794886
1257 万向钱潮 000559.XSHE 11.65 12.82 21612652 27707.419864
1258 东软集团 600718.XSHG 12.09 13.30 21087016 28045.731280
1259 时代新材 600458.XSHG 16.97 18.67 15189697 28359.164299
1260 东方财富 300059.XSHE 45.99 50.59 5819640 29441.558760
1261 紫光股份 000938.XSHE 56.69 62.25 4756189 29607.276525
1262 泛海控股 000046.XSHE 11.00 12.10 24553068 29709.212280
1263 隆平高科 000998.XSHE 18.15 19.97 15137564 30229.715308
1264 五 粮 液 000858.XSHE 21.92 24.11 12672663 30553.790493
1265 洛阳钼业 603993.XSHG 10.21 11.23 28763738 32301.677774
1266 川投能源 600674.XSHG 8.91 9.80 34759105 34063.922900
1267 大族激光 002008.XSHE 20.09 22.10 16645752 36787.111920
1268 机器人 300024.XSHE 78.20 86.02 4285905 36867.354810
1269 上海电气 601727.XSHG 10.34 11.37 33204217 37753.194729
1270 大唐电信 600198.XSHG 19.88 21.87 17856149 39051.397863
1271 招商证券 600999.XSHG 22.07 24.28 17547853 42606.187084
1272 新 大 陆 000997.XSHE 17.52 19.27 22280471 42934.467617
1273 同方股份 600100.XSHG 11.48 12.63 37915652 47887.468476
1274 中航动力 600893.XSHG 28.34 31.17 17871582 55705.721094
1275 国泰君安 601211.XSHG 25.88 28.47 19942615 56776.624905
1276 中国重工 601989.XSHG 8.53 9.38 67338975 63163.958550
1277 格力电器 000651.XSHE 19.64 21.60 30817884 66566.629440
1278 中国核电 601985.XSHG 8.20 9.02 76664230 69151.135460
1279 兴业银行 601166.XSHG 15.53 17.08 45921158 78433.337864
1280 rows × 6 columns
nfList = DataAPI.EquGet(equTypeCD = 'A', field = ['secID','nonrestfloatA'])
nf = {}
for j in range(len(nfList)):
    nf[nfList.at[j,'secID']] = nfList.at[j,'nonrestfloatA']
name, sec, precls, latprx, bangvol, bang = zip(*uplimit)
nflist = []
nfrate = []
for j in range(len(sec)):
   nflist.append(nf[sec[j]])
   if nf[sec[j]] > 0:
       nfrate.append(bangvol[j]*1000/nf[sec[j]])
   else:
       nfrate.append(0)
   
print "按照封单跟流通股本比例排序"
df_uplimit1 = pd.DataFrame({'简称': name, '代码': sec, '前收': precls, '最新价': latprx,'封单量': bangvol, '封单金额(万)': bang, '总流通股本': tuple(nflist), '封单总股本比(千分之n)': tuple(nfrate)}).sort(columns='封单总股本比(千分之n)',ascending=False).reset_index()
df_uplimit1 = df_uplimit1.loc[:, ['简称', '代码','前收','最新价','封单量','封单金额(万)','总流通股本','封单总股本比(千分之n)']]
df_uplimit1

按照封单跟流通股本比例排序
简称 代码 前收 最新价 封单量 封单金额(万) 总流通股本 封单总股本比(千分之n)
0 光力科技 300480.XSHE 15.35 16.89 5979987 10100.198043 23000000 259
1 万孚生物 300482.XSHE 40.81 44.89 4077275 18302.887475 22000000 185
2 真视通 002771.XSHE 35.85 39.44 3170548 12504.641312 20000000 158
3 恒锋工具 300488.XSHE 39.87 43.86 1950131 8553.274566 12510000 155
4 山河药辅 300452.XSHE 46.62 51.28 1231062 6312.885936 11600000 106
5 浩物股份 000757.XSHE 7.43 8.17 30249462 24713.810454 312802683 96
6 蓝晓科技 300487.XSHE 31.28 34.41 1894400 6518.630400 20000000 94
7 康斯特 300445.XSHE 58.53 64.38 899439 5790.588282 10200000 88
8 天成自控 603085.XSHG 18.55 20.41 2189087 4467.926567 25000000 87
9 中飞股份 300489.XSHE 40.73 44.80 997400 4468.352000 11350000 87
10 杭州高新 300478.XSHE 30.02 33.02 1414810 4671.702620 16670000 84
11 濮阳惠成 300481.XSHE 22.51 24.76 1484372 3675.305072 20000000 74
12 信息发展 300469.XSHE 42.72 46.99 1247892 5863.844508 16700000 74
13 汇洁股份 002763.XSHE 21.98 24.18 3901200 9433.101600 54000000 72
14 三变科技 002112.XSHE 9.63 10.59 13039855 13809.206445 180956458 72
15 康弘药业 002773.XSHE 35.30 38.83 3163996 12285.796468 45600000 69
16 凤形股份 002760.XSHE 23.81 26.19 1531650 4011.391350 22000000 69
17 石大胜华 603026.XSHG 15.09 16.60 3422222 5680.888520 50680000 67
18 三毛派神 000779.XSHE 9.93 10.92 12593170 13751.741640 186441020 67
19 万林股份 603117.XSHG 13.62 14.98 4056942 6077.299116 60000000 67
20 四通股份 603838.XSHG 17.27 19.00 2204115 4187.818500 33340000 66
21 普路通 002769.XSHE 65.41 71.95 1226834 8827.070630 18500000 66
22 威帝股份 603023.XSHG 31.06 34.17 1292499 4416.469083 20000000 64
23 普丽盛 300442.XSHE 40.09 44.10 1587575 7001.205750 25000000 63
24 科迪乳业 002770.XSHE 12.63 13.89 4330037 6014.421393 68400000 63
25 音飞储存 603066.XSHG 21.68 23.85 1558372 3716.717220 25000000 62
26 沃施股份 300483.XSHE 29.04 31.94 947482 3026.257508 15500000 61
27 立霸股份 603519.XSHG 45.17 49.69 1217375 6049.136375 20000000 60
28 东杰智能 300486.XSHE 20.40 22.44 2050203 4600.655532 34720000 59
29 口子窖 603589.XSHG 24.64 27.10 3444728 9335.212880 60000000 57
... ... ... ... ... ... ... ... ...
1250 太平洋 601099.XSHG 9.55 10.51 1577651 1658.111201 3305467026 0
1251 科达股份 600986.XSHG 24.86 27.35 8095 22.139825 335269708 0
1252 中国神华 601088.XSHG 18.84 20.72 266241 551.651352 16491037955 0
1253 中国建筑 601668.XSHG 7.25 7.98 8879800 7086.080400 29853220000 0
1254 华泰证券 601688.XSHG 20.54 22.59 1029106 2324.750454 5443723000 0
1255 际华集团 601718.XSHG 10.10 11.11 1550394 1722.487734 3857000000 0
1256 美的集团 000333.XSHE 30.81 33.89 883331 2993.608759 2263778847 0
1257 万华化学 600309.XSHG 18.45 20.30 282697 573.874910 2162334720 0
1258 西南证券 600369.XSHG 15.81 17.39 1456800 2533.375200 2322554562 0
1259 宁沪高速 600377.XSHG 7.05 7.76 2667199 2069.746424 3797981355 0
1260 金地集团 600383.XSHG 12.64 13.90 273600 380.304000 4491463472 0
1261 天润乳业 600419.XSHG 37.46 41.21 30361 125.117681 80210837 0
1262 荣盛石化 002493.XSHE 13.85 15.24 941374 1434.653976 1019075000 0
1263 立讯精密 002475.XSHE 30.01 33.01 551275 1819.758775 1149687000 0
1264 金隅股份 601992.XSHG 7.51 8.26 2923312 2414.655712 3111402625 0
1265 大唐发电 601991.XSHG 5.84 6.42 3382468 2171.544456 9994360000 0
1266 大秦铁路 601006.XSHG 10.08 11.09 3236323 3589.082207 14866791491 0
1267 中国汽研 601965.XSHG 8.90 9.79 878170 859.728430 961179867 0
1268 中国中车 601766.XSHG 16.09 17.70 10114023 17901.820710 22917692293 0
1269 深高速 600548.XSHG 7.57 8.33 1113968 927.935344 1433270326 0
1270 中国远洋 601919.XSHG 7.10 7.81 5954095 4650.148195 7635674357 0
1271 海信科龙 000921.XSHE 9.76 10.74 693024 744.307776 901717827 0
1272 方正证券 601901.XSHG 9.70 10.67 1558703 1663.136101 6100000000 0
1273 中煤能源 601898.XSHG 6.89 7.58 4670154 3539.976732 9152000400 0
1274 海螺水泥 600585.XSHG 18.48 20.33 2197899 4468.328667 3999702579 0
1275 招商轮船 601872.XSHG 6.83 7.51 4215059 3165.509309 4720921809 0
1276 中海集运 601866.XSHG 5.56 6.12 7863060 4812.192720 7932125000 0
1277 中国交建 601800.XSHG 15.49 17.04 680950 1160.338800 11747235425 0
1278 光大证券 601788.XSHG 20.09 22.09 65049 143.758290 3418000000 0
1279 法拉电子 600563.XSHG 27.52 30.27 27485 83.197095 225000000 0
1280 rows × 8 columns