Communityコーディング&開発github.com

tradermonty/signal-postmortem

エッジパイプラインや他のスキルが生成したシグナルの取引後成果を記録・分析します。偽陽性、機会損失、レジームミスマッチを追跡し、結果をエッジシグナルアグリゲーターの重み付けとスキル改善バックログにフィードバックします。

signal-postmortem とは?

Signal Postmortemは、エッジパイプライン、スクリーナー、その他のスキルが生成した取引シグナルの成果を記録・分析するためのスキルです。予測されたエッジ方向と5日および20日の実現リターンを比較し、真陽性、偽陽性、機会損失、レジームミスマッチの4つのカテゴリに分類します。このスキルは、Python 3.9+と、自動価格取得のためにFMP APIキー(オプション)を利用します。出力はJSON形式の事後分析レコード、重み調整フィードバック、YAML形式のスキル改善バックログエントリ、Markdownサマリーレポートとして生成され、エッジシグナルアグリゲーターの重み調整やスキル品質の継続的改善を可能にします。主な利用シーンは、取引クローズ後の成果記録、保有期間が経過したシグナルの一括レビュー、特定スキルからの系統的な偽陽性パターンの特定、定期的なシグナル品質監査です。最小サンプルサイズ(20件以上)での統計的有意性を重視し、レジームコンテキストを記録することでスキル失敗と市場レジームシフトを区別することを原則としています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/tradermonty/claude-trading-skills/tree/main/skills/signal-postmortem

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

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

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

ドキュメント

シグナル事後分析 (Signal Postmortem)

概要

Signal Postmortemは、エッジパイプライン、スクリーナー、その他のスキルによって生成された取引シグナルの成果を記録・分析します。予測されたエッジ方向と5日および20日の実現リターンを比較し、結果をカテゴリ(真陽性、偽陽性、機会損失、レジームミスマッチ)に分類し、edge-signal-aggregatorの重み調整とスキル改善バックログエントリのためのフィードバックを生成します。

使用タイミング

  • 取引がクローズされ、その成果を記録したい場合
  • 保有期間(5日または20日)に達したシグナルのバッチをレビューする場合
  • 特定のスキルからの系統的な偽陽性パターンを特定する場合
  • edge-signal-aggregatorの重み調整のためのフィードバックを生成する場合
  • 意思決定品質メトリクスからスキル改善バックログを構築する場合
  • 定期的(週次/月次)なシグナル品質監査のため

前提条件

  • Python 3.9+
  • FMP APIキー(オプション、手動で提供しない場合に実現リターンを取得するため)
  • 標準ライブラリ + API呼び出し用のrequests
  • 入力:JSON形式のシグナルレコード(edge-signal-aggregatorまたはスクリーナー出力から)

APIキーの設定(オプション)

リターン計算用の価格データを自動取得する場合は、FMP APIキーを設定します:

export FMP_API_KEY=your_api_key_here

または、コマンドラインで --api-key YOUR_KEY としてキーを渡すこともできます。APIキーがない場合でも、--exit-price と --exit-date を指定して手動で成果を記録できます。

ワークフロー

ステップ1:シグナルレコードの準備

クローズ済みまたは成熟したシグナルレコードを収集します。各レコードには以下を含める必要があります:

  • signal_id:一意の識別子
  • ticker:株式シンボル
  • signal_date:シグナル生成日
  • predicted_direction:LONG または SHORT
  • source_skill:シグナルを生成したスキル
  • entry_price:シグナル生成時の価格(オプション、手動上書き用)
# 例:事後分析準備ができているシグナル(5日以上経過)をリスト表示
python3 skills/signal-postmortem/scripts/postmortem_recorder.py \
  --list-ready \
  --signals-dir state/signals/ \
  --min-days 5

ステップ2:成果の記録

事後分析レコーダーを実行して実現リターンを取得し、結果を分類します。

python3 skills/signal-postmortem/scripts/postmortem_recorder.py \
  --signals-file state/signals/aggregated_signals_2026-03-10.json \
  --holding-periods 5,20 \
  --output-dir reports/

手動で成果を記録する場合(価格データが既に利用可能な場合):

python3 skills/signal-postmortem/scripts/postmortem_recorder.py \
  --signal-id sig_aapl_20260310_abc \
  --exit-price 178.50 \
  --exit-date 2026-03-15 \
  --outcome-notes "Closed at target, +3.2% in 5 days" \
  --output-dir reports/

ステップ3:結果の分類

レコーダーは各シグナルを自動的に4つのカテゴリのいずれかに分類します:

