Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #5465

Merged
merged 4 commits into from
Dec 26, 2024
Merged

Dev #5465

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2965,9 +2965,10 @@
1.15.53 fix: fix futures_inventory_99 interface
1.15.54 fix: fix stock_sy_profile_em interface
1.15.55 fix: fix fund_etf_spot_em interface
1.15.56 fix: fix spot_goods interface
"""

__version__ = "1.15.55"
__version__ = "1.15.56"
__author__ = "AKFamily"

import sys
Expand Down
4 changes: 2 additions & 2 deletions akshare/futures/futures_news_shmet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding:utf-8 -*-
# !/usr/bin/env python
"""
Date: 2024/3/21 12:00
Date: 2024/12/26 18:00
Desc: 上海金属网-快讯
https://www.shmet.com/newsFlash/newsFlash.html?searchKeyword=
"""
Expand Down Expand Up @@ -38,7 +38,7 @@ def futures_news_shmet(symbol: str = "全部") -> pd.DataFrame:
}
payload = {
"currentPage": 1,
"pageSize": 1000,
"pageSize": 2000,
"content": "",
"flashTag": symbol_map[symbol],
}
Expand Down
14 changes: 9 additions & 5 deletions akshare/index/index_spot.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2023/6/11 21:30
Date: 2024/12/26 18:30
Desc: 商品现货价格指数
http://finance.sina.com.cn/futuremarket/spotprice.shtml#titlePos_0
https://finance.sina.com.cn/futuremarket/spotprice.shtml#titlePos_0
"""

import pandas as pd
import requests


def spot_goods(symbol: str = "波罗的海干散货指数") -> pd.DataFrame:
"""
新浪财经-商品现货价格指数
http://finance.sina.com.cn/futuremarket/spotprice.shtml#titlePos_0
https://finance.sina.com.cn/futuremarket/spotprice.shtml#titlePos_0
:param symbol: choice of {"波罗的海干散货指数", "钢坯价格指数", "澳大利亚粉矿价格"}
:type symbol: str
:return: 商品现货价格指数
:rtype: pandas.DataFrame
"""
url = "http://stock.finance.sina.com.cn/futures/api/openapi.php/GoodsIndexService.get_goods_index"
url = "https://stock.finance.sina.com.cn/futures/api/openapi.php/GoodsIndexService.get_goods_index"
symbol_url_dict = {
"波罗的海干散货指数": "BDI",
"钢坯价格指数": "GP",
Expand All @@ -31,10 +32,13 @@ def spot_goods(symbol: str = "波罗的海干散货指数") -> pd.DataFrame:
temp_df = pd.DataFrame(data_json["result"]["data"]["data"])
temp_df = temp_df[["opendate", "price", "zde", "zdf"]]
temp_df.columns = ["日期", "指数", "涨跌额", "涨跌幅"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"], format="%Y-%m-%d", errors="coerce").dt.date
temp_df["日期"] = pd.to_datetime(
temp_df["日期"], format="%Y-%m-%d", 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.dropna(inplace=True, ignore_index=True)
return temp_df


Expand Down
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@

## 更新说明详情

1.15.56 fix: fix spot_goods interface

1. 修复 spot_goods 接口
2. 修复 futures_news_shmet 接口

1.15.55 fix: fix fund_etf_spot_em interface

1. 修复 fund_etf_spot_em 接口
Expand Down Expand Up @@ -4890,6 +4895,8 @@

## 版本更新说明

1.15.56 fix: fix spot_goods interface

1.15.55 fix: fix fund_etf_spot_em interface

1.15.54 fix: fix stock_sy_profile_em interface
Expand Down
26 changes: 13 additions & 13 deletions docs/data/index/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2404,19 +2404,19 @@ print(spot_goods_df)
数据示例

```
日期 指数 涨跌额 涨跌幅
0 NaT 919.0 -18.0 -1.9200
1 2006-06-23 2808.0 83.0 0.0305
2 2006-06-30 2964.0 156.0 0.0556
3 2006-07-07 2870.0 -94.0 -0.0317
4 2006-07-14 2968.0 98.0 0.0341
... ... ... ...
3284 2023-06-02 919.0 -18.0 -1.9200
3285 2023-06-05 939.0 20.0 2.1800
3286 2023-06-06 1016.0 77.0 8.2000
3287 2023-06-07 1020.0 4.0 0.3900
3288 2023-06-08 1040.0 20.0 1.9600
[3289 rows x 4 columns]
日期 指数 涨跌额 涨跌幅
0 2006-06-23 2808.0 83.0 0.0305
1 2006-06-30 2964.0 156.0 0.0556
2 2006-07-07 2870.0 -94.0 -0.0317
3 2006-07-14 2968.0 98.0 0.0341
4 2006-07-21 3191.0 223.0 0.0751
... ... ... ... ...
3673 2024-12-18 1028.0 -25.0 -2.3700
3674 2024-12-19 976.0 -52.0 -5.0600
3675 2024-12-20 990.0 14.0 1.4300
3676 2024-12-23 994.0 4.0 0.4000
3677 2024-12-24 997.0 3.0 0.3000
[3678 rows x 4 columns]
```

### 义乌小商品指数
Expand Down
Loading