通过同花顺和集思录获取新股和新债券申购的信息;
# -*- coding: utf8 -*-
import requests
import json
request_params = {"headers": {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"},"timeout": 10}
def get_today_bonds():
r = requests.get("http://data.hexin.cn/ipo/bond/cate/info/",**request_params)
for bond in r.json():
print(f"{bond['zqName']}: 申购日期:{bond['sgDate']}")
if bond['today'] == bond['sgDate']:
text = f"""今日打新: {bond['zqName']} 发行量{bond['issue']}亿"""
print(text)
#send_msg(text)
def get_today_xgsgzq():
r = requests.get("https://www.jisilu.cn/data/new_stock/apply/?___jsl=LST___t=",**request_params)
jsonstr = json.loads(r.text) #json解析响应文本
#print(jsonstr['rows'][0])
#for bond in r.json():
for bond in jsonstr['rows']:
tempstr1= bond['cell']['stock_cd']+ ' '
tempstr1=tempstr1+bond['cell']['stock_nm']+ ' '
if bond['cell']['apply_dt'][0:5] == '<span' :
tempstr1=tempstr1+bond['cell']['apply_dt'][33:42]+ ' '
else:
tempstr1=tempstr1+bond['cell']['apply_dt']+ ' '
if bond['cell']['apply_dt'][0:5] == '<span' :
tempstr1=tempstr1+bond['cell']['apply_cd'][33:39]+ ' '
else:
tempstr1=tempstr1+bond['cell']['apply_cd']+ ' '
print(tempstr1)
#print((bond['id']))
def send_msg(text):
r = requests.post('', json={"msgtype": "text","text": {
"content": text}}, **request_params)
#告诉自己
get_today_bonds()
#get_today_xgsgzq()