docs(futu): 对照主流用法修正探索文档 - #14
Merged
Merged
Conversation
回应「市面上 futu-api 主流用法 vs 本文档设想」的追问,做两件事: 1. 新增 §6 Part F——对照官方文档 (openapi.futunn.com)、py-futu-api 仓库、 社区 OpenD 生产部署实践,列出 6 处设想与主流用法的差异:连接生命周期 (长连接+推送 vs 本文档的按次订阅/取消订阅)、连接归属(futu 订阅配额 /行情权限是账户级共享,需要单例网关进程,而非每个 gunicorn worker 各开 一个连接)、fork 安全(SDK 内部线程不能跨 fork 存活)、部署形态 (headless docker + 登录 token 持久化 volume 才是主流生产模式)等。 2. 更正一处此前的错误归因:US 现货/实时行情失败的根因是**未购买付费 Nasdaq Basic 行情卡**,而非"盘后"——has been wrong in §1.4/§3.3, both fixed in place(依据 py-futu-api issue #25 的社区共识)。 3. 校验发现 business_line_reorg B1/B2 已落地:`data_pipeline/providers/ base.py` 的 MarketDataProvider/OptionChainSnapshot/OptionLeg 已是真实 代码,不再是假设的草图;但 `services/options/*` 仍走 legacy shim 的 dict-of-DataFrames 路径,尚未迁移到 canonical 类型——§3.1/§4.2/§5 F1-F3 据此改写,标注 futu provider 落地时的必做迁移项,不再只是"顺手清理"。 无代码改动,无新增 ADR。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI's `ruff format --check .` formats fenced python code blocks inside .md files too (repo-wide, no path filter) — the OptionLeg/OptionChainSnapshot sketch added in the mainstream-comparison pass wasn't run through it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
目的
回应对 #9(已合并的 futu 探索文档)的追问:"市面上 futu-api 主流方式是什么,当前设想的使用方式有哪些和主流方式不一致?" 对照官方文档、
FutunnOpen/py-futu-api、社区 OpenD 生产部署实践,补一份差异分析;顺带校验发现 reorg B1/B2 已落地,把文档里"假设的 provider seam"改成"对照已落地的真实代码"。无代码改动,无新增 ADR。
新增 §6 Part F——主流用法 vs 本文档设想
gunicorn --workers 2(prefork)——若每个 worker 各自连 OpenD,会争抢同一账户共享的 1000 条订阅配额和最高行情权限,是竞态问题,不只是限流问题fork()存活get_market_snapshot做免订阅批量查询顺带发现并修正
business_line_reorg.md的 B1(provider seam)/B2(canonical 表)已合并落地——data_pipeline/providers/base.py的MarketDataProvider/OptionChainSnapshot/OptionLeg已是真代码,不再是本文档原先的假设草图。但校验发现:services/options/{chain,preload,builder}.py和core/decision/candidate.py仍在用 legacy shim 的 dict-of-DataFrames 路径,get_provider(...).option_chain()目前零调用方。据此改写了 §3.1/§4.2/§5 F1–F3:给 futu 加 provider 只是必要条件,把这几个消费者迁移到 canonical 类型才是 ADR 0011 真正要求的、绕不开的必做项,不是顺手清理。检查
python scripts/doc_guard.py— clean(pre-commit 全绿)🤖 Generated with Claude Code