Skip to content

Commit

Permalink
Date (#4352)
Browse files Browse the repository at this point in the history
* update date

* update email

* add version 1.11.98

* fix stock_zh_a_disclosure_report_cninfo
  • Loading branch information
albertandking authored Dec 19, 2023
1 parent 6bc7b75 commit f172a35
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 63 deletions.
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
3 changes: 2 additions & 1 deletion akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2611,9 +2611,10 @@
1.11.95 fix: fix fund_etf_hist_min_em interface
1.11.96 fix: fix fund_rating_all interface
1.11.97 add: add stock_zh_a_disclosure_report_cninfo interface
1.11.98 fix: fix stock_zh_a_disclosure_report_cninfo interface
"""

__version__ = "1.11.97"
__version__ = "1.11.98"
__author__ = "AKFamily"

import sys
Expand Down
92 changes: 79 additions & 13 deletions akshare/stock_feature/stock_disclosure_cninfo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2023/12/18 17:00
Date: 2023/12/19 18:00
Desc: 巨潮资讯-首页-公告查询-信息披露
http://www.cninfo.com.cn/new/commonUrl/pageOfSearch?url=disclosure/list/search
"""
Expand All @@ -14,8 +14,53 @@
from akshare.utils.tqdm import get_tqdm


@lru_cache()
def __get_category_dict() -> dict:
"""
获取巨潮资讯-首页-公告查询-信息披露-类别字典
http://www.cninfo.com.cn/new/js/app/disclosure/notice/history-notice.js?v=20231124083101
:return: dict
:rtype: dict
"""
big_dict = {'年报': 'category_ndbg_szsh',
'半年报': 'category_bndbg_szsh',
'一季报': 'category_yjdbg_szsh',
'三季报': 'category_sjdbg_szsh',
'业绩预告': 'category_yjygjxz_szsh',
'权益分派': 'category_qyfpxzcs_szsh',
'董事会': 'category_dshgg_szsh',
'监事会': 'category_jshgg_szsh',
'股东大会': 'category_gddh_szsh',
'日常经营': 'category_rcjy_szsh',
'公司治理': 'category_gszl_szsh',
'中介报告': 'category_zj_szsh',
'首发': 'category_sf_szsh',
'增发': 'category_zf_szsh',
'股权激励': 'category_gqjl_szsh',
'配股': 'category_pg_szsh',
'解禁': 'category_jj_szsh',
'公司债': 'category_gszq_szsh',
'可转债': 'category_kzzq_szsh',
'其他融资': 'category_qtrz_szsh',
'股权变动': 'category_gqbd_szsh',
'补充更正': 'category_bcgz_szsh',
'澄清致歉': 'category_cqdq_szsh',
'风险提示': 'category_fxts_szsh',
'特别处理和退市': 'category_tbclts_szsh',
'退市整理期': 'category_tszlq_szsh'
}
return big_dict


@lru_cache()
def __get_stock_json(symbol: str = "沪深京") -> dict:
"""
获取巨潮资讯-首页-公告查询-信息披露-股票代码字典
:param symbol: choice of {"沪深京", "港股", "三板", "基金", "债券"}
:type symbol: str
:return: 股票代码字典
:rtype: dict
"""
url = "http://www.cninfo.com.cn/new/data/szse_stock.json"
if symbol == "沪深京":
url = "http://www.cninfo.com.cn/new/data/szse_stock.json"
Expand All @@ -34,7 +79,11 @@ def __get_stock_json(symbol: str = "沪深京") -> dict:


def stock_zh_a_disclosure_report_cninfo(
symbol: str = "000001", market: str = "沪深京", start_date: str = "20230618", end_date: str = "20231219"
symbol: str = "000001",
market: str = "沪深京",
category: str = "",
start_date: str = "20230618",
end_date: str = "20231219"
) -> pd.DataFrame:
"""
巨潮资讯-首页-公告查询-信息披露公告
Expand All @@ -43,6 +92,8 @@ def stock_zh_a_disclosure_report_cninfo(
:type symbol: str
:param market: choice of {"沪深京", "港股", "三板", "基金", "债券", "监管", "预披露"}
:type market: str
:param category: choice of {'年报', '半年报', '一季报', '三季报', '业绩预告', '权益分派', '董事会', '监事会', '股东大会', '日常经营', '公司治理', '中介报告', '首发', '增发', '股权激励', '配股', '解禁', '公司债', '可转债', '其他融资', '股权变动', '补充更正', '澄清致歉', '风险提示', '特别处理和退市', '退市整理期'}
:type category: str
:param start_date: 开始时间
:type start_date: str
:param end_date: 开始时间
Expand All @@ -61,17 +112,20 @@ def stock_zh_a_disclosure_report_cninfo(
}
if market == "沪深京":
stock_id_map = __get_stock_json(symbol)
category_dict = __get_category_dict()
url = "http://www.cninfo.com.cn/new/hisAnnouncement/query"
stock_item = "" if symbol == "" else f"{symbol},{stock_id_map[symbol]}"
category_item = "" if category == "" else f"{category_dict[category]}"
payload = {
'pageNum': '1',
'pageSize': '30',
'column': column_map[market],
'tabName': 'fulltext',
'plate': '',
'stock': f'{symbol},{stock_id_map[symbol]}',
'stock': stock_item,
'searchkey': '',
'secid': '',
'category': '',
'category': category_item,
'trade': '',
'seDate': f'{"-".join([start_date[:4], start_date[4:6], start_date[6:]])}~{"-".join([end_date[:4], end_date[4:6], end_date[6:]])}',
'sortName': '',
Expand All @@ -94,11 +148,16 @@ def stock_zh_a_disclosure_report_cninfo(
"secName": "简称",
"announcementTitle": "公告标题",
"announcementTime": "公告时间",
"adjunctUrl": "公告链接",
}, inplace=True)
big_df = big_df[["代码", "简称", "公告标题", "公告时间", "公告链接"]]
big_df = big_df[["代码", "简称", "公告标题", "公告时间", 'announcementId', 'orgId']]
big_df['公告时间'] = pd.to_datetime(big_df['公告时间'], unit="ms", utc=True, errors="coerce")
big_df['公告时间'] = big_df['公告时间'].dt.tz_convert('Asia/Shanghai').dt.date
url_list = []
for item in zip(big_df['代码'], big_df['announcementId'], big_df['orgId'], big_df['公告时间']):
url_format = f"http://www.cninfo.com.cn/new/disclosure/detail?stockCode={item[0]}&announcementId={item[1]}&orgId={item[2]}&announcementTime={item[3]}"
url_list.append(url_format)
big_df['公告链接'] = url_list
big_df = big_df[["代码", "简称", "公告标题", "公告时间", "公告链接"]]
return big_df


Expand Down Expand Up @@ -130,14 +189,15 @@ def stock_zh_a_disclosure_relation_cninfo(
}
if market == "沪深京":
stock_id_map = __get_stock_json(symbol)
stock_item = "" if symbol == "" else f"{symbol},{stock_id_map[symbol]}"
url = "http://www.cninfo.com.cn/new/hisAnnouncement/query"
payload = {
'pageNum': '1',
'pageSize': '30',
'column': column_map[market],
'tabName': 'relation',
'plate': '',
'stock': f'{symbol},{stock_id_map[symbol]}',
'stock': stock_item,
'searchkey': '',
'secid': '',
'category': '',
Expand All @@ -163,25 +223,31 @@ def stock_zh_a_disclosure_relation_cninfo(
"secName": "简称",
"announcementTitle": "公告标题",
"announcementTime": "公告时间",
"adjunctUrl": "公告链接",
}, inplace=True)
big_df = big_df[["代码", "简称", "公告标题", "公告时间", "公告链接"]]
big_df = big_df[["代码", "简称", "公告标题", "公告时间", 'announcementId', 'orgId']]
big_df['公告时间'] = pd.to_datetime(big_df['公告时间'], unit="ms", utc=True, errors="coerce")
big_df['公告时间'] = big_df['公告时间'].dt.tz_convert('Asia/Shanghai').dt.date
url_list = []
for item in zip(big_df['代码'], big_df['announcementId'], big_df['orgId'], big_df['公告时间']):
url_format = f"http://www.cninfo.com.cn/new/disclosure/detail?stockCode={item[0]}&announcementId={item[1]}&orgId={item[2]}&announcementTime={item[3]}"
url_list.append(url_format)
big_df['公告链接'] = url_list
big_df = big_df[["代码", "简称", "公告标题", "公告时间", "公告链接"]]
return big_df


if __name__ == "__main__":
stock_zh_a_disclosure_report_cninfo_df = stock_zh_a_disclosure_report_cninfo(
symbol="000001",
market="沪深京",
start_date="20230618",
end_date="20231219")
category="公司治理",
start_date="20230619",
end_date="20231220")
print(stock_zh_a_disclosure_report_cninfo_df)

stock_zh_a_disclosure_relation_cninfo_df = stock_zh_a_disclosure_relation_cninfo(
symbol="000001",
market="沪深京",
start_date="20230618",
end_date="20231219")
start_date="20231201",
end_date="20231220")
print(stock_zh_a_disclosure_relation_cninfo_df)
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@

## 更新说明详情

1.11.98 fix: fix stock_zh_a_disclosure_report_cninfo interface

1. 修复 stock_zh_a_disclosure_report_cninfo 接口

1.11.97 add: add stock_zh_a_disclosure_report_cninfo interface

1. 新增 stock_zh_a_disclosure_report_cninfo 接口
Expand Down Expand Up @@ -3253,6 +3257,8 @@

## 版本更新说明

1.11.98 fix: fix stock_zh_a_disclosure_report_cninfo interface

1.11.97 add: add stock_zh_a_disclosure_report_cninfo interface

1.11.96 fix: fix fund_rating_all interface
Expand Down
63 changes: 16 additions & 47 deletions docs/data/stock/stock.md
Original file line number Diff line number Diff line change
Expand Up @@ -7838,12 +7838,13 @@ print(stock_report_disclosure_df)

输入参数

| 名称 | 类型 | 描述 |
|------------|-----|----------------------------------------------------------------------|
| symbol | str | symbol="000001"; 股票代码 |
| market | str | market="沪深京"; choice of {"沪深京", "港股", "三板", "基金", "债券", "监管", "预披露"} |
| start_date | str | start_date="20230618" |
| end_date | str | end_date="20231219" |
| 名称 | 类型 | 描述 |
|------------|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| symbol | str | symbol="000001"; 股票代码 |
| market | str | market="沪深京"; choice of {"沪深京", "港股", "三板", "基金", "债券", "监管", "预披露"} |
| category | str | category=""; choice of {'年报', '半年报', '一季报', '三季报', '业绩预告', '权益分派', '董事会', '监事会', '股东大会', '日常经营', '公司治理', '中介报告', '首发', '增发', '股权激励', '配股', '解禁', '公司债', '可转债', '其他融资', '股权变动', '补充更正', '澄清致歉', '风险提示', '特别处理和退市', '退市整理期'} |
| start_date | str | start_date="20230618" |
| end_date | str | end_date="20231219" |

输出参数

Expand All @@ -7860,53 +7861,21 @@ print(stock_report_disclosure_df)
```python
import akshare as ak

stock_zh_a_disclosure_report_cninfo_df = ak.stock_zh_a_disclosure_report_cninfo(symbol="000001", market="沪深京", start_date="20230618", end_date="20231219")
stock_zh_a_disclosure_report_cninfo_df = ak.stock_zh_a_disclosure_report_cninfo(symbol="000001", market="沪深京", category="公司治理", start_date="20230619", end_date="20231220")
print(stock_zh_a_disclosure_report_cninfo_df)
```

数据示例

```
代码 简称 ... 公告时间 公告链接
0 000001 平安银行 ... 2023-12-09 finalpage/2023-12-09/1218563079.PDF
1 000001 平安银行 ... 2023-12-09 finalpage/2023-12-09/1218563078.PDF
2 000001 平安银行 ... 2023-12-09 finalpage/2023-12-09/1218563077.PDF
3 000001 平安银行 ... 2023-12-09 finalpage/2023-12-09/1218563076.PDF
4 000001 平安银行 ... 2023-12-09 finalpage/2023-12-09/1218563075.PDF
5 000001 平安银行 ... 2023-11-28 finalpage/2023-11-28/1218453595.PDF
6 000001 平安银行 ... 2023-11-21 finalpage/2023-11-21/1218380783.PDF
7 000001 平安银行 ... 2023-11-21 finalpage/2023-11-21/1218380782.PDF
8 000001 平安银行 ... 2023-11-21 finalpage/2023-11-21/1218380781.PDF
9 000001 平安银行 ... 2023-11-17 finalpage/2023-11-17/1218361768.PDF
10 000001 平安银行 ... 2023-11-15 finalpage/2023-11-15/1218329312.PDF
11 000001 平安银行 ... 2023-11-15 finalpage/2023-11-15/1218329309.PDF
12 000001 平安银行 ... 2023-10-25 finalpage/2023-10-25/1218135623.PDF
13 000001 平安银行 ... 2023-10-25 finalpage/2023-10-25/1218135622.PDF
14 000001 平安银行 ... 2023-10-25 finalpage/2023-10-25/1218135621.PDF
15 000001 平安银行 ... 2023-10-25 finalpage/2023-10-25/1218135620.PDF
16 000001 平安银行 ... 2023-10-25 finalpage/2023-10-25/1218135618.PDF
17 000001 平安银行 ... 2023-10-25 finalpage/2023-10-25/1218135616.PDF
18 000001 平安银行 ... 2023-10-25 finalpage/2023-10-25/1218135614.PDF
19 000001 平安银行 ... 2023-10-25 finalpage/2023-10-25/1218135612.PDF
20 000001 平安银行 ... 2023-10-17 finalpage/2023-10-17/1218047355.PDF
21 000001 平安银行 ... 2023-08-24 finalpage/2023-08-24/1217618653.PDF
22 000001 平安银行 ... 2023-08-24 finalpage/2023-08-24/1217617077.PDF
23 000001 平安银行 ... 2023-08-24 finalpage/2023-08-24/1217617076.PDF
24 000001 平安银行 ... 2023-08-24 finalpage/2023-08-24/1217617075.PDF
25 000001 平安银行 ... 2023-08-24 finalpage/2023-08-24/1217617074.PDF
26 000001 平安银行 ... 2023-08-24 finalpage/2023-08-24/1217617073.PDF
27 000001 平安银行 ... 2023-08-24 finalpage/2023-08-24/1217617072.PDF
28 000001 平安银行 ... 2023-08-24 finalpage/2023-08-24/1217617071.PDF
29 000001 平安银行 ... 2023-08-19 finalpage/2023-08-19/1217575487.PDF
30 000001 平安银行 ... 2023-08-05 finalpage/2023-08-05/1217468402.PDF
31 000001 平安银行 ... 2023-07-29 finalpage/2023-07-29/1217417270.PDF
32 000001 平安银行 ... 2023-07-29 finalpage/2023-07-29/1217417268.PDF
33 000001 平安银行 ... 2023-07-29 finalpage/2023-07-29/1217417266.PDF
34 000001 平安银行 ... 2023-07-25 finalpage/2023-07-25/1217375722.PDF
35 000001 平安银行 ... 2023-07-25 finalpage/2023-07-25/1217375721.PDF
36 000001 平安银行 ... 2023-06-27 finalpage/2023-06-27/1217139048.PDF
37 000001 平安银行 ... 2023-06-27 finalpage/2023-06-27/1217139047.PDF
[38 rows x 5 columns]
代码 简称 ... 公告时间 公告链接
0 000001 平安银行 ... 2023-12-09 http://www.cninfo.com.cn/new/disclosure/detail...
1 000001 平安银行 ... 2023-11-21 http://www.cninfo.com.cn/new/disclosure/detail...
2 000001 平安银行 ... 2023-10-25 http://www.cninfo.com.cn/new/disclosure/detail...
3 000001 平安银行 ... 2023-08-24 http://www.cninfo.com.cn/new/disclosure/detail...
4 000001 平安银行 ... 2023-07-29 http://www.cninfo.com.cn/new/disclosure/detail...
5 000001 平安银行 ... 2023-07-25 http://www.cninfo.com.cn/new/disclosure/detail...
[6 rows x 5 columns]
```

#### 信息披露调研-巨潮资讯
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. 本文档更新时间:**2023-12-18**
1. 本文档更新时间:**2023-12-19**
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. 如果您的问题未能在文档中找到答案,您也可以加入 **AKShare-VIP QQ 群**: 为了提高问答质量,此群为收费群(一杯咖啡钱即可入群,赠送[《AKShare-初阶-使用教学》](https://zmj.xet.tech/s/wck86)视频课),可以添加 **AKShare-小助手** QQ:1254836886,由小助手邀请入群! ![](https://jfds-1252952517.cos.ap-chengdu.myqcloud.com/akshare/readme/qrcode/qr_code_1254836886.jpg)
Expand Down

0 comments on commit f172a35

Please sign in to comment.