> ## Documentation Index
> Fetch the complete documentation index at: https://raymondchang.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Performance metrics and attribution

> Risk-adjusted metrics, their statistical uncertainty, and P&L attribution for trading strategies.

> [!NOTE]
>
> **Status of this page:** P0 draft. Plain-text formulas; verify the Sharpe standard-error expression against Lo (2002) or Bailey and Lopez de Prado (2012) before implementation.

## 1. Core metrics

| Metric | Definition | Caveat |
| - | - | - |
| Sharpe | Mean excess return / std, annualised by sqrt(periods per year) | sqrt scaling assumes no autocorrelation |
| Sortino | Mean excess / downside deviation | Depends on the target return |
| Max drawdown, Calmar | Peak-to-trough loss; return / max drawdown | Single-path statistic, very noisy |
| Hit rate and payoff ratio | Fraction of winners; avg win / avg loss | Only meaningful together |
| Turnover and cost drag | Traded value / capital; cost in bps of P\&L | Cost model must be realistic |
| Capacity | Size at which impact eats a defined share of gross alpha | Depends on impact curve ([market impact and TCA](https://raymondchang.me/quantitative-research/microstructure/market-impact-tca.md)) |

## 2. Uncertainty in the Sharpe ratio

Under iid normal returns the standard error of the per-period Sharpe is approximately sqrt((1 + SR^2 / 2) / (T - 1)). Skewness and excess kurtosis widen it. Verified example: T = 756 daily observations, annualised Sharpe 1.5 gives a standard error of about 0.58 (annualised), so a two-standard-error band runs from roughly 0.3 to 2.7. Report the interval, not the point estimate.

Autocorrelation matters for strategies with smoothed or illiquid marks: positive autocorrelation inflates annualised Sharpe computed with sqrt scaling. Compute Sharpe on non-overlapping aggregated returns as a check. For selection effects use the deflated Sharpe ratio in [Backtest bias taxonomy](https://raymondchang.me/quantitative-research/backtesting/bias-taxonomy.md).

## 3. P\&L attribution for a trading book

A useful decomposition for a market-making or arbitrage desk:

1. **Edge at fill:** (fill price - mid at fill) x side; positive for passive fills.
2. **Adverse selection / post-fill move:** (mid after horizon - mid at fill) x side.
3. **Inventory carry:** P\&L on inventory held between fills from market moves.
4. **Hedge P\&L and hedge slippage:** hedge instrument gains and execution cost.
5. **Financing, borrow, and fees.**
6. **Model/other residual.**

For options books use the gamma-theta, vega, and hedge-slippage split in [Greeks and hedging error](https://raymondchang.me/quantitative-research/derivatives/greeks-hedging-error.md).

## 4. Factor and benchmark attribution

* Regress strategy returns on market, size, value, momentum, and sector factors to find unintended exposure. A high alpha t-statistic alone is not enough given multiple testing.
* For ETF and index strategies, attribute against the relevant index and the basis.
* Report exposure over time, not only the full-sample beta.

## 5. Reporting standard

Every backtest report should include: universe and period, data source and availability lags, cost model, number of variants tried, gross and net returns, Sharpe with a confidence interval, drawdown profile, turnover, capacity estimate, and sensitivity to costs and latency.

## Points to verify

* The exact standard-error expression with non-normality adjustment (Mertens/Lo form) before use in code.
* Convention for annualisation used by the desk (252 vs 250 days).

## Sources

* Lo (2002), The Statistics of Sharpe Ratios, Financial Analysts Journal.
* Bailey and Lopez de Prado (2012), The Sharpe Ratio Efficient Frontier, Journal of Risk.
* Numerical example checked by calculation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.