Repository navigation
feat(research_stats): RS-01 research-only PSR/DSR, bootstrap CI, cost stress, backtest_report.v1 - #658
Merged
Conversation
…ap, cost stress, backtest_report.v1 - New isolated package quant_platform_kit.research_stats (research-only). - PSR/DSR fail closed to UNCOMPUTABLE (value=None) on <2 trials, zero trial-Sharpe variance, short or invalid samples; never zero. - Stationary block bootstrap CIs with mandatory seed (numpy lazily imported). - Cost-stress recompute at 1x/2x/3x; invalid input is PARKED. - qsl.backtest_report.v1 dataclasses + packaged JSON Schema with live_ready=false / no_order=true invariants. - numpy/pandas only via new optional 'research' extra; core deps stay empty. - Import-boundary tests: no production module imports research_stats, and research_stats imports without numpy. - Synthetic-data tests only; no real backtest numbers. QPK_PIN untouched.
Contributor
Author
|
Self-review(rebuild):
|
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.
RS-01:研究统计原语 +
backtest_report.v1(research-only)新增隔离包
quant_platform_kit.research_stats,服务于 QSL 回测标准 v1(研究方案 §2/§6)。研究-only:不读账户、不调用券商、不下单、不写风险政策,不授予 paper/shadow/live 权限。内容
sharpe_inference:PSR(Bailey & López de Prado 2012)、DSR(2014)、期望最大 Sharpe。试验数 < 2、有效试验数 > 已登记数、试验 Sharpe 方差为 0、样本不足/非法 →UNCOMPUTABLE,value=None(缺失永不记为 0)。仅标准库。bootstrap:平稳块自助法(Politis & Romano 1994)给单期对数增长、单期 Sharpe、MDD(含初始净值)的百分位 CI;seed为必填关键字参数,同输入同 seed 结果可复现;numpy 延迟 import。cost_stress:按声明口径net = (1 − τ·c)(1 + gross) − 1重算 1×/2×/3× 成本情景;非法输入 →PARKED。backtest_report:BacktestReportV1冻结 dataclass + 打包的schemas/backtest-report.v1.schema.json。live_ready=false/no_order=true恒定;非 COMPUTED 指标必须value=null+reason_code;development 数据不得标OOS_EVALUATED;基准必须same_dates=true。pyproject.toml:新增可选 extraresearch = [numpy, pandas];核心dependencies仍为[]。uv.lock仅手工加入该 extra 条目(未重新解析,避免无关 churn)。docs/research_stats.zh-CN.md。边界测试(
tests/test_research_stats_import_boundary.py)research_stats之外的 QPK 模块均不 import 它;research_stats也不 import QPK 其他模块。research_stats未被加载。research_stats并计算 PSR/成本压力;bootstrap 抛出提示[research]的 ImportError。researchextra。未做 / 非目标
performance_metrics等现有共享指标函数;不改QPK_PIN,不升级任何下游 pin,不接入任何消费者。本地验证
ruff check .通过;pytest tests/test_research_stats_*.py:51 passed。test_strategy_benchmark_catalog失败,在未改动的origin/main上同样失败(本地环境问题,main CI 绿),与本 PR 无关。