技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
residual-edge-analyzer【数据与研究】Separate a strategy return series into declared baseline exposure and residual edge with returns-based OLS attribution, HAC inference, rolling stability, alternate-baseline sensitivity, and regime breakdowns. Use when evaluating whether backtest, out-of-sample, or live returns contain independent alpha beyond market, equal-weight, momentum, sector, o…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Test whether a strategy's apparent performance survives explicit comparison with predeclared baseline return series. Produce an auditable JSON artifact and a concise Markdown report without fetching data or changing trading exposure.
Treat this as a falsification gate after backtest-expert, not as trade authorization.
State the claimed independent edge in one sentence. Select a primary baseline that is a plausible simple copy of the strategy, then select at least one alternate baseline model.
Record these declarations in the config:
baseline_selection: predeclaredstrategy_return_basis and baseline_return_basis: both gross or both netanalysis_scope: out_of_sample, live, or in_sampleuniverse_data: point_in_time, current_constituents, or not_applicableEvery declaration is mandatory for a decision-grade verdict. Omitting one is treated as
undeclared, not as benign, and drops the report to REVIEW_REQUIRED. not_applicable
exists so that a baseline with no universe membership can be declared explicitly rather
than left blank.
Do not choose a baseline because it gives the preferred residual result.
Require:
Stop if the input lacks a dated strategy return series. Report summary-only input as insufficient rather than inventing observations.
python3 skills/residual-edge-analyzer/scripts/analyze_residual_edge.py \
--input reports/strategy_returns.csv \
--config reports/residual_edge_config.json \
--output-json reports/residual_edge_report.json \
--output-markdown reports/residual_edge_report.md
The script runs the predeclared primary model and all sensitivity models in one execution. It uses an intercept OLS model and HAC/Newey-West standard errors. It reports the residual edge ratio as annualized alpha divided by annualized residual volatility; do not calculate a Sharpe ratio from raw OLS residual mean because an intercept makes that mean zero.
Use the four statuses as diagnostic labels:
RESIDUAL_EDGE: alpha, residual edge ratio, and rolling stability clear configured
thresholds.BASELINE_EXPLAINED: baseline R-squared is high while residual evidence is weak.RESIDUAL_FRAGILE: results fail one or more robustness gates or change across declared
baseline models. Also use this status when rolling analysis is disabled, unavailable,
incomplete, or no sensitivity model was supplied.INSUFFICIENT_EVIDENCE: the sample is below the configured minimum.Read decision_eligibility separately. A statistically interesting result remains
REVIEW_REQUIRED when critical provenance, cost-basis, sample, or multicollinearity
warnings exist, when rolling evidence is unavailable, or when no alternate baseline was
tested.
Inspect:
backtest-expert.signal-postmortem.trade-performance-coach.scripts/analyze_residual_edge.py — deterministic CSV-to-JSON/Markdown analyzer.references/input-contract.md — CSV/config contract and runnable example.references/methodology.md — statistical definitions, interpretation, and limitations.