返回介绍

第一部分 新手入门

第二部分 股票量化相关

第三部分 基金、利率互换、固定收益类

第四部分 衍生品相关

涨停股票封单统计

发布于 2022-02-20 22:26:16 字数 26134 浏览 832 评论 0 收藏 0

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.XSHG24.8627.35809522.139825
1*ST夏利000927.XSHE7.117.476191246.248264
2宝诚股份600892.XSHG35.6039.161420055.607200
3*ST古汉000590.XSHE17.9718.873522866.475236
4永艺股份603600.XSHG96.55106.21750079.657500
5法拉电子600563.XSHG27.5230.272748583.197095
6天润乳业600419.XSHG37.4641.2130361125.117681
7光大证券601788.XSHG20.0922.0965049143.758290
8S佳通600182.XSHG19.5920.5780503165.594671
9*ST华锦000059.XSHE7.577.95220596175.373820
10鄂尔多斯600295.XSHG8.409.24248700229.798800
11富煌钢构002743.XSHE24.3226.7591387244.460225
12良信电器002706.XSHE52.8158.0947519276.037871
13洋河股份002304.XSHE64.2670.6941128290.733832
14*ST水井600779.XSHG9.7610.25284700291.817500
15滨海能源000695.XSHE14.0615.47189000292.383000
16中钢国际000928.XSHE18.0319.83167224331.605192
17金地集团600383.XSHG12.6413.90273600380.304000
18百花村600721.XSHG10.2111.23361831406.336213
19XD吉林森600189.XSHG9.8510.73392689421.355297
20兖州煤业600188.XSHG9.7410.71422093452.061603
21时代万恒600241.XSHG11.1412.25381174466.938150
22银座股份600858.XSHG9.1910.11480700485.987700
23金山开发600679.XSHG11.3912.53393526493.088078
24远程电缆002692.XSHE16.6718.34271064497.131376
25苏 泊 尔002032.XSHE21.8824.07206600497.286200
26万向德农600371.XSHG15.9317.52292926513.206352
27洛阳玻璃600876.XSHG10.6011.66448678523.158548
28东方证券600958.XSHG23.1825.50205700524.535000
29东兴证券601198.XSHG20.5222.57236032532.724224
.....................
1250金龙汽车600686.XSHG14.4215.861515435724034.810202
1251浩物股份000757.XSHE7.438.173024946224713.810454
1252湖北能源000883.XSHE5.035.534542849325121.956629
1253上海莱士002252.XSHE70.8277.90326687025448.917300
1254保利地产600048.XSHG9.3810.322481273925606.746648
1255贵州百灵002424.XSHE46.5151.16500713825616.518008
1256掌趣科技300315.XSHE9.7010.672539905827100.794886
1257万向钱潮000559.XSHE11.6512.822161265227707.419864
1258东软集团600718.XSHG12.0913.302108701628045.731280
1259时代新材600458.XSHG16.9718.671518969728359.164299
1260东方财富300059.XSHE45.9950.59581964029441.558760
1261紫光股份000938.XSHE56.6962.25475618929607.276525
1262泛海控股000046.XSHE11.0012.102455306829709.212280
1263隆平高科000998.XSHE18.1519.971513756430229.715308
1264五 粮 液000858.XSHE21.9224.111267266330553.790493
1265洛阳钼业603993.XSHG10.2111.232876373832301.677774
1266川投能源600674.XSHG8.919.803475910534063.922900
1267大族激光002008.XSHE20.0922.101664575236787.111920
1268机器人300024.XSHE78.2086.02428590536867.354810
1269上海电气601727.XSHG10.3411.373320421737753.194729
1270大唐电信600198.XSHG19.8821.871785614939051.397863
1271招商证券600999.XSHG22.0724.281754785342606.187084
1272新 大 陆000997.XSHE17.5219.272228047142934.467617
1273同方股份600100.XSHG11.4812.633791565247887.468476
1274中航动力600893.XSHG28.3431.171787158255705.721094
1275国泰君安601211.XSHG25.8828.471994261556776.624905
1276中国重工601989.XSHG8.539.386733897563163.958550
1277格力电器000651.XSHE19.6421.603081788466566.629440
1278中国核电601985.XSHG8.209.027666423069151.135460
1279兴业银行601166.XSHG15.5317.084592115878433.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.XSHE15.3516.89597998710100.19804323000000259
1万孚生物300482.XSHE40.8144.89407727518302.88747522000000185
2真视通002771.XSHE35.8539.44317054812504.64131220000000158
3恒锋工具300488.XSHE39.8743.8619501318553.27456612510000155
4山河药辅300452.XSHE46.6251.2812310626312.88593611600000106
5浩物股份000757.XSHE7.438.173024946224713.81045431280268396
6蓝晓科技300487.XSHE31.2834.4118944006518.6304002000000094
7康斯特300445.XSHE58.5364.388994395790.5882821020000088
8天成自控603085.XSHG18.5520.4121890874467.9265672500000087
9中飞股份300489.XSHE40.7344.809974004468.3520001135000087
10杭州高新300478.XSHE30.0233.0214148104671.7026201667000084
11濮阳惠成300481.XSHE22.5124.7614843723675.3050722000000074
12信息发展300469.XSHE42.7246.9912478925863.8445081670000074
13汇洁股份002763.XSHE21.9824.1839012009433.1016005400000072
14三变科技002112.XSHE9.6310.591303985513809.20644518095645872
15康弘药业002773.XSHE35.3038.83316399612285.7964684560000069
16凤形股份002760.XSHE23.8126.1915316504011.3913502200000069
17石大胜华603026.XSHG15.0916.6034222225680.8885205068000067
18三毛派神000779.XSHE9.9310.921259317013751.74164018644102067
19万林股份603117.XSHG13.6214.9840569426077.2991166000000067
20四通股份603838.XSHG17.2719.0022041154187.8185003334000066
21普路通002769.XSHE65.4171.9512268348827.0706301850000066
22威帝股份603023.XSHG31.0634.1712924994416.4690832000000064
23普丽盛300442.XSHE40.0944.1015875757001.2057502500000063
24科迪乳业002770.XSHE12.6313.8943300376014.4213936840000063
25音飞储存603066.XSHG21.6823.8515583723716.7172202500000062
26沃施股份300483.XSHE29.0431.949474823026.2575081550000061
27立霸股份603519.XSHG45.1749.6912173756049.1363752000000060
28东杰智能300486.XSHE20.4022.4420502034600.6555323472000059
29口子窖603589.XSHG24.6427.1034447289335.2128806000000057
...........................
1250太平洋601099.XSHG9.5510.5115776511658.11120133054670260
1251科达股份600986.XSHG24.8627.35809522.1398253352697080
1252中国神华601088.XSHG18.8420.72266241551.651352164910379550
1253中国建筑601668.XSHG7.257.9888798007086.080400298532200000
1254华泰证券601688.XSHG20.5422.5910291062324.75045454437230000
1255际华集团601718.XSHG10.1011.1115503941722.48773438570000000
1256美的集团000333.XSHE30.8133.898833312993.60875922637788470
1257万华化学600309.XSHG18.4520.30282697573.87491021623347200
1258西南证券600369.XSHG15.8117.3914568002533.37520023225545620
1259宁沪高速600377.XSHG7.057.7626671992069.74642437979813550
1260金地集团600383.XSHG12.6413.90273600380.30400044914634720
1261天润乳业600419.XSHG37.4641.2130361125.117681802108370
1262荣盛石化002493.XSHE13.8515.249413741434.65397610190750000
1263立讯精密002475.XSHE30.0133.015512751819.75877511496870000
1264金隅股份601992.XSHG7.518.2629233122414.65571231114026250
1265大唐发电601991.XSHG5.846.4233824682171.54445699943600000
1266大秦铁路601006.XSHG10.0811.0932363233589.082207148667914910
1267中国汽研601965.XSHG8.909.79878170859.7284309611798670
1268中国中车601766.XSHG16.0917.701011402317901.820710229176922930
1269深高速600548.XSHG7.578.331113968927.93534414332703260
1270中国远洋601919.XSHG7.107.8159540954650.14819576356743570
1271海信科龙000921.XSHE9.7610.74693024744.3077769017178270
1272方正证券601901.XSHG9.7010.6715587031663.13610161000000000
1273中煤能源601898.XSHG6.897.5846701543539.97673291520004000
1274海螺水泥600585.XSHG18.4820.3321978994468.32866739997025790
1275招商轮船601872.XSHG6.837.5142150593165.50930947209218090
1276中海集运601866.XSHG5.566.1278630604812.19272079321250000
1277中国交建601800.XSHG15.4917.046809501160.338800117472354250
1278光大证券601788.XSHG20.0922.0965049143.75829034180000000
1279法拉电子600563.XSHG27.5230.272748583.1970952250000000
1280 rows × 8 columns

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文