Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #5317

Merged
merged 3 commits into from
Nov 8, 2024
Merged

Dev #5317

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2927,9 +2927,10 @@
1.15.15 add: add macro_bank_china_interest_rate indicator
1.15.16 fix: fix macro_bank_usa_interest_rate indicator
1.15.17 fix: fix news_trade_notify_dividend_baidu indicator
1.15.18 fix: fix stock_share_hold_change_sse indicator
"""

__version__ = "1.15.17"
__version__ = "1.15.18"
__author__ = "AKFamily"

import sys
Expand Down
36 changes: 22 additions & 14 deletions akshare/stock/stock_share_hold.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2023/8/23 8:30
Date: 2024/11/8 17:00
Desc: 董监高及相关人员持股变动

北京证券交易所-信息披露-监管信息-董监高及相关人员持股变动
https://www.bse.cn/disclosure/djg_sharehold_change.html

深圳证券交易所-信息披露-监管信息公开-董监高人员股份变动
http://www.szse.cn/disclosure/supervision/change/index.html
https://www.szse.cn/disclosure/supervision/change/index.html

上海证券交易所-披露-监管信息公开-公司监管-董董监高人员股份变动
http://www.sse.com.cn/disclosure/credibility/supervision/change/
https://www.sse.com.cn/disclosure/credibility/supervision/change/
"""

import json

import pandas as pd
Expand All @@ -23,13 +24,13 @@
def stock_share_hold_change_sse(symbol: str = "600000") -> pd.DataFrame:
"""
上海证券交易所-披露-监管信息公开-公司监管-董董监高人员股份变动
http://www.sse.com.cn/disclosure/credibility/supervision/change/
https://www.sse.com.cn/disclosure/credibility/supervision/change/
:param symbol: choice of {"全部", "具体股票代码"}
:type symbol: str
:return: 董监高人员股份变动
:rtype: pandas.DataFrame
"""
url = "http://query.sse.com.cn/commonQuery.do"
url = "https://query.sse.com.cn/commonQuery.do"
params = {
"isPagination": "true",
"pageHelp.pageSize": "100",
Expand All @@ -48,8 +49,9 @@ def stock_share_hold_change_sse(symbol: str = "600000") -> pd.DataFrame:
params if symbol == "全部" else params.update({"COMPANY_CODE": symbol})
headers = {
"Host": "query.sse.com.cn",
"Referer": "http://www.sse.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"Referer": "https://www.sse.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/93.0.4577.63 Safari/537.36",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
Expand Down Expand Up @@ -106,17 +108,21 @@ def stock_share_hold_change_sse(symbol: str = "600000") -> pd.DataFrame:
big_df["变动日期"] = pd.to_datetime(big_df["变动日期"], errors="coerce").dt.date
big_df["填报日期"] = pd.to_datetime(big_df["填报日期"], errors="coerce").dt.date

big_df["本次变动前持股数"] = pd.to_numeric(big_df["本次变动前持股数"], errors="coerce")
big_df["本次变动前持股数"] = pd.to_numeric(
big_df["本次变动前持股数"], errors="coerce"
)
big_df["变动数"] = pd.to_numeric(big_df["变动数"], errors="coerce")
big_df["本次变动平均价格"] = pd.to_numeric(big_df["本次变动平均价格"], errors="coerce")
big_df["本次变动平均价格"] = pd.to_numeric(
big_df["本次变动平均价格"], errors="coerce"
)
big_df["变动后持股数"] = pd.to_numeric(big_df["变动后持股数"], errors="coerce")
return big_df


def stock_share_hold_change_szse(symbol: str = "全部") -> pd.DataFrame:
"""
深圳证券交易所-信息披露-监管信息公开-董监高人员股份变动
http://www.szse.cn/disclosure/supervision/change/index.html
https://www.szse.cn/disclosure/supervision/change/index.html
:param symbol: choice of {"全部", "具体股票代码"}
:type symbol: str
:return: 董监高人员股份变动
Expand All @@ -130,15 +136,16 @@ def stock_share_hold_change_szse(symbol: str = "全部") -> pd.DataFrame:
"random": "0.7874198771222201",
}
params if symbol == "全部" else params.update({"txtDMorJC": symbol})
url = "http://www.szse.cn/api/report/ShowReport/data"
url = "https://www.szse.cn/api/report/ShowReport/data"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/93.0.4577.63 Safari/537.36",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
total_page = data_json[0]["metadata"]["pagecount"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page+1), leave=False):
for page in tqdm(range(1, total_page + 1), leave=False):
params.update(
{
"PAGENO": page,
Expand Down Expand Up @@ -212,7 +219,8 @@ def stock_share_hold_change_bse(symbol: str = "430489") -> pd.DataFrame:
}
url = "https://www.bse.cn/djgCgbdController/getDjgCgbdList.do"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/93.0.4577.63 Safari/537.36",
}
r = requests.get(url, headers=headers, params=params)
data_text = r.text
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@

## 更新说明详情

1.15.18 fix: fix stock_share_hold_change_sse indicator

1. 修复 stock_share_hold_change_sse 接口

1.15.17 fix: fix news_trade_notify_dividend_baidu indicator

1. 修复 news_trade_notify_dividend_baidu 接口
Expand Down Expand Up @@ -4726,6 +4730,8 @@

## 版本更新说明

1.15.18 fix: fix stock_share_hold_change_sse indicator

1.15.17 fix: fix news_trade_notify_dividend_baidu indicator

1.15.16 fix: fix macro_bank_usa_interest_rate indicator
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**风险提示**:[AKShare](https://github.com/akfamily/akshare) 开源财经数据接口库所采集的数据皆来自公开的数据源,不涉及任何个人隐私数据和非公开数据。
同时本项目提供的数据接口及相关数据仅用于学术研究,任何个人、机构及团体使用本项目的数据接口及相关数据请注意商业风险。

1. 本文档更新时间:**2024-11-07**;
1. 本文档更新时间:**2024-11-08**;
2. 如有 [AKShare](https://github.com/akfamily/akshare) 库、文档及数据的相关问题,请在 [AKShare Issues](https://github.com/akfamily/akshare/issues) 中提 Issues;
3. 欢迎关注 **数据科学实战** 微信公众号;<div><img src="https://jfds-1252952517.cos.ap-chengdu.myqcloud.com/akshare/readme/qrcode/ds.png"></div>
4. **知识星球【数据科学实战】** 2024 全新改版,聚焦于量化投资内容,欢迎加入 **知识星球【数据科学实战】** 高质量社区,里面有丰富的视频课程、问答、文章、书籍及代码等内容:
Expand Down