Communitygithub.com

austin-starks/Public-Portfolio-Challenge

运行并读取 NexusTrade 的滚动样本外研究——这是“公共投资组合挑战”背后的认证引擎。用于认证固定投资组合(backtest_only)或重新优化(sweep),设置 fold_count / anchored / validation / embargo 参数,监控 run_walk_forward_study 直至完成,读取每轮的 OOS 收益率/Sortino/回撤,或当变体的滚动日历需要与基础控制进行日历对齐时。需连接 NexusTrade MCP 后调用。

Public-Portfolio-Challenge 是什么?

该技能(Skill)是 NexusTrade 平台上一个确定性样本外(Out-of-Sample, OOS)认证引擎,专门用于“公共投资组合挑战”的资格认证。它通过执行滚动窗口研究(Walk-Forward Study),以多个样本外折叠(OOS folds)的独立表现为最终评判依据,而非单一回测。技能支持认证固定投资组合(backtest_only)或通过遗传算法进行再优化(sweep),并允许用户精细控制折叠数、固定窗口或递增窗口模式、验证集比例及贸易静默期等参数。 使用前必须通过 MCP 连接 NexusTrade 工具,并通过 `preview_only: true` 预览折叠日历以确认时间跨度(必须覆盖 2022 年熊市和 2025 年 4 月抛售),然后正式运行并获取 `study_id`。技能还强制要求严格的前置检查,包括移除 LaunchAgent 策略、检查期权价差结构合规性,并监控研究状态以发现静默失败、窗口错误、回测污染或 NaN 折叠等故障模式。 每次认证的最终裁决基于七个严格步骤:逐轮输出 OOS 收益率、Sortino 比率、最大回撤等指标;与独立回测进行散点检查;分析退化程度(训练集 vs OOS);诚实披露回撤;执行广度审核;进行字段级可复现性审计;并验证期权价差结构合规性。此外,技能会自动对齐变体与基准之间的滚动日历,确保比较的公平性。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/austin-starks/Public-Portfolio-Challenge/tree/HEAD/skills/walk-forward-oos

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

滚动样本外认证

确定性样本外引擎。滚动窗口,验证模式,固定锚定,5 轮,2022→至今 — OOS 轮次是最终裁决,而非单一回测。

研究调用

mcp__nexustrade__run_walk_forward_study(工具是延迟加载的 — 通过 ToolSearch 加载)。始终先将 preview_only: true 设为 true,预览折叠日历和成本,确认其时间范围覆盖 2022→至今(必须同时包含 2022 年熊市和 2025 年 4 月抛售 — 本书最深回撤是一个 2025 年 4 月事件,因此折叠必须覆盖它),然后翻转为 false 并记录 study_id。

{
  "portfolio_id": "<SUBJECT 或一个干净的克隆>",
  "global_start_date": "2022-01-01",
  "global_end_date":   "<TODAY>",
  "fold_count": 5,
  "walk_forward_mode": "anchored",
  "mode": "validation",              // 逐轮独立 OOS
  "oos_width_days": 252,
  "embargo_days": 14,
  "interval": "Day",
  "inner_mode": "backtest_only",     // 认证固定的投资组合 — 无需逐轮优化器
  "preview_only": true               // 翻转为 false 以实际运行
}
  • 认证固定投资组合: inner_mode: "backtest_only"(engine_kind 为 ga/default — 对于固定配置认证,sweep 会被拒绝)。
  • 重新优化(仅在失败或结构性变更时): engine_kind: "sweep",inner_mode: "optimize",certification: true,加上 gene_intents。GA 会过拟合,并且对于部署认证会被拒绝 — sweep 才是认证路径。 请参阅 sweep-reoptimization。
  • certification: true 应用活动底仓 + percentChange ≥ 0 + sortino ≥ 0.5 策略,并将 validation_percent 默认设为 50。

认证实时投资组合前的预检流程

  1. get_portfolio — 捕获策略集、conditionFieldAudit 和退出阶梯。
  2. 移除 LaunchAgent。 LaunchAgent 策略无法在历史数据上运行 — 它仅触发一次并记录数千个 cooldownSkip 事件,污染折叠。认证一个无 LaunchAgent 的克隆(仅包含再平衡和关闭规则)并说明您已这样做。
  3. 价差结构检查 实时结构(请参阅 options-structure-rules)。一个长日期的垂直价差是严重违规 → 投资组合无法按原样认证;直接进入重新优化。
  4. 凸性上限陷阱: 如果存在多个“始终”止盈平仓条件(例如 P/L ≥ 20% / 50% / 200%),则 最低的首先生效,并将所有赢家限制在约 +20%,破坏了直接看涨期权的原理。请标记出来 — 这是回报率落后于让赢家奔跑的投资组合的最可能原因。

