Repository navigation
修复天天基金 F10DataApi 下线导致的增量更新失败 - #209
Merged
refraction-ray merged 1 commit intoJul 25, 2026
Merged
Conversation
天天基金已下线 fund.eastmoney.com/f10/F10DataApi.aspx,该地址现 302 跳转至 fundf10.eastmoney.com/F10DataApi.aspx 并返回 404。 该页面是 fundinfo.update 与 mfundinfo.update 的数据来源,因此在存在 本地缓存副本后,所有场外基金的增量更新都会抛出 HttpStatusError:首次 抓取走 pingzhongdata 正常,之后每次更新都失败。 改用 api.fund.eastmoney.com/f10/lsjz,JSON 字段与原表格列一一对应 (FSRQ/DWJZ/LJJZ/FHSP),服务端每页 20 条的上限不变,请求带上 fundf10.eastmoney.com referer。 tests/test_info.py::test_fund_update 在修改前报 HttpStatusError, 修改后通过。
Owner
|
感谢贡献,确实存在该问题! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
天天基金已下线
fund.eastmoney.com/f10/F10DataApi.aspx。该地址目前 302 跳转到fundf10.eastmoney.com/F10DataApi.aspx,而后者返回 404:该页面是
fundinfo.update和mfundinfo.update的唯一数据来源,所以只要本地存在缓存副本,场外基金的增量更新就会抛
HttpStatusError。表现比较隐蔽:首次抓取走pingzhongdata一切正常,之后每一次更新都失败,因此只有配合
set_backend长期使用的场景才会踩到。改动
两处
update改用api.fund.eastmoney.com/f10/lsjz,JSON 字段与原表格列一一对应:FSRQDWJZLJJZFHSP分页逻辑保持不变 —— 新接口同样有每页 20 条的服务端上限(请求
pageSize=60实际只返回 20 条),原先每页 10 条的写法依然适用。请求需要带
fundf10.eastmoney.com的 referer。验证
tests/test_info.py::test_fund_update(覆盖fundinfo与mfundinfo两条增量路径):FAILED ... xalpha.exceptions.HttpStatusError1 passedtests/test_info.py整体从 9 passed / 2 failed 变为 10 passed / 1 failed。仍失败的test_csvio是卡在
indexinfo那一步(多次运行分别报SSLError和FileNotFoundError),改动前后都存在,与本 PR 无关。
另外单独核对过增量结果的正确性:把
mfundinfo("000198")的净值表截去 6 行后调用update(),重建出的净值与完整抓取的表在 6 位小数上完全一致。