tradermonty/signal-postmortem

Registre e analise os resultados pós-negociação de sinais gerados pelo pipeline edge e outras habilidades. Acompanhe falsos positivos, oportunidades perdidas e incompatibilidades de regime. Alimente os resultados de volta para os pesos do edge-signal-aggregator e para o backlog de melhoria de habilidades.

O que é signal-postmortem?

Signal Postmortem é uma skill projetada para registrar e analisar os resultados de sinais de trading gerados pelo pipeline edge, screeners e outras habilidades. Ela compara a direção prevista do sinal com os retornos realizados em 5 e 20 dias, categorizando os resultados em verdadeiros positivos, falsos positivos, oportunidades perdidas e incompatibilidades de regime. A skill gera feedback para ajustes de peso no edge-signal-aggregator e entradas no backlog de melhoria de habilidades, fechando o ciclo de feedback para melhorar continuamente a qualidade dos sinais. Suporta entrada manual de dados ou busca automática de preços via API FMP e produz relatórios em JSON, YAML e Markdown.

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

Installed? Explore more Programação e Desenvolvimento skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Signal Postmortem

Visão Geral

Signal Postmortem registra e analisa os resultados de sinais de trading gerados pelo pipeline edge, screeners e outras habilidades. Ele compara a direção prevista contra os retornos realizados em 5 e 20 dias, categoriza os resultados (verdadeiro positivo, falso positivo, oportunidade perdida, incompatibilidade de regime) e gera feedback para ajustes de peso no edge-signal-aggregator e entradas no backlog de melhoria de habilidades.

Quando Usar

  • Após o fechamento de uma operação e você deseja registrar o resultado
  • Ao revisar um lote de sinais que atingiram seu período de manutenção (5 ou 20 dias)
  • Para identificar padrões sistemáticos de falsos positivos de habilidades específicas
  • Para gerar feedback para calibragem de pesos do edge-signal-aggregator
  • Ao construir um backlog de melhoria de habilidades a partir de métricas de qualidade de decisão
  • Para auditorias periódicas (semanais/mensais) de qualidade de sinais

Pré-requisitos

  • Python 3.9+
  • Chave da API FMP (opcional, para buscar retornos realizados se não fornecidos manualmente)
  • Biblioteca padrão + requests para chamadas de API
  • Entrada: registros de sinais em formato JSON (saídas do edge-signal-aggregator ou screeners)

Configuração da Chave da API (Opcional)

Se você deseja buscar automaticamente dados de preços para cálculos de retorno, configure a chave da API FMP:

export FMP_API_KEY=sua_chave_api_aqui

Alternativamente, passe a chave via linha de comando com --api-key SUA_CHAVE. Sem uma chave de API, você ainda pode registrar resultados manualmente fornecendo --exit-price e --exit-date.

Fluxo de Trabalho

Passo 1: Preparar Registros de Sinais

Reúna registros de sinais fechados ou maduros. Cada registro deve incluir:

  • signal_id: Identificador único
  • ticker: Símbolo da ação
  • signal_date: Data em que o sinal foi gerado
  • predicted_direction: LONGO ou CURTO
  • source_skill: Qual habilidade gerou o sinal
  • entry_price: Preço na geração do sinal (opcional, para substituição manual)
# Exemplo: Listar sinais prontos para postmortem (5+ dias de idade)
python3 skills/signal-postmortem/scripts/postmortem_recorder.py \
  --list-ready \
  --signals-dir state/signals/ \
  --min-days 5

Passo 2: Registrar Resultados

Execute o gravador de postmortem para buscar retornos realizados e classificar resultados.

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/

Para registro manual de resultados (quando os dados de preço já estão disponíveis):

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 "Fechado no alvo, +3,2% em 5 dias" \
  --output-dir reports/

Passo 3: Classificar Resultados

O gravador classifica automaticamente cada sinal em uma das quatro categorias:

CategoriaDefinição
TRUE_POSITIVEA direção prevista coincidiu com o sinal do retorno realizado
FALSE_POSITIVEA direção prevista foi oposta ao retorno realizado
MISSED_OPPORTUNITYSinal não aproveitado, mas teria sido lucrativo
REGIME_MISMATCHSinal falhou devido a mudança de regime de mercado

As regras de classificação estão documentadas em references/outcome-classification.md.

Passo 4: Gerar Arquivos de Feedback

Gere feedback para consumidores downstream:

# Gerar sugestões de ajuste de peso para o edge-signal-aggregator
python3 skills/signal-postmortem/scripts/postmortem_analyzer.py \
  --postmortems-dir reports/postmortems/ \
  --generate-weight-feedback \
  --output-dir reports/

# Gerar entradas no backlog de melhoria de habilidades
python3 skills/signal-postmortem/scripts/postmortem_analyzer.py \
  --postmortems-dir reports/postmortems/ \
  --generate-improvement-backlog \
  --output-dir reports/

Passo 5: Revisar Estatísticas Resumidas

Gere estatísticas agregadas por habilidade, por ticker e por período de tempo:

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

Formato de Saída

Registro de Postmortem (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": "Rompimento limpo, mantido durante pequena correção",
  "recorded_at": "2026-03-17T10:30:00Z"
}

Feedback de Pesos (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% de taxa de falso positivo no regime RISK_OFF",
      "sample_size": 42
    }
  ],
  "confidence": "MEDIUM",
  "min_sample_threshold": 20
}

Entrada no Backlog de Melhoria de Habilidades (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: "Adicionar filtro de regime ou reduzir confiança do sinal em RISK_OFF"
  generated_by: signal-postmortem
  generated_at: "2026-03-17T10:35:00Z"

Relatório Resumido (Markdown)

Os relatórios são salvos em reports/ com nomes de arquivo postmortem_summary_YYYY-MM-DD.md.

Recursos

  • scripts/postmortem_recorder.py -- Grava resultados individuais de sinais
  • scripts/postmortem_analyzer.py -- Gera feedback e estatísticas resumidas
  • references/outcome-classification.md -- Regras de classificação e casos extremos
  • references/feedback-integration.md -- Como integrar feedback com habilidades downstream

Princípios Chave

  1. Atribuição Honesta -- Cada resultado é atribuído à sua habilidade de origem para responsabilidade
  2. Consciência de Regime -- O contexto de regime é registrado para distinguir falha de habilidade de mudanças de regime de mercado
  3. Tamanho Mínimo de Amostra -- Ajustes de peso exigem 20+ sinais para validade estatística
  4. Fechamento do Ciclo de Feedback -- Os resultados fluem de volta para melhorar tanto a agregação de sinais quanto a qualidade das habilidades

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).

Habilidades Relacionadas