Skip to content

Commit

Permalink
Date (#4567)
Browse files Browse the repository at this point in the history
* add version 1.12.81

* fix macro_china_bond_public

* update date
  • Loading branch information
albertandking authored Mar 4, 2024
1 parent 75a869a commit 71a9a56
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 63 deletions.
5 changes: 3 additions & 2 deletions akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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,
Expand Down
59 changes: 59 additions & 0 deletions akshare/bond/bond_china_money.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
61 changes: 1 addition & 60 deletions akshare/economic/macro_china.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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:
"""
东方财富网-经济数据一览-消费者信心指数
Expand Down Expand Up @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 接口
Expand Down Expand Up @@ -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
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-03-03**
1. 本文档更新时间:**2024-03-04**
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 71a9a56

Please sign in to comment.