Community程式設計與開發github.com

信號後檢 (Signal Postmortem)

記錄與分析邊緣管道及其他技能所產生交易信號的結果。追蹤誤報、錯失機會以及市場體制不匹配的情況,並將結果回饋至邊緣信號聚合器權重與技能改進待辦事項。

信號後檢 (Signal Postmortem) 是什麼?

「信號後檢」技能專為記錄、分析邊緣交易管道(edge pipeline)、篩選器及其他技能所產生的信號結果而設計。它將預測的方向與5天及20天的實際回報進行比對,並將結果分類為「真陽性」(TRUE_POSITIVE)、「假陽性」(FALSE_POSITIVE)、「錯失機會」(MISSED_OPPORTUNITY)或「市場體制不匹配」(REGIME_MISMATCH)四類。此技能的核心價值在於建立一個完整的反饋閉環:其輸出的結果可用於調整下游的「邊緣信號聚合器」(edge-signal-aggregator)的權重,並為技能改進待辦事項(skill improvement backlog)產生具體條目。它支援自動(透過 FMP API 抓取價格數據)與手動(提供出場價格與日期)兩種記錄方式,並能產出 JSON 格式的後檢記錄、權重調整建議以及 YAML 格式的技能改進待辦事項。此技能對任何使用 AI 代理進行交易信號開發與管理的使用者來說至關重要,因為它能將離散的結果轉化為可執行的系統改進措施,最終提升信號品質與決策績效。

相容平台~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 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

信號後檢

概述

Signal Postmortem 記錄並分析由邊緣管道、篩選器及其他技能所產生的交易信號結果。它將預測的方向與5天及20天的實際回報進行比對,將結果分類(真陽性、假陽性、錯失機會、市場體制不匹配),並為邊緣信號聚合器的權重調整和技能改進待辦事項條目產生反饋。

使用時機

  • 交易平倉後,想要記錄其結果時
  • 回顧一批已達到持有期(5或20天)的信號時
  • 辨識特定技能的系統性假陽性模式時
  • 為邊緣信號聚合器校準權重而產生反饋時
  • 從決策品質指標建立技能改進待辦事項時
  • 進行定期(周/月)信號品質審計時

先決條件

  • Python 3.9+
  • FMP API 金鑰(選用,用於若未手動提供時自動獲取實際回報)
  • 標準庫 + requests 用於 API 呼叫
  • 輸入:JSON 格式的信號記錄(來自邊緣信號聚合器或篩選器輸出)

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:做多或做空
  • 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 "在目標價位平倉,5天內+3.2%" \
  --output-dir reports/

步驟 3:分類結果

記錄器會自動將每個信號分類為以下四個類別之一:

類別定義
TRUE_POSITIVE預測方向與實際回報符號相符
FALSE_POSITIVE預測方向與實際回報相反
MISSED_OPPORTUNITY信號未被採用但原本會盈利
REGIME_MISMATCH因市場體制變化導致信號失敗

分類規則詳見 references/outcome-classification.md。

步驟 4:產生反饋檔案

為下游使用者產生反饋:

# 為邊緣信號聚合器產生權重調整建議
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": "突破乾淨,經歷小幅回調後持穩",
  "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": "在 RISK_OFF 體制下的假陽性率為 15%",
      "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: "在 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).

相關技能