docs(futu): 按股价/期权数据依赖给模块分类 - #16
Merged
Merged
Conversation
回应"按股价 vs 期权数据划分模块是否有助于接入 futu、哪些模块两者都用、 futu 期权数据能否顺带给股价信息"的追问。grep 校验,非猜测: - 纯股价模块(Market Review/Statistical/Assessment/Regime/Simulation)完全 不碰 fetch_option_chain,futu 接入零影响。 - 纯期权模块(Option Chain/Payoff Ratio/candidate 矩阵/IV 系列图表)里的 spot 本来就是 fetch_option_chain() 内部顺带解析、塞进同一份快照的,不算 第二数据源;futu provider 做同样的事即可(§3.3 已有设计)。 - 两者都用的只有 2 处,且是同一种模式(HV 百分位 vs 期权 IV,ADR 0004 的 落地点):services/options/chain.py 的 Vol Premium 区块、 services/options/builder.py 的 _vol_context。两处历史价格调用和期权链 调用本就是两次独立调用,只在最后合并派生标量——接入 futu 不需要碰这两处 的历史价格那条腿。 - futu 解析 spot 时顺带拿到的标的报价比"仅最新价"丰富(今日开高低/昨收/ 成交量),但终究是快照不是序列,替代不了 HV 计算需要的 ~250 交易日历史, 这两个模块的股价腿仍然只能走 yfinance。 新增 §3.6,充实 §3.3/§4.1,TL;DR 加两行。无代码改动,无新增 ADR。 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.
目的
回应对 futu 探索文档的追问:"既然期权数据换成 futu、股价仍走 yfinance,按这个边界给模块做划分是否有帮助、哪些模块两种数据都用、futu 期权数据能否顺带给一点股价信息(如最新价)满足这些模块?"
用 grep 校验过实际调用点,不是猜测。无代码改动,无新增 ADR。
结论(新增 §3.6,充实 §3.3/§4.1,TL;DR 加两行)
fetch_option_chain,futu 接入零影响spot是fetch_option_chain()内部顺带解析、塞进同一份快照的,不是第二数据源services/options/chain.py的 Vol Premium 区块;②services/options/builder.py::_vol_context关键点:这两处的历史价格调用和期权链调用本就是两次独立函数调用,只在最后合并成两个派生标量(HV 百分位数字、IV 百分比数字),不共享底层数据。给期权侧换 futu,完全不需要碰这两处的历史价格那条腿——
DataService.get_cleaned_daily/build_data_context照常走 yfinance。futu 解析
spot时顺带对标的代码做的subscribe+get_stock_quote,返回的是当日完整快照(最新价+今日开高低+昨收+成交量),比"仅最新价"丰富,但终究是快照不是序列——替代不了 HV 计算需要的历史数据,这两个模块的股价腿无论如何都得继续走 yfinance。文档里也标注了一条要主动避免的坑:不要为了"省一次调用"把这两处的历史价格改成复用期权链快照里的现价,那会把 252 天历史悄悄换成 1 天数据,HV 数字会算错。检查
python scripts/doc_guard.py— cleanruff format --check— clean(这次改动没有触发上次那个 markdown 里 python 代码块的格式问题)🤖 Generated with Claude Code