diff --git a/akshare/__init__.py b/akshare/__init__.py index d890e56a82e..53ba45850c9 100644 --- a/akshare/__init__.py +++ b/akshare/__init__.py @@ -2693,9 +2693,10 @@ 1.12.78 fix: fix stock_info_sh_delist interface 1.12.79 fix: fix futures_main_sina interface 1.12.80 fix: fix get_czce_daily interface +1.12.81 fix: fix macro_china_bond_public interface """ -__version__ = "1.12.80" +__version__ = "1.12.81" __author__ = "AKFamily" import sys @@ -4037,6 +4038,7 @@ """ from akshare.bond.bond_china_money import ( bond_china_close_return, + macro_china_bond_public, macro_china_swap_rate, bond_china_close_return_map, @@ -4942,7 +4944,6 @@ macro_china_czsr, macro_china_whxd, macro_china_wbck, - macro_china_bond_public, macro_china_xfzxx, macro_china_reserve_requirement_ratio, macro_china_consumer_goods_retail, diff --git a/akshare/bond/bond_china_money.py b/akshare/bond/bond_china_money.py index 598c8861fa1..649a5803d14 100644 --- a/akshare/bond/bond_china_money.py +++ b/akshare/bond/bond_china_money.py @@ -292,6 +292,62 @@ def macro_china_swap_rate( return big_df +def macro_china_bond_public() -> pd.DataFrame: + """ + 中国-债券信息披露-债券发行 + https://www.chinamoney.com.cn/chinese/xzjfx/ + :return: 债券发行 + :rtype: pandas.DataFrame + """ + bond_china_close_return_map() + url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-an/bnBondEmit" + headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36", + } + payload = { + "enty": "", + "bondType": "", + "bondNameCode": "", + "leadUnderwriter": "", + "pageNo": "1", + "pageSize": "1000", + "limit": "1", + } + r = requests.post(url, data=payload, headers=headers) + data_json = r.json() + temp_df = pd.DataFrame(data_json["records"]) + temp_df.columns = [ + "债券全称", + "债券类型", + "-", + "发行日期", + "-", + "计息方式", + "-", + "债券期限", + "-", + "债券评级", + "-", + "价格", + "计划发行量", + ] + temp_df = temp_df[ + [ + "债券全称", + "债券类型", + "发行日期", + "计息方式", + "价格", + "债券期限", + "计划发行量", + "债券评级", + ] + ] + temp_df["价格"] = pd.to_numeric(temp_df["价格"], errors="coerce") + temp_df["计划发行量"] = pd.to_numeric(temp_df["计划发行量"], errors="coerce") + return temp_df + + if __name__ == "__main__": bond_china_close_return_df = bond_china_close_return( symbol="国债", period="1", start_date="20240101", end_date="20240112" @@ -302,3 +358,6 @@ def macro_china_swap_rate( start_date="20240101", end_date="20240112" ) print(macro_china_swap_rate_df) + + macro_china_bond_public_df = macro_china_bond_public() + print(macro_china_bond_public_df) diff --git a/akshare/economic/macro_china.py b/akshare/economic/macro_china.py index 686a7865fe8..92509b24930 100644 --- a/akshare/economic/macro_china.py +++ b/akshare/economic/macro_china.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding:utf-8 -*- """ -Date: 2023/10/28 18:20 +Date: 2024/3/4 14:30 Desc: 宏观数据-中国 """ import json @@ -24,7 +24,6 @@ JS_CHINA_ENERGY_DAILY_URL, JS_CHINA_NON_MAN_PMI_MONTHLY_URL, JS_CHINA_CX_SERVICE_PMI_YEARLY_URL, - JS_CHINA_MARKET_MARGIN_SH_URL, ) from akshare.utils import demjson @@ -3273,61 +3272,6 @@ def macro_china_wbck() -> pd.DataFrame: return temp_df -def macro_china_bond_public() -> pd.DataFrame: - """ - 中国-债券信息披露-债券发行 - https://www.chinamoney.com.cn/chinese/xzjfx/ - :return: 债券发行 - :rtype: pandas.DataFrame - """ - url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-an/bnBondEmit" - headers = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36", - } - payload = { - "enty": "", - "bondType": "", - "bondNameCode": "", - "leadUnderwriter": "", - "pageNo": "1", - "pageSize": "1000", - "limit": "1", - } - r = requests.post(url, data=payload, headers=headers) - data_json = r.json() - temp_df = pd.DataFrame(data_json["records"]) - temp_df.columns = [ - "债券全称", - "债券类型", - "-", - "发行日期", - "-", - "计息方式", - "-", - "债券期限", - "-", - "债券评级", - "-", - "价格", - "计划发行量", - ] - temp_df = temp_df[ - [ - "债券全称", - "债券类型", - "发行日期", - "计息方式", - "价格", - "债券期限", - "计划发行量", - "债券评级", - ] - ] - temp_df["价格"] = pd.to_numeric(temp_df["价格"], errors="coerce") - temp_df["计划发行量"] = pd.to_numeric(temp_df["计划发行量"], errors="coerce") - return temp_df - - def macro_china_xfzxx() -> pd.DataFrame: """ 东方财富网-经济数据一览-消费者信心指数 @@ -4201,9 +4145,6 @@ def macro_china_real_estate() -> pd.DataFrame: macro_china_wbck_df = macro_china_wbck() print(macro_china_wbck_df) - macro_china_bond_public_df = macro_china_bond_public() - print(macro_china_bond_public_df) - macro_china_xfzxx_df = macro_china_xfzxx() print(macro_china_xfzxx_df) diff --git a/docs/changelog.md b/docs/changelog.md index 88026214e98..0756d632788 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -71,6 +71,10 @@ ## 更新说明详情 +1.12.81 fix: fix macro_china_bond_public interface + + 1. 修复 macro_china_bond_public 接口 + 1.12.80 fix: fix get_czce_daily interface 1. 修复 get_czce_daily 接口 @@ -3649,6 +3653,8 @@ ## 版本更新说明 +1.12.81 fix: fix macro_china_bond_public interface + 1.12.80 fix: fix get_czce_daily interface 1.12.79 fix: fix futures_main_sina interface diff --git a/docs/introduction.md b/docs/introduction.md index a576d5a4d0c..057aa4e79f2 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -6,7 +6,7 @@ **风险提示:[AKShare](https://github.com/akfamily/akshare) 开源财经数据接口库所采集的数据皆来自公开的数据源,不涉及任何个人隐私数据和非公开数据。 同时本项目提供的数据接口及相关数据仅用于学术研究,任何个人、机构及团体使用本项目的数据接口及相关数据请注意商业风险。** -1. 本文档更新时间:**2024-03-03**; +1. 本文档更新时间:**2024-03-04**; 2. 如有 [AKShare](https://github.com/akfamily/akshare) 库、文档及数据的相关问题,请在 [AKShare Issues](https://github.com/akfamily/akshare/issues) 中提 Issues; 3. 欢迎关注 **数据科学实战** 微信公众号:
; 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)