fund_etf_spot_em 接口报错:AKShare 1.18.97 下返回 502 Bad Gateway
fund_etf_spot_em 接口报错:最新版 AKShare 1.18.97 下仍无法获取 ETF 实时行情,当前返回 502 Bad Gateway
1. 已详细阅读对应接口文档
已阅读 AKShare 文档中 ETF 实时行情相关接口的使用说明,并按照文档中的方式调用:
ak.fund_etf_spot_em()本次反馈仅针对接口报错问题。
2. AKShare 已升级至最新版
提交问题前已执行:
pip install akshare --upgrade升级前本机版本:
AKShare: 1.18.63升级成功后当前版本:
AKShare: 1.18.97版本确认命令:
python -c "import akshare as ak; import sys; print('AKShare:', ak.__version__); print('Python:', sys.version)"实际输出:
AKShare: 1.18.97
Python: 3.13.93. 操作系统版本
主要复现环境:
Windows 64-bit
Microsoft Windows 10.0.26200.9457另外也曾在 Linux 环境观察到类似连接异常:
Ubuntu 22.04 64-bit但本 Issue 主要以 Windows + 最新版 AKShare 1.18.97 的复现结果为准。
4. Python 版本
Python 3.13.9
64-bit
Anaconda 环境Python 路径:
C:\Users\NUC\anaconda3\python.exe5. 接口名称和最小调用代码
接口名称
fund_etf_spot_em最小复现代码
import akshare as ak
print("AKShare:", ak.__version__)
df = ak.fund_etf_spot_em()
print(df.shape)
print(df.head())实际运行命令:
C:\Users\NUC\anaconda3\python.exe -B -u -c "import akshare as ak; print('AKShare:', ak.__version__); df=ak.fund_etf_spot_em(); print(df.shape); print(df.head())"6. 报错信息 / 问题描述
6.1 最新版 AKShare 1.18.97 的实际报错
升级至:
AKShare 1.18.97
Python 3.13.9后,调用:
ak.fund_etf_spot_em()仍然无法正常获取 ETF 实时行情。
Traceback 显示调用链为:
fund_etf_spot_em
↓
fetch_paginated_data
↓
request_with_retry
↓
requests.get
↓
response.raise_for_status()实际请求目标为:
https://push2delay.eastmoney.com/api/qt/clist/get最终报错:
requests.exceptions.HTTPError:
502 Server Error: Bad Gateway部分 traceback:
File "...akshare\fund\fund_etf_em.py", line 72, in fund_etf_spot_em
temp_df = fetch_paginated_data(url, params)
File "...akshare\\\utils\func.py", line 34, in fetch_paginated_data
r = request_with_retry(url, params=params, timeout=timeout)
File "...akshare\\\utils\request.py", line 64, in request_with_retry
raise last_exception
File "...akshare\\\utils\request.py", line 53, in request_with_retry
response.raise_for_status()
File "...requests\models.py", line 1026, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError:
502 Server Error: Bad Gateway6.2 升级前的错误表现
升级 AKShare 之前,本机版本为:
AKShare 1.18.63调用同一个:
ak.fund_etf_spot_em()时,主要表现为:
http.client.RemoteDisconnected:
Remote end closed connection without response并进一步被 urllib3 / requests 包装为:
urllib3.exceptions.ProxyError:
('Unable to connect to proxy',
RemoteDisconnected(
'Remote end closed connection without response'
))以及:
requests.exceptions.ProxyError:
HTTPSConnectionPool(
host='push2delay.eastmoney.com',
port=443
):
Max retries exceeded因此目前观察到的情况是:
升级前 1.18.63:
RemoteDisconnected / ProxyError
升级后 1.18.97:
502 Bad Gateway错误形式发生了变化,但:
ak.fund_etf_spot_em()在最新版中仍然无法正常返回数据。
6.3 Linux 环境也曾出现类似现象
另外在:
Ubuntu 22.04 64-bit
Python 3.10.20
AKShare 1.18.58环境中调用:
ak.fund_etf_spot_em()时也曾多次出现:
requests.exceptions.ConnectionError:
(
'Connection aborted.',
RemoteDisconnected(
'Remote end closed connection without response'
)
)因此该现象并非只在单一 Windows 环境观察到。
6.4 进一步排查情况
为排除简单的网页不可访问问题,又做了以下排查。
东方财富 ETF 行情网页:
https://quote.eastmoney.com/center/gridlist.html#fund_etf可以正常打开。
浏览器 Network 中可以看到东方财富行情相关请求正常返回 HTTP 200。
在浏览器页面上下文中请求东方财富行情接口时,也曾正常获得:
HTTP 200
rc=0
data.diff 有正常 ETF 行情数据例如 ETF:
510050
上证50ETF华夏可以得到最新价、IOPV、折价率等行情字段。
因此目前只能确认:
AKShare fund_etf_spot_em()
通过 requests 请求当前上游地址时,
存在连接被关闭或返回 502 的情况。不确定根因具体属于:
- 东方财富上游接口的访问限制;
- 请求频率或反爬限制;
- 当前
push2delay.eastmoney.com链路变化; - 代理 / 网络出口;
- 或 AKShare 当前请求方式需要调整。
因此这里不直接判断为 AKShare bug 或东方财富封 IP,仅报告实际可稳定复现的接口异常。
6.5 当前 AKShare 请求地址
从 traceback 以及当前函数实现可以看到:
fund_etf_spot_em()当前访问:
https://push2delay.eastmoney.com/api/qt/clist/get希望确认该地址及当前请求参数是否仍为推荐使用方式。
6.6 与历史问题相似
GitHub 中此前已有类似问题:
#7088 fund_etf_spot_em 接口调用失败其中也出现:
RemoteDisconnected(
'Remote end closed connection without response'
)另有:
#7227 AKShare 基金行情-东财 接口问题报告报告多个东方财富基金行情接口出现类似:
Connection aborted
RemoteDisconnected本次补充的区别是:
日期:2026-09-24
AKShare:1.18.97
Python:3.13.9最新版仍可复现,并且当前主要表现为:
502 Bad Gateway7. 期望获得的正确结果
希望以下最小代码:
import akshare as ak
df = ak.fund_etf_spot_em()
print(df)能够正常返回 ETF 实时行情 DataFrame。
期望返回文档中对应的 ETF 行情字段,例如:
代码
名称
最新价
IOPV实时估值
基金折价率
涨跌额
涨跌幅
成交量
成交额
开盘价
最高价
最低价
昨收
振幅
换手率
量比
委比
外盘
内盘
主力净流入-净额
主力净流入-净占比
超大单净流入-净额
超大单净流入-净占比
大单净流入-净额
大单净流入-净占比
中单净流入-净额
中单净流入-净占比
小单净流入-净额
小单净流入-净占比
最新份额
流通市值
总市值
数据日期
更新时间
...希望维护者协助确认:
fund_etf_spot_em()当前使用的:https://push2delay.eastmoney.com/api/qt/clist/get是否仍然是有效、推荐的上游地址;
当前请求参数或请求方式是否需要调整;
502 Bad Gateway / RemoteDisconnected是否与近期东方财富上游访问策略变化有关;如属于上游访问限制,是否有 AKShare 推荐的访问频率、代理配置或其他稳定调用方式;
是否考虑在接口层面针对:
RemoteDisconnected 502 Bad Gateway增加更明确的错误提示,方便用户判断是上游服务异常还是本地环境问题。
以上内容是AI根据情况帮我写的,主要就是之前能获取数据,但从9/21还22号开始就无法获取了 谢谢维护。
Source: akfamily/akshare