Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

performance-attribution

FreeRuns bundled scriptsNot checked

Decompose portfolio returns into explainable components to identify where value was added or lost. Use when the user asks about Brinson attribution…

JoelLewisby JoelLewis★ 273 GitHub stars

About this skill

Performance Attribution

Core Concepts

Brinson-Fachler Attribution (Single Period)

The classic equity attribution model decomposes active return (portfolio return minus benchmark return) into three effects:

  • Allocation effect: Value added by over/underweighting sectors relative to the benchmark
    • A_i = (w_p,i - w_b,i) × (R_b,i - R_b)
    • Rewards overweighting sectors that outperform the total benchmark
  • Selection effect: Value added by picking better securities within each sector
    • S_i = w_b,i × (R_p,i - R_b,i)
    • Rewards outperforming the sector benchmark regardless of weight
  • Interaction effect: Combined effect of both overweighting and outperforming (or vice versa)
    • I_i = (w_p,i - w_b,i) × (R_p,i - R_b,i)
    • Captures the joint benefit of overweighting a sector AND selecting better securities in it
  • Total active return: R_p - R_b = Σ A_i + Σ S_i + Σ I_i

Where: w_p,i = portfolio weight in sector i, w_b,i = benchmark weight in sector i, R_p,i = portfolio return in sector i, R_b,i = benchmark return in sector i, R_b = total benchmark return.

Multi-Period Attribution

Single-period attribution does not compound across periods. Geometric linking methods are required:

  • Carino method: Scales each period's arithmetic effects by c_t = k_t / K, where k = [ln(1 + R_p) - ln(1 + R_b)] / (R_p - R_b) is computed per period (k_t) and for the cumulative returns (K). The scaled effects sum exactly to the full-period active return R_p,cum - R_b,cum
  • Menchero method: Uses a logarithmic approach for smoother decomposition
  • GRAP (Groupe de Recherche en Attribution de Performance): Multiplies each period's effects by the cumulative portfolio return before it and the cumulative benchmark return after it
  • Key principle: the linked effects must sum to the full-period active return with no residual. Carino, Menchero and GRAP target the cumulative difference R_p,cum - R_b,cum; geometric attribution methods target the geometric active return (1 + R_p,cum) / (1 + R_b,cum) - 1. State which one a report uses

Factor-Based Attribution

Decomposes returns into exposures to systematic risk factors:

  • Model: R_p = Σ β_k × F_k + α
    • β_k = portfolio's exposure (loading) to factor k
    • F_k = return of factor k during the period
    • α = residual return unexplained by factors (true alpha)
  • Common factors: Market (MKT), Size (SMB), Value (HML), Momentum (UMD), Quality (QMJ), Low Volatility (BAB)
  • Factor contribution: β_k × F_k for each factor
  • Active factor contribution: (β_p,k - β_b,k) × F_k
  • The model chosen (Fama-French 3, Carhart 4, Fama-French 5, Barra, Axioma) affects results

Fixed-Income Attribution

Decomposes bond portfolio returns into component sources:

  • Yield return (income): Coupon income accrued during the period (yield × time)
  • Roll return: Price appreciation as bonds "roll down" the yield curve toward maturity
  • Curve change return: Impact of parallel and non-parallel yield curve shifts
    • Duration effect: -D × Δy (parallel shift)
    • Curve reshaping: key rate duration contributions
  • Spread change return: Impact of credit spread changes: -spread_duration × Δspread
  • Credit/default return: Losses from defaults or credit events
  • Residual: Unexplained return (convexity effects, model error)

Currency Attribution

For international portfolios, returns decompose into:

  • Local return: Return of the asset in its local currency
  • Currency return: Gain/loss from exchange rate movements
  • Cross-product: Interaction between local return and currency return
  • Total return (base currency): R_base ≈ R_local + R_currency + R_local × R_currency
  • Hedged return: Local return + hedge cost (forward premium/discount)
  • Attribution of active currency decisions: actual currency exposure vs benchmark currency exposure

Holdings-Based vs Returns-Based Attribution

  • Holdings-based: Uses actual portfolio positions; more accurate but requires detailed holdings data at each evaluation point
  • Returns-based (style analysis): Regresses portfolio returns against a set of style indices (e.g., Sharpe style analysis); less precise but requires only return series
  • Transaction-based: Most accurate; accounts for intra-period trading by using actual transaction records

Key Formulas

Formula Expression Use Case
Allocation effect (sector i) A_i = (w_p,i - w_b,i) × (R_b,i - R_b) Sector weighting decisions
Selection effect (sector i) S_i = w_b,i × (R_p,i - R_b,i) Security selection within sector
Interaction effect (sector i) I_i = (w_p,i - w_b,i) × (R_p,i - R_b,i) Joint allocation-selection effect
Total active return R_p - R_b = Σ(A_i + S_i + I_i) Sum of all effects equals active return
Factor return contribution C_k = β_k × F_k Return from factor k exposure
Duration effect ΔP/P ≈ -D × Δy Bond price change from yield sh
Full SKILL.md on GitHub

Install performance-attribution in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

scripts/performance_attribution.py

FAQ

What does the performance-attribution skill do?

Decompose portfolio returns into explainable components to identify where value was added or lost. Use when the user asks about Brinson attribution, allocation vs selection effects, factor-based attribution, fixed-income attribution, or currency attribution. Also trigger when users mention 'what drove my returns', 'was it stock picking or sector bets', 'alpha decomposition', 'multi-period linking', 'interaction effect', 'active return breakdown', or ask why their portfolio outperformed or underperformed the benchmark.

How do I install the performance-attribution skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the performance-attribution skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare performance-attribution with