~~爬取北交所新股申购信息~~
本帖最后由 老冉 于 2021-12-22 22:28 编辑import requests
import json
import time
import re
import pandas as pd
def bce_all():
url = 'http://www.bse.cn/newShareController/infoResult.do?callback=jQuery331_' + str(int(time.time() * 1000))
headers = {
"Referer": "http: //www.bse.cn/newshare/listofissues.html",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
}
form = [
("statetypes[]", "0"),
("page", "0"),
("companyCode", ''),
("isNewThree", "1"),
("sortfield", "purchaseDate"),
("sorttype", "desc"),
("keyword", ''),
("needFields[]", "id"),
("needFields[]", "stockCode"),
("needFields[]", "stockName"),
("needFields[]", "initialIssueAmount"),
("needFields[]", "enquiryType"),
("needFields[]", "issuePrice"),
("needFields[]", "peRatio"),
("needFields[]", "purchaseDate"),
("needFields[]", "issueResultDate"),
("needFields[]", "enterPremiumDate"),
]
response = requests.post(url, headers=headers, data=form)
a = re.findall(r'\[{.*}\]', response.text)
if a:
b = json.loads(a)['listInfo']['content']
data = []
for x in b:
if x['enterPremiumDate']:
data.append({"代码": x['stockCode'],
"简称": x['stockName'],
"发行量": x['initialIssueAmount'],
"发行价格": x['issuePrice'],
"市盈率": x['peRatio'],
"申购日": time.strftime("%Y-%m-%d", time.localtime(x['purchaseDate']['time'] / 1000)),
"上市日": time.strftime("%Y-%m-%d", time.localtime(x['enterPremiumDate']['time'] / 1000)),
})
else:
data.append({"代码": x['stockCode'],
"简称": x['stockName'],
"发行量": x['initialIssueAmount'],
"发行价格": x['issuePrice'],
"市盈率": x['peRatio'],
"申购日": time.strftime("%Y-%m-%d", time.localtime(x['purchaseDate']['time'] / 1000)),
"上市日": '------',
})
else:
print('bad')
return data
if __name__ == '__main__':
pd.set_option('display.unicode.ambiguous_as_wide', True)
pd.set_option('display.unicode.east_asian_width', True)
data = pd.DataFrame(bce_all()[:10])
data
代码 简称 发行量发行价格市盈率 申购日 上市日
0871245威博液压 8478261 9.68 18.592021-12-22 ------
1836720吉冈精密21030000 10.50 21.672021-11-032021-11-24
2836260中寰股份 8500000 13.45 16.002021-11-012021-11-15
3871981晶赛科技11878300 18.32 28.412021-10-262021-11-15
4831832科达自控18000000 13.00 45.342021-10-262021-11-15
5833454同心传动25000000 3.95 14.902021-10-182021-11-15
6870436大地电气18000000 8.68 13.212021-10-182021-11-15
7832171志晟信息14530435 6.80 10.932021-10-152021-11-15
8833873中设咨询33380000 4.50 27.282021-10-152021-11-15
9832089禾昌聚合20000000 10.00 16.392021-10-112021-11-09 哈哈哈 厉害 挺棒的! 非常的棒:victory: 楼主好人,支持楼主分享{:17_1082:} 大哥,能不能弄个爬股票的净利润,资产历年的资料,做成的财报分析PPT
页:
[1]