カテゴリ定義
TRUE_POSITIVE予測方向が実現リターンの符号と一致
FALSE_POSITIVE予測方向が実現リターンと逆
MISSED_OPPORTUNITYシグナルが取引されなかったが、利益が出ていた可能性がある
REGIME_MISMATCH市場レジームの変化によりシグナルが失敗

分類ルールは references/outcome-classification.md に文書化されています。

ステップ4:フィードバックファイルの生成

下流のコンシューマー向けにフィードバックを生成します:

# edge-signal-aggregatorの重み調整提案を生成
python3 skills/signal-postmortem/scripts/postmortem_analyzer.py \
  --postmortems-dir reports/postmortems/ \
  --generate-weight-feedback \
  --output-dir reports/

# スキル改善バックログエントリを生成
python3 skills/signal-postmortem/scripts/postmortem_analyzer.py \
  --postmortems-dir reports/postmortems/ \
  --generate-improvement-backlog \
  --output-dir reports/

ステップ5:サマリー統計のレビュー

スキル別、ティッカー別、期間別の集計統計を生成します:

python3 skills/signal-postmortem/scripts/postmortem_analyzer.py \
  --postmortems-dir reports/postmortems/ \
  --summary \
  --group-by skill,month \
  --output-dir reports/

出力形式

事後分析レコード(JSON)

{
  "schema_version": "1.0",
  "postmortem_id": "pm_sig_aapl_20260310_abc",
  "signal_id": "sig_aapl_20260310_abc",
  "ticker": "AAPL",
  "signal_date": "2026-03-10",
  "source_skill": "edge-signal-aggregator",
  "predicted_direction": "LONG",
  "entry_price": 172.50,
  "realized_returns": {
    "5d": 0.032,
    "20d": 0.058
  },
  "exit_price": 178.50,
  "exit_date": "2026-03-15",
  "holding_days": 5,
  "outcome_category": "TRUE_POSITIVE",
  "regime_at_signal": "RISK_ON",
  "regime_at_exit": "RISK_ON",
  "outcome_notes": "Clean breakout, held through minor pullback",
  "recorded_at": "2026-03-17T10:30:00Z"
}

重みフィードバック(JSON)

{
  "schema_version": "1.0",
  "generated_at": "2026-03-17T10:35:00Z",
  "analysis_period": {
    "from": "2026-02-01",
    "to": "2026-03-15"
  },
  "skill_adjustments": [
    {
      "skill": "vcp-screener",
      "current_weight": 1.0,
      "suggested_weight": 0.85,
      "reason": "15% false positive rate in RISK_OFF regime",
      "sample_size": 42
    }
  ],
  "confidence": "MEDIUM",
  "min_sample_threshold": 20
}

スキル改善バックログエントリ(YAML)

- skill: vcp-screener
  issue_type: false_positive_cluster
  severity: medium
  evidence:
    false_positive_rate: 0.15
    sample_size: 42
    regime_correlation: RISK_OFF
  suggested_action: "Add regime filter or reduce signal confidence in RISK_OFF"
  generated_by: signal-postmortem
  generated_at: "2026-03-17T10:35:00Z"

サマリーレポート(Markdown)

レポートは reports/ ディレクトリに postmortem_summary_YYYY-MM-DD.md というファイル名で保存されます。

リソース

  • scripts/postmortem_recorder.py -- 個々のシグナル成果を記録します
  • scripts/postmortem_analyzer.py -- フィードバックとサマリー統計を生成します
  • references/outcome-classification.md -- 分類ルールとエッジケース
  • references/feedback-integration.md -- フィードバックを下流スキルと統合する方法

主要原則

  1. 正直な帰属 -- すべての成果は説明責任のために元のスキルに帰属されます
  2. レジーム認識 -- スキルの失敗と市場レジームシフトを区別するためにレジームコンテキストが記録されます
  3. 最小サンプルサイズ -- 重み調整には統計的有意性のために20以上のシグナルが必要です
  4. フィードバックループの閉鎖 -- 結果はシグナル集約とスキル品質の両方を改善するためにフィードバックされます

Individual skills in this repo

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

tradermonty/backtest-expert

Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.

tradermonty/market-environment-analysis

Comprehensive market environment analysis and reporting tool. Analyzes global markets including US, European, Asian markets, forex, commodities, and economic indicators. Provides risk-on/risk-off assessment, sector analysis, and technical indicator interpretation. Triggers on keywords like market analysis, market environment, global markets, trading environment, market conditions, investment climate, market sentiment, forex analysis, stock market analysis, 相場環境, 市場分析, マーケット状況, 投資環境.

tradermonty/market-news-analyst

