Skip to content

Commit

Permalink
Date (#4275)
Browse files Browse the repository at this point in the history
* update date

* add version

* fix stock_balance_sheet_by_report_em
  • Loading branch information
albertandking authored Nov 13, 2023
1 parent 06fe857 commit 79220ca
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 11 deletions.
3 changes: 2 additions & 1 deletion akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2584,9 +2584,10 @@
1.11.68 fix: fix fund_aum_em interface
1.11.69 add: add futures_gfex_position_rank interface
1.11.70 fix: fix futures_gfex_position_rank interface
1.11.71 fix: fix stock_balance_sheet_by_report_em interface
"""

__version__ = "1.11.70"
__version__ = "1.11.71"
__author__ = "AKFamily"

import sys
Expand Down
36 changes: 36 additions & 0 deletions akshare/futures/cot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,14 @@ def futures_dce_position_rank(


def futures_dce_position_rank_other(date: str = "20160104"):
"""
大连商品交易所-每日持仓排名-具体合约-补充
http://www.dce.com.cn/dalianshangpin/xqsj/tjsj26/rtj/rcjccpm/index.html
:param date: 交易日
:type date: str
:return: 合约具体名称列表
:rtype: list
"""
date = cons.convert_date(date) if date is not None else datetime.date.today()
if date.strftime("%Y%m%d") not in calendar:
warnings.warn("%s非交易日" % date.strftime("%Y%m%d"))
Expand Down Expand Up @@ -1120,6 +1128,12 @@ def futures_dce_position_rank_other(date: str = "20160104"):


def __futures_gfex_vars_list() -> list:
"""
广州期货交易所-合约品种名称列表
http://www.gfex.com.cn/gfex/rcjccpm/hqsj_tjsj.shtml
:return: 合约品种名称列表
:rtype: list
"""
url = "http://www.gfex.com.cn/u/interfacesWebVariety/loadList"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'
Expand All @@ -1132,6 +1146,16 @@ def __futures_gfex_vars_list() -> list:


def __futures_gfex_contract_list(symbol: str = "si", date: str = "20231113") -> list:
"""
广州期货交易所-合约具体名称列表
http://www.gfex.com.cn/gfex/rcjccpm/hqsj_tjsj.shtml
:param symbol: 品种
:type symbol: str
:param date: 交易日
:type date: str
:return: 合约具体名称列表
:rtype: list
"""
url = "http://www.gfex.com.cn/u/interfacesWebTiMemberDealPosiQuotes/loadListContract_id"
payload = {
'variety': symbol,
Expand All @@ -1151,6 +1175,18 @@ def __futures_gfex_contract_data(
symbol: str = "si",
contract_id: str = "si2312",
date: str = "20231113") -> pd.DataFrame:
"""
广州期货交易所-合约具体数据
http://www.gfex.com.cn/gfex/rcjccpm/hqsj_tjsj.shtml
:param symbol: 品种
:type symbol: str
:param contract_id: 具体合约
:type contract_id: str
:param date: 交易日
:type date: str
:return: 合约具体数据
:rtype: pandas.DataFrame
"""
url = "http://www.gfex.com.cn/u/interfacesWebTiMemberDealPosiQuotes/loadList"
payload = {
'trade_date': date,
Expand Down
16 changes: 8 additions & 8 deletions akshare/stock_feature/stock_three_report_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def stock_balance_sheet_by_report_em(symbol: str = "SH600519") -> pd.DataFrame:
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
for col in temp_df.columns:
if temp_df[col].isnull().any(): # 检查列是否包含 None 或 NaN
if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN
temp_df[col] = pd.to_numeric(temp_df[col], errors='coerce')
if big_df.empty:
big_df = temp_df
Expand Down Expand Up @@ -120,7 +120,7 @@ def stock_balance_sheet_by_yearly_em(symbol: str = "SH600036") -> pd.DataFrame:
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
for col in temp_df.columns:
if temp_df[col].isnull().any(): # 检查列是否包含 None 或 NaN
if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN
temp_df[col] = pd.to_numeric(temp_df[col], errors='coerce')
if big_df.empty:
big_df = temp_df
Expand Down Expand Up @@ -166,7 +166,7 @@ def stock_profit_sheet_by_report_em(symbol: str = "SH600519") -> pd.DataFrame:
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
for col in temp_df.columns:
if temp_df[col].isnull().any(): # 检查列是否包含 None 或 NaN
if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN
temp_df[col] = pd.to_numeric(temp_df[col], errors='coerce')
if big_df.empty:
big_df = temp_df
Expand Down Expand Up @@ -212,7 +212,7 @@ def stock_profit_sheet_by_yearly_em(symbol: str = "SH600519") -> pd.DataFrame:
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
for col in temp_df.columns:
if temp_df[col].isnull().any(): # 检查列是否包含 None 或 NaN
if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN
temp_df[col] = pd.to_numeric(temp_df[col], errors='coerce')
if big_df.empty:
big_df = temp_df
Expand Down Expand Up @@ -260,7 +260,7 @@ def stock_profit_sheet_by_quarterly_em(
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
for col in temp_df.columns:
if temp_df[col].isnull().any(): # 检查列是否包含 None 或 NaN
if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN
temp_df[col] = pd.to_numeric(temp_df[col], errors='coerce')
if big_df.empty:
big_df = temp_df
Expand Down Expand Up @@ -308,7 +308,7 @@ def stock_cash_flow_sheet_by_report_em(
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
for col in temp_df.columns:
if temp_df[col].isnull().any(): # 检查列是否包含 None 或 NaN
if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN
temp_df[col] = pd.to_numeric(temp_df[col], errors='coerce')
if big_df.empty:
big_df = temp_df
Expand Down Expand Up @@ -356,7 +356,7 @@ def stock_cash_flow_sheet_by_yearly_em(
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
for col in temp_df.columns:
if temp_df[col].isnull().any(): # 检查列是否包含 None 或 NaN
if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN
temp_df[col] = pd.to_numeric(temp_df[col], errors='coerce')
if big_df.empty:
big_df = temp_df
Expand Down Expand Up @@ -404,7 +404,7 @@ def stock_cash_flow_sheet_by_quarterly_em(
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
for col in temp_df.columns:
if temp_df[col].isnull().any(): # 检查列是否包含 None 或 NaN
if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN
temp_df[col] = pd.to_numeric(temp_df[col], errors='coerce')
if big_df.empty:
big_df = temp_df
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@

## 更新说明详情

1.11.71 fix: fix stock_balance_sheet_by_report_em interface

1. 修复 stock_balance_sheet_by_report_em 接口

1.11.70 fix: fix futures_gfex_position_rank interface

1. 修复 futures_gfex_position_rank 接口
Expand Down Expand Up @@ -3125,6 +3129,8 @@

## 版本更新说明

1.11.71 fix: fix stock_balance_sheet_by_report_em interface

1.11.70 fix: fix futures_gfex_position_rank interface

1.11.69 add: add futures_gfex_position_rank interface
Expand Down
2 changes: 1 addition & 1 deletion docs/data/futures/futures.md
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ P.S. 这里仅列出值(pandas.DataFrame)的字段信息

| 名称 | 类型 | 描述 |
|-------------------------|--------|---------|
| rank | int64 | 名词 |
| rank | int64 | 名次 |
| vol_party_name | object | 会员简称 |
| vol | int64 | 成交量 |
| vol_chg | int64 | 成交量-增减 |
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. 本文档更新时间:**2023-11-13**
1. 本文档更新时间:**2023-11-14**
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 79220ca

Please sign in to comment.