监控研究

轮询 list_walk_forward_studies / get_walk_forward_study_results <study_id> 直至状态变为终端状态(COMPLETE / ERROR / CANCELLED)。使用 jq 解析 — 有效载荷很大,不要直接转储。 关注已知的故障模式并将其上报(不要掩盖 — 这会是 bug-protocol 的触发条件):

  • 静默失败 / ERROR — 无折叠统计信息 / 空的 validationAggregate。请报告;不要凭空捏造结论。
  • 窗口错误 — 折叠日历并非从 2022-01-01 开始 / 跳过了熊市。
  • 回测污染 — LaunchAgent 在折叠中触发(应在预检中移除)。
  • 零交易 / NaN 折叠 — 上游头寸标记损坏;报告哪些折叠,切勿对 NaN 求平均值。
  • 研究超出预期成本/时间而真正挂起 → 停止,汇总,等待人工处理(引擎可能在另一个标签页中修复中)。

强制性的逐轮检查(这些就是裁决)

  1. 逐轮 OOS 表 — 对每一轮:训练窗口、OOS 窗口、OOS 收益率、OOS 最大回撤、OOS Sortino 比率、中位数部署、不同标的、参与率。加上 validationAggregate。
  2. 独立重新回测散点检查 — 对完整周期(2022-01-01→至今)、2022 年熊市(2022-01-01→2023-01-01)以及最近 12 个月运行 backtest_portfolio($25k);对完整周期运行 audit_backtest_posture。研究折叠必须与新的独立回测一致。对于期权投资组合,基准 ≠ SPY — 请使用一个实质标的或等权指数买入并持有,并注明。
  3. 退化分析 — 每轮的训练集 vs OOS。训练集→OOS 的大幅下降 = 过拟合,即使完整周期回测看起来很好。
  4. 诚实披露回撤 — 每轮 OOS 最大回撤与 OOS 收益率并列;优先展示风险。在此杠杆下,一轮可以同时获得巨大回报和 50–77% 的回撤。
  5. 广度审核 使用固定的 $25k(breadth-audit)。
  6. 可复现性 / 字段审计 — conditionFieldAudit 与预期调节旋钮匹配;在重新运行上执行 compare_backtests {tolerance_bps: 0}。按字段验证,切勿按显示名称验证。
  7. 价差结构合规性(options-structure-rules)— 违规则硬性拒绝。

日历对齐(变体与基准)

滚动窗口引擎将折叠日历裁剪到指标/数据的覆盖范围,因此变体的研究可能静默地获得与基准不同的折叠。始终使用与变体裁剪日历相同的 global_end_date 运行一个基准控制,并逐轮进行比较。在逐轮 OOS 旁边报告每轮的信号覆盖范围。一个仅在信号存在时才获胜的变体是一个发现,而非作弊 — 但请注明。

Individual skills in this repo

This repo contains 11 individual skills — each has its own dedicated page.

austin-starks/Public-Portfolio-Challenge

Build alternative-data custom indicators on NexusTrade (Reddit/WSB mentions, congressional disclosures, insider filings, news-flow) and wire them into a certified book as a rank/tilt/filter signal. Use when adding alt-data to a strategy, building a CustomIndicator via compute sessions, auditing lookahead safety or per-ticker coverage, or deciding whether a data series is dense enough to drive a rank. Covers the compute-session workflow, the sparse-series rule, and source recipes (see references/). Invoke with the NexusTrade MCP connected.

austin-starks/Public-Portfolio-Challenge

Measure a NexusTrade options book's TRUE participation at a fixed cold-start capital base, defeating the compounded-NAV breadth illusion. Use whenever a book's headline \"holds N/21 names\" needs validating, when a live book collapses to a single name (the OSCR trap), when checking whether a SelectTop / per-name-allocation / total-budget change degraded simultaneous participation, or when a certification needs a breadth gate. Uses audit_backtest_breadth at held-fixed $25k.

