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 #5713

Merged
merged 6 commits into from
Feb 20, 2025
Merged

Dev #5713

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 @@ -3015,9 +3015,10 @@
1.16.4 fix: fix stock_hk_ggt_components_em interface
1.16.5 fix: fix stock_sector_fund_flow_rank interface
1.16.6 fix: fix stock_sgt_reference_exchange_rate_sse interface
1.16.7 fix: fix fund_lof_hist_em interface
"""

__version__ = "1.16.6"
__version__ = "1.16.7"
__author__ = "AKFamily"

import sys
Expand Down
41 changes: 7 additions & 34 deletions akshare/fund/fund_etf_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"""

from functools import lru_cache
import math

import pandas as pd
import requests
from akshare.utils.tqdm import get_tqdm


@lru_cache()
Expand All @@ -24,9 +23,9 @@ def _fund_etf_code_id_map_em() -> dict:
url = "https://88.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "200",
"pz": "50000",
"po": "1",
"np": "1",
"np": "2",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
Expand All @@ -38,20 +37,7 @@ def _fund_etf_code_id_map_em() -> dict:
}
r = requests.get(url, params=params, timeout=15)
data_json = r.json()
total_page = math.ceil(data_json["data"]["total"] / 200)
temp_list = []
tqdm = get_tqdm()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update(
{
"pn": page,
}
)
r = requests.get(url, params=params, timeout=15)
data_json = r.json()
inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_list.append(inner_temp_df)
temp_df = pd.concat(temp_list, ignore_index=True)
temp_df = pd.DataFrame(data_json["data"]["diff"]).T
temp_dict = dict(zip(temp_df["f12"], temp_df["f13"]))
return temp_dict

Expand All @@ -66,9 +52,9 @@ def fund_etf_spot_em() -> pd.DataFrame:
url = "https://88.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "200",
"pz": "50000",
"po": "1",
"np": "1",
"np": "2",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
Expand All @@ -87,20 +73,7 @@ def fund_etf_spot_em() -> pd.DataFrame:
}
r = requests.get(url, timeout=15, params=params)
data_json = r.json()
total_page = math.ceil(data_json["data"]["total"] / 200)
temp_list = []
tqdm = get_tqdm()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update(
{
"pn": page,
}
)
r = requests.get(url, params=params, timeout=15)
data_json = r.json()
inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_list.append(inner_temp_df)
temp_df = pd.concat(temp_list, ignore_index=True)
temp_df = pd.DataFrame(data_json["data"]["diff"]).T
temp_df.rename(
columns={
"f12": "代码",
Expand Down
8 changes: 4 additions & 4 deletions akshare/fund/fund_lof_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _fund_lof_code_id_map_em() -> dict:
"pn": "1",
"pz": "5000",
"po": "1",
"np": "1",
"np": "2",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
Expand All @@ -38,7 +38,7 @@ def _fund_lof_code_id_map_em() -> dict:
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df = pd.DataFrame(data_json["data"]["diff"]).T
temp_dict = dict(zip(temp_df["f12"], temp_df["f13"]))
return temp_dict

Expand All @@ -55,7 +55,7 @@ def fund_lof_spot_em() -> pd.DataFrame:
"pn": "1",
"pz": "5000",
"po": "1",
"np": "1",
"np": "2",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
Expand All @@ -68,7 +68,7 @@ def fund_lof_spot_em() -> pd.DataFrame:
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df = pd.DataFrame(data_json["data"]["diff"]).T
temp_df.rename(
columns={
"f12": "代码",
Expand Down
5 changes: 3 additions & 2 deletions akshare/futures/futures_hist_em.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2024/1/17 19:30
Date: 2024/2/20 17:00
Desc: 东方财富网-期货行情
https://qhweb.eastmoney.com/quote
"""

import re
from functools import lru_cache
from typing import Tuple, Dict

import pandas as pd
import requests
Expand Down Expand Up @@ -53,7 +54,7 @@ def __fetch_exchange_symbol_raw_em() -> list:


@lru_cache()
def __get_exchange_symbol_map() -> tuple[dict, dict, dict, dict]:
def __get_exchange_symbol_map() -> Tuple[Dict, Dict, Dict, Dict]:
"""
东方财富网-期货行情-交易所品种映射
https://quote.eastmoney.com/qihuo/al2505.html
Expand Down
8 changes: 4 additions & 4 deletions akshare/stock/stock_us_pink.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2024/4/11 17:00
Date: 2025/2/20 17:00
Desc: 东方财富网-行情中心-美股市场-粉单市场
https://quote.eastmoney.com/center/gridlist.html#us_pinksheet
"""
Expand All @@ -20,9 +20,9 @@ def stock_us_pink_spot_em() -> pd.DataFrame:
url = "https://23.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "2000",
"pz": "50000",
"po": "1",
"np": "1",
"np": "2",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
Expand All @@ -34,7 +34,7 @@ def stock_us_pink_spot_em() -> pd.DataFrame:
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df = pd.DataFrame(data_json["data"]["diff"]).T
temp_df.columns = [
"_",
"最新价",
Expand Down
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@

## 更新说明详情

1.16.7 fix: fix fund_lof_hist_em interface

1. 修复 fund_lof_hist_em 接口
2. 修复 fund_etf_spot_em 接口
3. 修复 stock_us_pink_spot_em 接口
4. 修复 futures_hist_em 接口

1.16.6 fix: fix stock_sgt_reference_exchange_rate_sse interface

1. 修复 stock_sgt_reference_exchange_rate_sse 接口
Expand Down Expand Up @@ -5131,6 +5138,8 @@

## 版本更新说明

1.16.7 fix: fix fund_lof_hist_em interface

1.16.6 fix: fix stock_sgt_reference_exchange_rate_sse interface

1.16.5 fix: fix stock_sector_fund_flow_rank 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. 本文档更新时间:**2025-02-19**;
1. 本文档更新时间:**2025-02-20**;
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. **知识星球【数据科学实战】** 2025 全新改版,聚焦于量化投资内容,欢迎加入 **知识星球【数据科学实战】** 高质量社区,里面有丰富的视频课程、问答、文章、书籍及代码等内容:
Expand Down