This skill should be used when analyzing recent market-moving news events and their impact on equity markets and commodities. Use this skill when the user requests analysis of major financial news from the past 10 days, wants to understand market reactions to monetary policy decisions (FOMC, ECB, BOJ), needs assessment of geopolitical events' impact on commodities, or requires comprehensive review of earnings announcements from mega-cap stocks. The skill automatically collects news using WebSearch/WebFetch tools and produces impact-ranked analysis reports. All analysis thinking and output are conducted in English.

tradermonty/options-strategy-advisor

Options trading strategy analysis and simulation tool. Provides theoretical pricing using Black-Scholes model, Greeks calculation, strategy P/L simulation, and risk management guidance. Use when user requests options strategy analysis, covered calls, protective puts, spreads, iron condors, earnings plays, or options risk management. Includes volatility analysis, position sizing, and earnings-based strategy recommendations. Educational focus with practical trade simulation.

tradermonty/portfolio-manager

Comprehensive portfolio analysis using Alpaca MCP Server integration to fetch holdings and positions, then analyze asset allocation, risk metrics, individual stock positions, diversification, and generate rebalancing recommendations. Use when user requests portfolio review, position analysis, risk assessment, performance evaluation, or rebalancing suggestions for their brokerage account.

tradermonty/scenario-analyzer

Skill that analyzes 18-month scenarios from a news headline. Runs the primary analysis with the scenario-analyst agent and obtains a second opinion with the strategy-reviewer agent. Generates a comprehensive English report covering 1st/2nd/3rd-order impacts, recommended stocks, and a critical review. Example: /scenario-analyzer "Fed raises rates by 50bp" Triggers: news analysis, scenario analysis, 18-month outlook, medium-to-long-term investment strategy

tradermonty/sector-analyst

This skill should be used when analyzing sector rotation patterns and market cycle positioning. It fetches sector uptrend data from CSV (no API key required) and optionally accepts chart images for supplementary analysis. Use this skill when the user requests sector rotation analysis, cyclical vs defensive assessment, overbought/oversold identification, or market cycle phase estimation. All analysis and output are conducted in English.

tradermonty/skill-designer

Design new Claude skills from structured idea specifications. Use when the skill auto-generation pipeline needs to produce a Claude CLI prompt that creates a complete skill directory (SKILL.md, references, scripts, tests) following repository conventions.

tradermonty/skill-idea-miner

Mine Claude Code session logs for skill idea candidates. Use when running the weekly skill generation pipeline to extract, score, and backlog new skill ideas from recent coding sessions.

tradermonty/theme-detector

Detect and analyze trending market themes across sectors. Use when user asks about current market themes, trending sectors, sector rotation, thematic investing, what themes are hot or cold, or wants to identify bullish and bearish market narratives with lifecycle analysis.

tradermonty/uptrend-analyzer

Analyzes market breadth using Monty's Uptrend Ratio Dashboard data to diagnose the current market environment. Generates a 0-100 composite score from 5 components (breadth, sector participation, rotation, momentum, historical context). Use when asking about market breadth, uptrend ratios, or whether the market environment supports equity exposure. No API key required.

tradermonty/us-stock-analysis

Comprehensive US stock analysis including fundamental analysis (financial metrics, business quality, valuation), technical analysis (indicators, chart patterns, support/resistance), stock comparisons, and investment report generation. Use when user requests analysis of US stock tickers (e.g., "analyze AAPL", "compare TSLA vs NVDA", "give me a report on Microsoft"), evaluation of financial metrics, technical chart analysis, or investment recommendations for American stocks.

tradermonty/value-dividend-screener

Screen US stocks for high-quality dividend opportunities combining value characteristics (P/E ratio under 20, P/B ratio under 2), attractive yields (3% or higher), and consistent growth (dividend/revenue/EPS trending up over 3 years). Supports two-stage screening using FINVIZ Elite API for efficient pre-filtering followed by FMP API for detailed analysis. Use when user requests dividend stock screening, income portfolio ideas, or quality value stocks with strong fundamentals.

tradermonty/vcp-screener

Screen S&P 500 stocks for Mark Minervini's Volatility Contraction Pattern (VCP) and detect historical VCPs in a single ticker's price path. Identifies Stage 2 uptrend stocks forming tight bases with contracting volatility near breakout pivot points; in historical single-ticker mode walks a multi-year history and emits every VCP that formed with forward-outcome stats (breakout / stop-hit / timeout). Use when user requests VCP screening, Minervini-style setups, tight base patterns, volatility contraction breakout candidates, Stage 2 momentum stock scanning, or historical VCP pattern study on a specific ticker (e.g. FIX, TSLA).

関連スキル