Skip to content

Commit

Permalink
feat(news_report_time_baidu): add news_report_time_baidu interface
Browse files Browse the repository at this point in the history
add news_report_time_baidu interface
  • Loading branch information
ak-quant committed May 14, 2022
1 parent 24a5579 commit 9d60052
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 2 deletions.
9 changes: 7 additions & 2 deletions akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1995,9 +1995,10 @@
1.5.73 fix: fix stock_notice_report interface
1.5.74 add: add news_trade_notify_suspend_baidu interface
1.5.75 fix: fix stock_financial_analysis_indicator interface
1.5.76 add: add news_report_time_baidu interface
"""

__version__ = "1.5.75"
__version__ = "1.5.76"
__author__ = "AKFamily"

import sys
Expand All @@ -2011,7 +2012,11 @@
"""
全球宏观事件
"""
from akshare.news.news_baidu import news_economic_baidu, news_trade_notify_suspend_baidu
from akshare.news.news_baidu import (
news_economic_baidu,
news_trade_notify_suspend_baidu,
news_report_time_baidu,
)

"""
东方财富-股票-财务分析
Expand Down
51 changes: 51 additions & 0 deletions akshare/news/news_baidu.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,60 @@ def news_trade_notify_suspend_baidu(date: str = "20220513") -> pd.DataFrame:
return big_df


def news_report_time_baidu(date: str = "20220514") -> pd.DataFrame:
"""
百度股市通-财报发行
https://gushitong.baidu.com/calendar
:param date: 查询日期
:type date: str
:return: 财报发行
:rtype: pandas.DataFrame
"""
start_date = "-".join([date[:4], date[4:6], date[6:]])
end_date = "-".join([date[:4], date[4:6], date[6:]])
url = "https://finance.pae.baidu.com/api/financecalendar"
params = {
"start_date": start_date,
"end_date": end_date,
"market": "",
"cate": "report_time",
'finClientType': 'pc',
}
r = requests.get(url, params=params)
data_json = r.json()
big_df = pd.DataFrame()
for item in data_json["Result"]:
if not item["list"] == []:
temp_df = pd.DataFrame(item["list"])
temp_df.columns = [
"股票代码",
"-",
"交易所",
"-",
"股票简称",
"-",
"财报期",
]
temp_df = temp_df[
[
"股票代码",
"交易所",
"股票简称",
"财报期",
]
]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
else:
continue
return big_df


if __name__ == "__main__":
news_economic_baidu_df = news_economic_baidu(date="20220512")
print(news_economic_baidu_df)

news_trade_notify_suspend_baidu_df = news_trade_notify_suspend_baidu(date="20220513")
print(news_trade_notify_suspend_baidu_df)

news_report_time_baidu_df = news_report_time_baidu(date="20220514")
print(news_report_time_baidu_df)
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

## 更新说明

1.5.76 add: add news_report_time_baidu interface

1. 新增 news_report_time_baidu 接口,获取财报发行时间

1.5.75 fix: fix stock_financial_analysis_indicator interface

1. 修复 stock_financial_analysis_indicator 接口的日期字段
Expand Down Expand Up @@ -577,6 +581,8 @@

## 版本更新说明

1.5.76 add: add news_report_time_baidu interface

1.5.75 fix: fix stock_financial_analysis_indicator interface

1.5.74 add: add news_trade_notify_suspend_baidu interface
Expand Down
43 changes: 43 additions & 0 deletions docs/data/stock/stock.md
Original file line number Diff line number Diff line change
Expand Up @@ -6439,6 +6439,49 @@ print(news_trade_notify_suspend_baidu_df)
9 01802 文业集团 ... NaT 已于今天(13/5/2022)上午九时三十分起短暂停止买卖。
```

### 财报发行

接口: news_report_time_baidu

目标地址: https://gushitong.baidu.com/calendar

描述: 百度股市通-财报发行

限量: 单次获取指定 date 的财报发行, 提供港股的财报发行数据

输入参数

| 名称 | 类型 | 描述 |
|------|-----|-----------------|
| date | str | date="20220514" |

输出参数

| 名称 | 类型 | 描述 |
|------|--------|-----|
| 股票代码 | object | |
| 交易所 | object | |
| 股票简称 | object | |
| 财报期 | object | |

接口示例

```python
import akshare as ak

news_report_time_baidu_df = ak.news_report_time_baidu(date="20220514")
print(news_report_time_baidu_df)
```

数据示例

```
股票代码 交易所 股票简称 财报期
0 08219 HK 恒伟集团控股 2022年一季报
1 08521 HK 智纺国际控股 2022年一季报
2 08491 HK COOL LINK 2022年一季报
```

### 新股数据

#### 打新收益率
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,8 @@
"news_economic_baidu" # 宏观-全球事件
# 停复牌
"news_trade_notify_suspend_baidu" # 停复牌
# 财报发行
"news_report_time_baidu" # 财报发行
```

## 案例演示
Expand Down

0 comments on commit 9d60052

Please sign in to comment.