Skip to content

Commit

Permalink
Merge branch 'akfamily:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaolongtang authored Nov 9, 2023
2 parents e561498 + 7d42a35 commit fc827b0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2578,9 +2578,10 @@
1.11.62 fix: fix stock_zt_pool_dtgc_em interface
1.11.63 fix: fix fund_scale_open_sina interface
1.11.64 fix: fix futures_settlement_price_sgx interface
1.11.65 fix: fix futures_index_ccidx interface
"""

__version__ = "1.11.64"
__version__ = "1.11.65"
__author__ = "AKFamily"

import sys
Expand Down
12 changes: 7 additions & 5 deletions akshare/futures/futures_index_ccidx.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# -*- coding:utf-8 -*-
# !/usr/bin/env python
"""
Date: 2022/12/28 17:20
Date: 2023/11/9 14:00
Desc: 中证商品指数
http://www.ccidx.com/
"""
from io import BytesIO

import pandas as pd
import requests

Expand All @@ -25,7 +27,7 @@ def futures_index_ccidx(symbol: str = "中证商品期货指数") -> pd.DataFram
url = "http://www.ccidx.com/front/ajax_downZSHQ.do"
params = {"indexCode": futures_index_map[symbol]}
r = requests.get(url, params=params)
temp_df = pd.read_excel(r.content, header=1)
temp_df = pd.read_excel(BytesIO(r.content), header=1, engine="openpyxl")

temp_df.columns = [
"日期",
Expand All @@ -42,15 +44,15 @@ def futures_index_ccidx(symbol: str = "中证商品期货指数") -> pd.DataFram
"涨跌",
"涨跌幅",
]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"], errors="coerce")
temp_df["结算"] = pd.to_numeric(temp_df["结算"], errors="coerce")
temp_df["涨跌"] = pd.to_numeric(temp_df["涨跌"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df.sort_values(['日期'], inplace=True)
temp_df.sort_values(by=['日期'], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
return temp_df

Expand Down Expand Up @@ -104,7 +106,7 @@ def futures_index_min_ccidx(symbol: str = "中证监控油脂油料期货指数"
"datetime",
"value",
]
temp_df["value"] = pd.to_numeric(temp_df["value"])
temp_df["value"] = pd.to_numeric(temp_df["value"], errors="coerce")
return 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.65 fix: fix futures_index_ccidx interface

1. 修复 futures_index_ccidx 接口

1.11.64 fix: fix futures_settlement_price_sgx interface

1. 修复 futures_settlement_price_sgx 接口
Expand Down Expand Up @@ -3101,6 +3105,8 @@

## 版本更新说明

1.11.65 fix: fix futures_index_ccidx interface

1.11.64 fix: fix futures_settlement_price_sgx interface

1.11.63 fix: fix fund_scale_open_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. 本文档更新时间:**2023-11-08**
1. 本文档更新时间:**2023-11-09**
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 fc827b0

Please sign in to comment.