返回介绍

第一部分 新手入门

第二部分 股票量化相关

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

第四部分 衍生品相关

按照封单跟流通股本比例排序,剔除6月上市新股,前50

发布于 2022-02-20 22:26:16 字数 25463 浏览 823 评论 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','listDate'])
nf = {}
nl = {}
for j in range(len(nfList)):
    nf[nfList.at[j,'secID']] = nfList.at[j,'nonrestfloatA']
    nl[nfList.at[j,'secID']] = nfList.at[j,'listDate']
name, sec, precls, latprx, bangvol, bang = zip(*uplimit)
nflist = []
nllist = []
nfrate = []
for j in range(len(sec)):
   nflist.append(nf[sec[j]])
   nllist.append(nl[sec[j]])
   if nf[sec[j]] > 0:
       nfrate.append(bangvol[j]*1000/nf[sec[j]])
   else:
       nfrate.append(0)

print "按照封单跟流通股本比例排序,剔除6月上市新股,前50"
df_uplimit1 = pd.DataFrame({'简称': name, '代码': sec, '前收': precls, '最新价': latprx,'封单量': bangvol, '封单金额(万)': bang, '总流通股本': tuple(nflist), '封单总股本比(‰)': tuple(nfrate),'listDate': tuple(nllist)}).sort(columns='封单总股本比(‰)',ascending=False).reset_index()
df_uplimit1 = df_uplimit1.loc[:, ['简称', '代码','前收','最新价','封单量','封单金额(万)','总流通股本','封单总股本比(‰)','listDate']]
df_uplimit1[df_uplimit1.listDate < '2015-06'][:50]

按照封单跟流通股本比例排序,剔除6月上市新股,前50
简称代码前收最新价封单量封单金额(万)总流通股本封单总股本比(‰)listDate
4山河药辅300452.XSHE46.6251.2812310626312.885936116000001062015-05-15
5浩物股份000757.XSHE7.438.173024946224713.810454312802683961997-06-27
7康斯特300445.XSHE58.5364.388994395790.58828210200000882015-04-24
14三变科技002112.XSHE9.6310.591303985513809.206445180956458722007-02-08
17石大胜华603026.XSHG15.0916.6034222225680.88852050680000672015-05-29
18三毛派神000779.XSHE9.9310.921259317013751.741640186441020671997-05-28
22威帝股份603023.XSHG31.0634.1712924994416.46908320000000642015-05-27
23普丽盛300442.XSHE40.0944.1015875757001.20575025000000632015-04-24
27立霸股份603519.XSHG45.1749.6912173756049.13637520000000602015-03-19
33道氏技术300409.XSHE39.3443.2713486895835.77730324375000552014-12-03
35金石东方300434.XSHE35.0438.549137003521.39980017000000532015-04-24
37苏试试验300416.XSHE45.2749.808319294143.00642015700000522015-01-22
38南华仪器300417.XSHE48.1652.985318262817.61414810200000522015-01-23
39美尔雅600107.XSHG7.828.601864446616034.240760360000000511997-11-06
40海联讯300277.XSHE15.2516.7826787474494.93746652903291502011-11-23
41华铁科技603300.XSHG16.8118.4925357704688.63873050670000502015-05-29
42先导股份300450.XSHE84.4592.908352007759.00800017000000492015-05-18
45亚星客车600213.XSHG7.137.84103998098153.450256220000000471999-08-31
47鲍斯股份300441.XSHE31.5534.719722503374.67975021120000462015-04-23
49盛洋科技603703.XSHG30.0333.0310372293425.96738723000000452015-04-23
50中光防雷300414.XSHE50.4655.519104135053.70256321070000432015-05-13
51清水源300437.XSHE47.3052.037276113785.76003316700000432015-04-23
52博通股份600455.XSHG26.2128.8321311356144.06220549717768422004-03-29
53川仪股份603100.XSHG13.0414.3442336926071.114328100000000422014-08-05
54永东股份002753.XSHE26.6429.3010189012985.37993024700000412015-05-19
55华天酒店000428.XSHE5.956.552940913719262.984735718762425401996-08-08
60惠天热电000692.XSHE5.235.752021559811623.968850532788880371997-02-27
61全信股份300447.XSHE50.2255.247676004240.22240020250000372015-04-22
62康跃科技300391.XSHE14.6916.1614975002419.96000041675000352014-08-01
63莫高股份600543.XSHG8.199.011123596910123.608069321120000342004-03-24
64宝色股份300402.XSHE12.6113.8717622862444.29068251000000342014-10-10
65金龙汽车600686.XSHG14.4215.861515435724034.810202442597097341993-11-08
66大唐电信600198.XSHG19.8821.871785614939051.397863532989392331998-10-21
67山东华鹏603021.XSHG26.6429.308825652585.91545026400000332015-04-23
68高能环境603588.XSHG42.3146.5412968516035.54455440400000322014-12-29
69三鑫医疗300453.XSHE35.2338.756493892516.38237519860000322015-05-15
70中来股份300393.XSHE40.4544.507592453378.64025023490000322014-09-12
71仙坛股份002746.XSHE15.2116.7313109862193.27957839850000322015-02-16
73济民制药603222.XSHG17.8919.6813021742562.67843240000000322015-02-17
74兰州黄河000929.XSHE14.6916.1660885609839.112960185588036321999-06-23
75迅游科技300467.XSHE176.12193.733285746365.46410210000000322015-05-27
76北京城乡600861.XSHG10.2211.241007283511321.866540316804949311994-05-20
77中泰股份300435.XSHE34.9438.436219822390.27682620000000312015-03-26
78轴研科技002046.XSHE7.858.64104969249069.342336340565970302005-05-26
79四通新材300428.XSHE34.4137.856096002307.33600020200000302015-03-19
80田中精机300461.XSHE29.9632.965100401681.09184016680000302015-05-19
81运达科技300440.XSHE42.5446.798470503963.34695028000000302015-04-23
83迈克生物300463.XSHE57.5163.2611407887216.62488837500000302015-05-28
84华通医药002758.XSHE38.6442.504294001824.95000014000000302015-05-27
86鼎泰新材002352.XSHE27.6630.4315206004627.18580049194459302010-02-05

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

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

发布评论

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