Calculateur P&L

VérifiéSûr

Cette compétence calcule et affiche les métriques de profit et perte (P&L) d'un portefeuille de trading. Elle prend en charge différentes périodes (quotidien, depuis le début du mois, depuis le début de l'année) et fournit une analyse d'attribution, des répartitions par stratégie ou symbole, ainsi qu'un résumé des gagnants et perdants. Utilisez-la pour évaluer rapidement la performance du portefeuille et identifier les sources de P&L.

Spar Skills Guide Bot
Data & IAIntermédiaire
5002/06/2026
Claude Code
#pnl#profit-loss#trading-metrics#financial-analysis#attribution-analysis

Recommandé pour

Notre avis

Calcule et affiche les métriques de profit et perte (P&L) avec attribution détaillée, incluant les composantes réalisées et non réalisées, les frais et le financement.

Points forts

  • Vue complète du P&L avec ventilation par stratégie et par symbole
  • Affichage des meilleurs et pires performers avec graphique cumulatif ASCII
  • Analyse d'attribution détaillée (allocation, sélection, timing, facteurs)
  • Support de plusieurs périodes (aujourd'hui, MTD, YTD) et filtres

Limites

  • Dépend d'une API externe pour les données de négociation
  • Graphique ASCII limité pour des intervalles complexes
  • Nécessite que les données soient structurées selon les composants attendus
Quand l'utiliser

Utilisez cette compétence pour obtenir un aperçu rapide de la performance de trading avec décomposition par stratégie, symbole et attribution.

Quand l'éviter

Ne l'utilisez pas si vous avez besoin de données transactionnelles en temps réel ou d'analyses granulaires au niveau de chaque trade.

Analyse de sécurité

Sûr
Score qualité90/100

The skill only fetches data from an internal API and formats it for display. There are no destructive, exfiltrating, or code-execution instructions.

Aucun point d'attention détecté

Exemples

Today's P&L summary
Show me today's P&L with breakdown by strategy and top winners/losers.
Month-to-date attribution
Show me month-to-date P&L attribution including asset allocation and security selection.
P&L by symbol with realized only
Show me P&L for AAPL, realized only, for the last 10 days.

name: pnl description: Calculate and display P&L metrics and attribution argument-hint: "[--today|--mtd|--ytd|--attribution]"

P&L Calculator

Calculate and display profit & loss metrics with attribution.

Usage

  • /pnl - Today's P&L summary
  • /pnl --mtd - Month-to-date P&L
  • /pnl --ytd - Year-to-date P&L
  • /pnl --attribution - P&L attribution analysis
  • /pnl --by-strategy - P&L by strategy
  • /pnl --by-symbol AAPL - P&L for specific symbol
  • /pnl --realized - Only realized P&L

P&L Components

| Component | Description | |-----------|-------------| | Realized | Closed position P&L | | Unrealized | Open position mark-to-market | | Fees | Trading fees and commissions | | Financing | Margin interest, borrowing costs | | FX | Currency conversion impact |

Instructions

When this skill is invoked:

  1. Parse arguments:

    • No args: Today's P&L
    • --mtd: Month-to-date
    • --ytd: Year-to-date
    • --days N: Last N days
    • --attribution: Detailed attribution
    • --by-strategy: Group by strategy
    • --by-symbol: Filter to symbol
    • --realized: Only closed P&L
  2. Fetch P&L data:

    • API endpoint: GET /pnl
    • With period: ?period=mtd
  3. Display P&L summary:

    ═══════════════════════════════════════════════════════════
                      P&L SUMMARY - TODAY
    ═══════════════════════════════════════════════════════════
    
    Gross P&L:          +$4,250.00
    Fees & Commissions:    -$125.50
    Financing:              -$45.00
    ─────────────────────────────────────────────────────────
    Net P&L:            +$4,079.50  (+0.33%)
    
    BREAKDOWN
    ─────────────────────────────────────────────────────────
    Realized:           +$2,150.00
    Unrealized:         +$1,929.50
    
    BY STRATEGY
    ─────────────────────────────────────────────────────────
    Momentum:           +$2,500.00  ████████████
    Mean Reversion:       +$800.00  ████
    Stat Arb:             +$779.50  ███
    
  4. For --attribution:

    • Asset allocation: Contribution by asset class
    • Security selection: Alpha from stock picking
    • Timing: Contribution from entry/exit timing
    • Factor exposure: Factor-based attribution
    • Residual: Unexplained P&L
  5. Display top winners/losers:

    TOP WINNERS                    TOP LOSERS
    ─────────────────────────────────────────────
    NVDA    +$1,250 (+2.1%)       TSLA    -$450 (-1.2%)
    AAPL      +$890 (+1.5%)       META    -$320 (-0.8%)
    GOOGL     +$650 (+1.2%)       AMZN    -$180 (-0.4%)
    
  6. Show P&L chart (ASCII):

    Cumulative P&L (MTD)
         │
    $15K ┤                              ╭─
    $10K ┤                    ╭────────╯
     $5K ┤          ╭────────╯
      $0 ┼────╮    ╯
    -$5K ┤    ╰───╯
         └────────────────────────────────
         1    5    10   15   20   25   30
    
  7. Summary metrics:

    • Win rate (% of profitable days)
    • Average win vs average loss
    • Profit factor (gross wins / gross losses)
    • Best/worst day
Skills similaires