austin-starks/Public-Portfolio-Challenge

The \"loudly declare\" protocol for platform, engine, or data bugs during a NexusTrade certification campaign — bugs are a first-class deliverable, not something to route around. Use whenever a NexusTrade tool errors, hangs, or returns numbers that contradict the config; whenever you're tempted to write \"probably an engine quirk\"; or when a discovered bug invalidates prior backtests and results must be quarantined. Includes the bug hand-off doc template (see references/BUG_TEMPLATE.md).

austin-starks/Public-Portfolio-Challenge

The GATED deploy + cleanup flow for a NexusTrade live book — clone the finalist, preview a delta reconcile, stage UNAPPROVED orders, verify fills. Use ONLY after the human explicitly says \"deploy + clean up\" and names a finalist. Covers the clone-before-reconcile ordering, the single-tick reconcile expectation, stale-pending-order hygiene, the signal-freshness gate, and why you can never approve orders yourself. Nothing here runs during certification.

austin-starks/Public-Portfolio-Challenge

The mandatory pre-flight contract checks (Stage S0) that must pass before trusting NexusTrade's certification engine for any strategy work. Use at the start of a bakeoff or certification campaign to prove the walk-forward engine runs end-to-end, windows don't leak, fold winners persist, and the engine doesn't fabricate values for dead/not-yet-listed names. Each check has a STOP-and-report failure mode; these runs do NOT count toward any certification minimum.

austin-starks/Public-Portfolio-Challenge

The single-touch lockbox — a final anti-overfitting holdout run once, after design freeze, on a window held out from every fold, sweep, and search. Use when finalizing a bakeoff winner before deploy, setting up the A/B/C baselines as OOS bars, or running the S1.5 gate-coherence auto-relax. Covers why looking at the lockbox twice burns it, the lockbox pass conditions, and the three baselines. The lockbox is distinct from the walk-forward OOS folds.

austin-starks/Public-Portfolio-Challenge

The hard structural constraints for the Public Portfolio Challenge momentum-LEAP options book — the spread-shape rule, the take-profit convexity-cap footgun, the affordability ladder, and the known losers not to re-test. Use whenever building or auditing an options strategy structure, checking spread-shape compliance before a certification, choosing DTE/strike rungs, or deciding whether a proposed structure change is even allowed. A violation is an automatic certification FAIL.

austin-starks/Public-Portfolio-Challenge

Orchestrate an out-of-sample certification of a NexusTrade trading strategy or live book — the master discipline behind the Public Portfolio Challenge. Use whenever you must decide PASS/FAIL on whether a portfolio holds up out of sample before deploying real money, replaying the Episode 10 runbooks, or running a \"certify my book\" / \"prove it out of sample\" / \"re-certify the fix\" task with the NexusTrade MCP connected. Pulls in walk-forward-oos, breadth-audit, sweep-reoptimization, options-structure-rules, bug-protocol, and deploy-gate.

austin-starks/Public-Portfolio-Challenge

The single entry point that executes a Public Portfolio Challenge episode or addendum runbook end-to-end, delegating each stage to the functional skills. Use when asked to run/execute/replay Episode 10, its bakeoff, or its addendum with the NexusTrade MCP connected. Reads the target runbook, pins its real artifacts (IDs, the incumbent bar), sequences the stages, and stops at the gated deploy. It orchestrates; the functional skills do the work.

austin-starks/Public-Portfolio-Challenge

Run a multi-family strategy bakeoff — the SEARCH→CERTIFY funnel that screens many candidate mechanisms down to a certified deploy winner without letting the cheap search layer issue a verdict. Use when replaying the Episode 10 bakeoff, when exploring several distinct strategy families before certifying, when deciding whether \"no deployable winner\" is even a legal conclusion, or when building the per-family certification ledger. Enforces verdict-integrity: only certification can end a campaign.

austin-starks/Public-Portfolio-Challenge

Re-optimize a NexusTrade strategy with a walk-forward SWEEP and label parameter provenance — the discipline that prevents deploying inherited knobs. Use whenever a structural change (sizing, rung depth, universe membership, DTE family, adding a rank signal) forces a re-sweep, when authoring gene_intents from get_sweep_surface, when choosing sweep over GA for a deploy cert, or when selecting the cross-fold-robust winner instead of the per-fold argmax. Invoke with the NexusTrade MCP connected.

相关技能