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

添加同花顺股东持股变动函数 #5295

Merged
merged 3 commits into from
Nov 2, 2024
Merged
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
1 change: 1 addition & 0 deletions akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3204,6 +3204,7 @@
stock_financial_debt_ths,
stock_financial_benefit_ths,
stock_financial_cash_ths,
stock_shareholder_change_ths,
)

"""
Expand Down
43 changes: 43 additions & 0 deletions akshare/stock_fundamental/stock_finance_ths.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,46 @@ def stock_financial_cash_ths(
return temp_df


def stock_shareholder_change_ths(
symbol: str = "688981"
) -> pd.DataFrame:
"""
同花顺-公司大事-股东持股变动
https://basic.10jqka.com.cn/new/688981/event.html
:param symbol: 股票代码
:type symbol: str
:return: 同花顺-财务指标-主要指标
:rtype: pandas.DataFrame
"""
url = f"https://basic.10jqka.com.cn/new/{symbol}/event.html"

headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/109.0.0.0 Safari/537.36"
}
r = requests.get(url, headers=headers)
r.encoding = 'gb2312'
soup = BeautifulSoup(r.text, features="lxml")

soup_find = soup.find("table", attrs={"class": "m_table data_table_1 m_hl"})

if soup_find is not None:
content_list = [item.text.strip() for item in soup_find]
column_names = content_list[1].split("\n")
row = content_list[3].replace("\t", "").replace("\n\n", "").replace(" ", "\n").replace(" ", "").replace("\n\n", "\n").split("\n")
row = [item for item in row if item!=""]

new_rows = []
step = len(column_names)
for i in range(0, len(row), step):
new_rows.append(row[i : i + step])

df = pd.DataFrame(new_rows, columns=column_names)

return df
return pd.DataFrame()


if __name__ == "__main__":
stock_financial_abstract_ths_df = stock_financial_abstract_ths(
symbol="000063", indicator="按报告期"
Expand Down Expand Up @@ -237,3 +277,6 @@ def stock_financial_cash_ths(
symbol="000063", indicator="按单季度"
)
print(stock_financial_cash_ths_df)

stock_shareholder_change_ths_df = stock_shareholder_change_ths()
print(stock_shareholder_change_ths_df)
60 changes: 60 additions & 0 deletions docs/data/stock/stock.md
Original file line number Diff line number Diff line change
Expand Up @@ -11998,6 +11998,66 @@ print(stock_gdfx_holding_change_em_df)
33900 33901 ... 000761|本钢板材,200761|本钢板B
```

#### 股东持股变动统计

接口: stock_shareholder_change_ths

目标地址: https://basic.10jqka.com.cn/new/688981/event.html

描述: 同花顺-公司大事-股东持股变动

限量: 单次返回所有数据

输入参数

| 名称 | 类型 | 描述 |
|--------|-----|-----------------------|
| symbol | str | symbol="601919"; 股票代码 |

输出参数

| 名称 | 类型 | 描述 |
|-----------|--------|-----|
| 公告日期 | object | - |
| 变动股东 | object | - |
| 变动数量(股) | object | - |
| 交易均价(元) | object | - |
| 剩余股份总数(股) | object | - |
| 变动期间 | object | - |
| 变动途径 | object | - |

接口示例

```python
import akshare as ak

stock_shareholder_change_ths_df = ak.stock_shareholder_change_ths(symbol="20210930")
print(stock_shareholder_change_ths_df)
```

数据示例

```
公告日期 变动股东 变动数量(股) 交易均价(元) 剩余股份总数(股) 变动期间 变动途径
0 2023-03-14 中国远洋海运集团有限公司 增持1.06亿 未披露 7.05亿 2022.07.01-2023.03.10 二级市场
1 2022-07-22 中国远洋海运集团有限公司 增持160.00万 未披露 14.04亿 2022.06.13-2022.06.30 二级市场
2 2022-06-11 中国远洋海运集团有限公司 增持726.74万 未披露 14.02亿 2022.05.23-2022.06.10 二级市场
3 2022-05-21 中国远洋海运集团有限公司 增持50.00万 未披露 13.95亿 2022.05.20-2022.05.20 二级市场
4 2022-04-19 中国远洋海运集团有限公司 增持2084.39万 未披露 13.94亿 2021.10.27-2022.04.15 二级市场
5 2022-01-29 叶建平 减持6.06万 18.7432 18.21万 2022.01.04-2022.01.28 二级市场
6 2022-01-29 张铭文 减持6.06万 18.9572 18.21万 2022.01.04-2022.01.28 二级市场
7 2022-01-29 陈帅 减持6.06万 19.4121 18.21万 2022.01.04-2022.01.28 二级市场
8 2022-01-29 郭华伟 减持4.61万 18.7432 13.83万 2022.01.04-2022.01.28 二级市场
9 2022-01-01 叶建平 减持8.08万 18.7025 24.27万 2021.12.09-2021.12.31 二级市场
10 2022-01-01 张铭文 减持8.08万 19.1396 24.27万 2021.12.09-2021.12.31 二级市场
11 2022-01-01 陈帅 减持8.08万 18.6091 24.27万 2021.12.09-2021.12.31 二级市场
12 2022-01-01 郭华伟 减持6.14万 18.6977 18.44万 2021.12.09-2021.12.31 二级市场
13 2021-10-27 中国远洋海运集团有限公司 增持3750.00万 未披露 13.74亿 2021.10.19-2021.10.26 二级市场
14 2021-10-19 中国远洋海运集团有限公司 增持790.00万 未披露 13.36亿 2021.10.18-2021.10.18 二级市场
15 2017-07-10 宋莉美 减持1.00万 5.6400 未披露 2016.11.16-2017.05.16
16 二级市场 2016-05-31 郝文义 减持2.00万 5.9300 0.00
```

#### 股东持股分析-十大流通股东

接口: stock_gdfx_free_holding_analyse_em
Expand Down