Communitygithub.com

Sweep再最適化とパラメータ出典管理

NexusTrade戦略をウォークフォワードSWEEPで再最適化し、パラメータ出典をラベル付けします。構造変更(サイジング、ラング深度、ユニバース構成、DTEファミリ、ランクシグナル追加など)が発生した際に、継承されたノブが誤って「最適」とみなされることを防ぐ規律です。

Sweep再最適化とパラメータ出典管理 とは?

このスキルは、AIエージェント(Claude Code, Cursor, Codexなど)向けに設計された、NexusTrade戦略の再最適化とパラメータ出典管理のための厳格な方法論を提供します。NexusTrade MCPに接続して使用します。主な目的は、構造変更後に誤って以前のスイープからノブを継承し、「最適」としてデプロイしてしまうミスを防ぐことです。スキルは3つのルールから構成されます。1) 構造変更時は必ず再スイープする、2) 設計探索と最適化を分離する、3) すべてのデプロイパラメータに出典ラベル(このブックでスイープ済み/継承/手動設定)を付与する。実行手順として、まず`get_sweep_surface`でスイープ可能なフィールド名を取得し、クリーンなシードから`run_walk_forward_study`を`engine_kind:"sweep"`で実行します。GAは過学習を起こすため、デプロイ認定にはスイープのみが認められています。勝者の選択には、フォールドごとのargmaxではなく、クロスフォールドでロバストな設定(全フォールドで最低ソルティノ比が最大のもの)を選びます。カスタムインジケータはスイープ不可で、手動でバリアントグリッドを構築する必要があります。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/austin-starks/Public-Portfolio-Challenge/tree/HEAD/skills/sweep-reoptimization

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Sweep再最適化と出典管理

以下の3つの方法論ルールは、かつて異なる構造でスイープされたノブを継承し、「最適」として提示されたデプロイ候補があったために存在します。

3つの常設ルール(将来の全エピソードに適用)

  1. 構造変更時は必ず再最適化 — 構造をまたいでゲノムを継承しない。 ノブ(TP、 総予算、銘柄ごとのサイズ、ランクウィンドウ、VIXゲート、エントリークールダウン、DTEブラケット)は構造に依存します。構造が変更された場合 — アフォーダビリティラング、ストライク深度、ユニバース構成(例:銘柄追加)、DTEファミリ、エントリー/イグジット形状、または代替データランクシグナルの追加 — 認定前に新しいブックに対してengine_kind:'sweep'のウォークフォワードを再実行してください。継承したノブに対するbacktest_only認定は、ブックが汎化することを確認するだけであり、ノブがその構造に対して適切であることを立証するものではありません。
  2. 「設計の探索」と「選択した設計の最適化」を分離する。 候補設計をスクリーニング → 一つを選択 → その設計のノブを正確にスイープ → その後backtest_onlyで認定する。スクリーニングで設計Xが選ばれた場合、スイープのベースはX自身でなければならず、その隣接設計ではありません。選択されたブックを手動調整したまま、敗者のバリアントをスイープしてはいけません。
  3. デプロイされるすべてのパラメータに出典ラベルを付与する — このブックでスイープ済み / <スタディID>から継承 / 手動設定。 「継承」は緑ではなく黄であり、現在の構造で再スイープされるまではそう扱われます。

自己チェックのトリガーワード: 「ノブを引き継ぐ」、「勝者のパラメータを再利用する」、「新しいラダーに同じ設定」、「すでに認定済み、再スイープ不要」、「単にアロケーションを上げる」。これらが現れた場合、必ず問いかける必要があります:前回ノブが探索されてから構造は変わったか?変わったなら → 認定前に再スイープ。

スイープの実行

  1. 選択したブック(またはクリーンなクローン)に対して最初にget_sweep_surfaceを実行し、実際にスイープ可能なフィールド名を取得する。クリーンなシードから再スイープする — すでにスイープ済みのブックを再スイープすると遺伝子が重複/蓄積する可能性があるため、条件の重複についてフィールド監査を行う。
  2. engine_kind:'sweep'、inner_mode:'optimize'、certification:true、mode:'validation'、アンカー、5フォールド(4フォールドも可)、2022年→今日、oos_width_days:252 を指定してrun_walk_forward_studyを実行する。完全なパラメータブロックについては walk-forward-oos を参照。GAは過学習を起こすためデプロイ認定には不適切です — スイープが認定されたパスです。 最初にpreview_only:trueを指定して遺伝子をコンパイルし、コストをチェックする。
  3. 各スイープは非自明である必要がある:3つ以上のgene_intents軸 × 各軸3つ以上の値(例:BuyingPowerPct、TakeProfitPct、RollTriggerDte、ランク深度、デルタバンド、DTE)。1軸または2値のスイープは対象外です。

正確なスイープフィールドマッピング(これを間違えるとスイープは無意味になります)

  • 利確 = Actionスコープ上のTakeProfitPct。 決してExitCondition/OptionPositionPercentChangeとしてスイープしないでください。
  • ロールDTE = Actionスコープ上のRollTriggerDte(CloseOptionのみをロール)。
  • CloseOptionのPnLトリガー: minPnlPercent:100 = +100% TP; maxPnlPercent:-50 = −50% ストップ; DTEロール = {type:'dte','maxDte':45}。

勝者の選択(ロバスト性重視、argmaxは使わない)

aggregate.crossFoldRobustSelection を読む — metric:'minSortino'、candidateKey、score、 perFoldSortino: 全フォールドで最小バリデーションソルティノ比が最も高いグリッドセル。 これを各フォールドのselectedCandidateKey、aggregate.dominantCandidateKey、 winnerStableAcrossFoldsと比較する。クロスフォールドでロバストな設定をデプロイし、フォールドごとのargmaxは決して使わない — フォールドごとの勝者は高分散ノイズです。

その後、その勝者がファイナリストになる前に、完全なwalk-forward-oosのステージCチェック1~7を実行し、出典ラベル(ルール3)を付与します。

カスタムインジケータはスイープ不可

スイープエンジンのallowedIndicatorTypesにはCustomIndicatorが含まれていないため、代替データインジケータ形状の探索は手動構築のバリアントグリッド(create_portfolio_variant: ベースのディープコピー + JSONポインタパッチ、最初にdry_run)で行い、各々をbacktest_onlyで認定し、手動設定(黄) とラベル付けします。従来のノブ(アロケーション/予算/TP/SelectTop/DTE)は、勝者にノブの再スイープが必要な場合にスイープ可能なままです。 代替データインジケータを参照。

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

Run and read a NexusTrade walk-forward out-of-sample study — the certification engine behind the Public Portfolio Challenge. Use when certifying a fixed portfolio (backtest_only) or re-optimizing one (sweep), when setting fold_count / anchored / validation / embargo params, when monitoring a run_walk_forward_study to completion, when reading per-fold OOS returns/Sortino/drawdown, or when a variant's fold calendar needs calendar-alignment against a base control. Invoke with the NexusTrade MCP connected.

関連スキル