From d0c6d954497479739169ad2ab96c472c9711bcca Mon Sep 17 00:00:00 2001 From: jindaxiang Date: Thu, 9 Jan 2025 22:01:44 +0800 Subject: [PATCH 1/4] feat: add version 1.15.68 --- .../stock_feature/stock_research_report_em.py | 64 +++++++++++++------ docs/data/stock/stock.md | 30 +++++---- 2 files changed, 62 insertions(+), 32 deletions(-) diff --git a/akshare/stock_feature/stock_research_report_em.py b/akshare/stock_feature/stock_research_report_em.py index d29b356bff7..7dea70e6220 100644 --- a/akshare/stock_feature/stock_research_report_em.py +++ b/akshare/stock_feature/stock_research_report_em.py @@ -1,13 +1,15 @@ #!/usr/bin/env python # -*- coding:utf-8 -*- """ -Date: 2023/8/20 20:00 +Date: 2025/1/9 21:30 Desc: 东方财富网-数据中心-研究报告-个股研报 https://data.eastmoney.com/report/stock.jshtml """ + import pandas as pd import requests -from tqdm import tqdm + +from akshare.utils.tqdm import get_tqdm def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame: @@ -40,7 +42,9 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame: r = requests.get(url, params=params) data_json = r.json() total_page = data_json["TotalPage"] + current_year = data_json["currentYear"] big_df = pd.DataFrame() + tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update( { @@ -53,9 +57,15 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame: r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]) - big_df = pd.concat([big_df, temp_df], axis=0, ignore_index=True) + big_df = pd.concat(objs=[big_df, temp_df], axis=0, ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = big_df["index"] + 1 + predict_this_year_eps_title = f"{current_year}-盈利预测-收益" + predict_this_year_pe_title = f"{current_year}-盈利预测-市盈率" + predict_next_year_eps_title = f"{current_year + 1}-盈利预测-收益" + predict_next_year_pe_title = f"{current_year + 1}-盈利预测-市盈率" + predict_next_two_year_eps_title = f"{current_year + 2}-盈利预测-收益" + predict_next_two_year_pe_title = f"{current_year + 2}-盈利预测-市盈率" big_df.rename( columns={ "index": "序号", @@ -68,12 +78,12 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame: "publishDate": "日期", "infoCode": "-", "column": "-", - "predictNextTwoYearEps": "-", - "predictNextTwoYearPe": "-", - "predictNextYearEps": "2024-盈利预测-收益", - "predictNextYearPe": "2024-盈利预测-市盈率", - "predictThisYearEps": "2023-盈利预测-收益", - "predictThisYearPe": "2023-盈利预测-市盈率", + "predictNextTwoYearEps": predict_next_two_year_eps_title, + "predictNextTwoYearPe": predict_next_two_year_pe_title, + "predictNextYearEps": predict_next_year_eps_title, + "predictNextYearPe": predict_next_year_pe_title, + "predictThisYearEps": predict_this_year_eps_title, + "predictThisYearPe": predict_this_year_pe_title, "predictLastYearEps": "-", "predictLastYearPe": "-", "actualLastTwoYearEps": "-", @@ -122,20 +132,38 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame: "东财评级", "机构", "近一月个股研报数", - "2023-盈利预测-收益", - "2023-盈利预测-市盈率", - "2024-盈利预测-收益", - "2024-盈利预测-市盈率", + predict_this_year_eps_title, + predict_this_year_pe_title, + predict_next_year_eps_title, + predict_next_year_pe_title, + predict_next_two_year_eps_title, + predict_next_two_year_pe_title, "行业", "日期", ] ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date - big_df["近一月个股研报数"] = pd.to_numeric(big_df["近一月个股研报数"], errors="coerce") - big_df["2023-盈利预测-收益"] = pd.to_numeric(big_df["2023-盈利预测-收益"], errors="coerce") - big_df["2023-盈利预测-市盈率"] = pd.to_numeric(big_df["2023-盈利预测-市盈率"], errors="coerce") - big_df["2024-盈利预测-收益"] = pd.to_numeric(big_df["2024-盈利预测-收益"], errors="coerce") - big_df["2024-盈利预测-市盈率"] = pd.to_numeric(big_df["2024-盈利预测-市盈率"], errors="coerce") + big_df["近一月个股研报数"] = pd.to_numeric( + big_df["近一月个股研报数"], errors="coerce" + ) + big_df[predict_this_year_eps_title] = pd.to_numeric( + big_df[predict_this_year_eps_title], errors="coerce" + ) + big_df[predict_this_year_pe_title] = pd.to_numeric( + big_df[predict_this_year_pe_title], errors="coerce" + ) + big_df[predict_next_year_eps_title] = pd.to_numeric( + big_df[predict_next_year_eps_title], errors="coerce" + ) + big_df[predict_next_year_pe_title] = pd.to_numeric( + big_df[predict_next_year_pe_title], errors="coerce" + ) + big_df[predict_next_two_year_eps_title] = pd.to_numeric( + big_df[predict_next_two_year_eps_title], errors="coerce" + ) + big_df[predict_next_two_year_pe_title] = pd.to_numeric( + big_df[predict_next_two_year_pe_title], errors="coerce" + ) return big_df diff --git a/docs/data/stock/stock.md b/docs/data/stock/stock.md index 279b67a0ec1..2c84a6fb0d6 100644 --- a/docs/data/stock/stock.md +++ b/docs/data/stock/stock.md @@ -10320,10 +10320,12 @@ print(stock_zdhtmx_em_df) | 东财评级 | object | - | | 机构 | object | - | | 近一月个股研报数 | int64 | - | -| 2023-盈利预测-收益 | float64 | - | -| 2023-盈利预测-市盈率 | float64 | - | | 2024-盈利预测-收益 | float64 | - | | 2024-盈利预测-市盈率 | float64 | - | +| 2025-盈利预测-收益 | float64 | - | +| 2025-盈利预测-市盈率 | float64 | - | +| 2026-盈利预测-收益 | float64 | - | +| 2026-盈利预测-市盈率 | float64 | - | | 行业 | object | - | | 日期 | object | - | @@ -10339,19 +10341,19 @@ print(stock_research_report_em_df) 数据示例 ``` - 序号 股票代码 股票简称 ... 2024-盈利预测-市盈率 行业 日期 -0 1 000001 平安银行 ... 4.13 银行 2023-04-29 -1 2 000001 平安银行 ... 3.80 银行 2023-04-26 -2 3 000001 平安银行 ... 4.13 银行 2023-04-25 -3 4 000001 平安银行 ... 3.51 银行 2023-04-25 -4 5 000001 平安银行 ... 3.89 银行 2023-04-25 + 序号 股票代码 股票简称 ... 2026-盈利预测-市盈率 行业 日期 +0 1 000001 平安银行 ... 4.54 银行 2024-10-22 +1 2 000001 平安银行 ... 4.54 银行 2024-10-22 +2 3 000001 平安银行 ... 4.90 银行 2024-10-20 +3 4 000001 平安银行 ... NaN 银行 2024-10-19 +4 5 000001 平安银行 ... 3.90 银行 2024-08-30 .. ... ... ... ... ... .. ... -296 297 000001 平安银行 ... NaN 银行 2017-03-22 -297 298 000001 平安银行 ... NaN 银行 2017-03-20 -298 299 000001 平安银行 ... NaN 银行 2017-03-17 -299 300 000001 平安银行 ... NaN 银行 2017-03-07 -300 301 000001 平安银行 ... NaN 银行 2017-02-03 -[301 rows x 13 columns] +271 272 000001 平安银行 ... NaN 银行 2017-03-22 +272 273 000001 平安银行 ... NaN 银行 2017-03-20 +273 274 000001 平安银行 ... NaN 银行 2017-03-17 +274 275 000001 平安银行 ... NaN 银行 2017-03-07 +275 276 000001 平安银行 ... NaN 银行 2017-02-03 +[276 rows x 15 columns] ``` #### 沪深京 A 股公告 From 24edf961d95dfaaa2694ef24c8bb4a8ba45341df Mon Sep 17 00:00:00 2001 From: jindaxiang Date: Thu, 9 Jan 2025 22:01:57 +0800 Subject: [PATCH 2/4] docs: update date --- docs/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/introduction.md b/docs/introduction.md index af7aa05ebce..46a254c5fd5 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -6,7 +6,7 @@ **风险提示**:[AKShare](https://github.com/akfamily/akshare) 开源财经数据接口库所采集的数据皆来自公开的数据源,不涉及任何个人隐私数据和非公开数据。 同时本项目提供的数据接口及相关数据仅用于学术研究,任何个人、机构及团体使用本项目的数据接口及相关数据请注意商业风险。 -1. 本文档更新时间:**2025-01-08**; +1. 本文档更新时间:**2025-01-09**; 2. 如有 [AKShare](https://github.com/akfamily/akshare) 库、文档及数据的相关问题,请在 [AKShare Issues](https://github.com/akfamily/akshare/issues) 中提 Issues; 3. 欢迎关注 **数据科学实战** 微信公众号;
4. **知识星球【数据科学实战】** 2025 全新改版,聚焦于量化投资内容,欢迎加入 **知识星球【数据科学实战】** 高质量社区,里面有丰富的视频课程、问答、文章、书籍及代码等内容: From d9bea0b160220b9ee737fbcb355ef03f37e40646 Mon Sep 17 00:00:00 2001 From: jindaxiang Date: Thu, 9 Jan 2025 22:02:26 +0800 Subject: [PATCH 3/4] feat: add version 1.15.68 --- akshare/__init__.py | 3 ++- docs/changelog.md | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/akshare/__init__.py b/akshare/__init__.py index ce6c7e32941..dcc42df7e12 100644 --- a/akshare/__init__.py +++ b/akshare/__init__.py @@ -2977,9 +2977,10 @@ 1.15.65 fix: fix option_czce_daily interface 1.15.66 fix: fix fund_etf_dividend_sina interface 1.15.67 fix: fix stock_hold_change_cninfo interface +1.15.68 fix: fix stock_research_report_em interface """ -__version__ = "1.15.67" +__version__ = "1.15.68" __author__ = "AKFamily" import sys diff --git a/docs/changelog.md b/docs/changelog.md index c0144935dd8..acb6e134ef5 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -80,6 +80,10 @@ ## 更新说明详情 +1.15.68 fix: fix stock_research_report_em interface + + 1. 修复 stock_research_report_em 接口 + 1.15.67 fix: fix stock_hold_change_cninfo interface 1. 修复 stock_hold_change_cninfo 接口 @@ -4957,6 +4961,8 @@ ## 版本更新说明 +1.15.68 fix: fix stock_research_report_em interface + 1.15.67 fix: fix stock_hold_change_cninfo interface 1.15.66 fix: fix fund_etf_dividend_sina interface From 68862241206404c68ca8eecda6f20f1e9a53619c Mon Sep 17 00:00:00 2001 From: jindaxiang Date: Thu, 9 Jan 2025 22:03:17 +0800 Subject: [PATCH 4/4] fix: fix stock_research_report_em --- akshare/stock_feature/stock_research_report_em.py | 2 +- docs/data/stock/stock.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/akshare/stock_feature/stock_research_report_em.py b/akshare/stock_feature/stock_research_report_em.py index 7dea70e6220..75ce5456276 100644 --- a/akshare/stock_feature/stock_research_report_em.py +++ b/akshare/stock_feature/stock_research_report_em.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding:utf-8 -*- """ -Date: 2025/1/9 21:30 +Date: 2025/1/9 21:35 Desc: 东方财富网-数据中心-研究报告-个股研报 https://data.eastmoney.com/report/stock.jshtml """ diff --git a/docs/data/stock/stock.md b/docs/data/stock/stock.md index 2c84a6fb0d6..2edb630512e 100644 --- a/docs/data/stock/stock.md +++ b/docs/data/stock/stock.md @@ -10278,7 +10278,7 @@ print(stock_zdhtmx_em_df) 数据示例 ``` - 序号 股票代码 股票简称 ... 最新财务报表的营业收入 签署日期 公告日期 + 序号 股票代码 股票简称 ... 最新财务报表的营业收入 签署日期 公告日期 0 1 688516 奥特维 ... NaN NaN 2023-08-18 1 2 688132 邦彦技术 ... NaN NaN 2023-08-18 2 3 831526 凯华材料 ... 5.101723e+07 NaN 2023-08-17