Skip to content

Commit

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

* fix futures_dce_warehouse_receipt
  • Loading branch information
albertandking authored Oct 11, 2023
1 parent 15245b6 commit 37e2bbb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2544,9 +2544,10 @@
1.11.28 fix: fix stock_margin_detail_szse interface
1.11.29 fix: fix bond_new_composite_index_cbond interface
1.11.30 fix: fix stock_zh_a_st_em interface
1.11.31 fix: fix futures_dce_warehouse_receipt interface
"""

__version__ = "1.11.30"
__version__ = "1.11.31"
__author__ = "AKFamily"

import sys
Expand Down
11 changes: 5 additions & 6 deletions akshare/futures/futures_warehouse_receipt.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2020/7/3 17:32
Date: 2023/10/11 17:32
Desc: 期货-仓单日报
郑州商品交易所-交易数据-仓单日报
http://www.czce.com.cn/cn/jysj/cdrb/H770310index_1.htm
大连商品交易所-行情数据-统计数据-日统计-仓单日报
http://www.dce.com.cn/dalianshangpin/xqsj/tjsj26/rtj/cdrb/index.html
"""
import re
from io import BytesIO
from io import BytesIO, StringIO

import pandas as pd
import requests
Expand Down Expand Up @@ -71,7 +70,7 @@ def futures_dce_warehouse_receipt(trade_date: str = "20200702") -> dict:
"day": trade_date[6:],
}
r = requests.get(url, params=params, headers=headers)
temp_df = pd.read_html(r.text)[0]
temp_df = pd.read_html(StringIO(r.text))[0]
index_list = temp_df[
temp_df.iloc[:, 0].str.contains("小计") == 1
].index.to_list()
Expand All @@ -85,7 +84,7 @@ def futures_dce_warehouse_receipt(trade_date: str = "20200702") -> dict:
inner_df = temp_df[temp_index : index_list[inner_index + 1] + 1]
inner_key = inner_df.iloc[0, 0]
inner_df.reset_index(inplace=True, drop=True)
inner_df = inner_df.fillna(method="ffill")
inner_df = inner_df.ffill()
big_dict[inner_key] = inner_df
return big_dict

Expand Down Expand Up @@ -122,7 +121,7 @@ def futures_shfe_warehouse_receipt(trade_date: str = "20200702") -> dict:
else:
url = f"http://www.shfe.com.cn/data/dailydata/{trade_date}dailystock.html"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
temp_df = pd.read_html(StringIO(r.text))[0]
index_list = temp_df[
temp_df.iloc[:, 3].str.contains("单位:") == 1
].index.to_list()
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@

## 更新说明详情

1.11.31 fix: fix futures_dce_warehouse_receipt interface

1. 修复 futures_dce_warehouse_receipt 接口

1.11.30 fix: fix stock_zh_a_st_em interface

1. 修复 stock_zh_a_st_em 接口
Expand Down Expand Up @@ -2952,6 +2956,8 @@

## 版本更新说明

1.11.31 fix: fix futures_dce_warehouse_receipt interface

1.11.30 fix: fix stock_zh_a_st_em interface

1.11.29 fix: fix bond_new_composite_index_cbond interface
Expand Down
13 changes: 7 additions & 6 deletions docs/data/futures/futures.md
Original file line number Diff line number Diff line change
Expand Up @@ -1226,20 +1226,21 @@ print(futures_dce_warehouse_receipt_df)

输入参数

| 名称 | 类型 | 必选 | 描述 |
| -------- | ---- | ---- | --- |
| trade_date | str | Y | trade_date="20200702"; 交易日 |
| 名称 | 类型 | 描述 |
|------------|-----|----------------------------|
| trade_date | str | trade_date="20200702"; 交易日 |

输出参数

| 名称 | 类型 | 默认显示 | 描述 |
| --------------- | ----- | -------- | ---------------- |
| 键值对字典 | dict | Y | 键值对, 键为品种代码, 值为 pandas.DataFrame 格式的数据 |
| 名称 | 类型 | 描述 |
|-------|------|----------------------------------------|
| 键值对字典 | dict | 键值对, 键为品种代码, 值为 pandas.DataFrame 格式的数据 |

接口示例

```python
import akshare as ak

futures_shfe_warehouse_receipt_df = ak.futures_shfe_warehouse_receipt(trade_date="20200702")
print(futures_shfe_warehouse_receipt_df)
```
Expand Down

0 comments on commit 37e2bbb

Please sign in to comment.