The Conditional Value-at-Risk (CVaR) Approach to Portfolio Optimization
Conditional Value at Risk (CVaR), also called Expected Shortfall, measures the average loss in the worst part of a return distribution. This guide explains what CVaR measures, how it differs from Value at Risk (VaR), works through an example you can reproduce in our VaR and CVaR calculator, and shows when to move on to building a CVaR-minimizing portfolio in the portfolio optimizer.
Beyond Variance: Why Variance Is Not the Whole Story
Modern Portfolio Theory (MPT) has been the cornerstone of portfolio construction since Harry Markowitz's 1952 work. It measures risk with variance (or volatility), which has two practical limitations for investors who mainly fear large losses.
First, variance treats gains and losses symmetrically: a large up-move adds as much "risk" as a large down-move. Second, variance on its own describes the whole distribution well only when returns are close to normal (or when investors care only about mean and variance). Real asset returns often have fat tails and skew, so two portfolios with the same volatility can have very different crash losses. Tail measures such as VaR and CVaR look at that part of the distribution directly.
Understanding Conditional Value at Risk (CVaR)
Value at Risk answers: "how bad is a bad day at a given confidence level?" CVaR answers the follow-up: "when it is worse than that, how bad is it on average?"
Getting the sign convention right
Write the portfolio's loss as L = −R, where R is the return. At a 95% confidence level:
- VaR95% is the 95th percentile of the loss distribution, which is the same point as the 5th percentile of the return distribution with its sign flipped. Losses larger than VaR happen about 5% of the time.
- CVaR95% is the average loss in that worst 5%, i.e. the expected loss given that the loss is at least VaR. It is always at least as large as VaR.
CVaR is a coherent risk measure (monotone, sub-additive, positively homogeneous and translation invariant, as defined by Artzner et al., 1999). In particular it is sub-additive, so diversification can never increase it, while VaR can violate sub-additivity for some distributions.
Worked Example: VaR and CVaR from 40 Daily Returns
Take the 40 daily returns that load by default in the calculator's Historical mode. Sorted from worst to best, the four lowest are −5.2%, −4.8%, −3.4% and −2.6%.
- Size of the tail. At 95% confidence the tail holds the worst ⌊40 × 5%⌋ = 2 observations: −5.2% and −4.8%.
- VaR is the smallest loss in that tail: 4.8%. On $100,000 that is $4,800.
- CVaR is the average loss in the tail: (5.2% + 4.8%) / 2 = 5.0%, or $5,000.
At 90% confidence the tail holds ⌊40 × 10%⌋ = 4 observations, so VaR is 2.6% and CVaR is (5.2 + 4.8 + 3.4 + 2.6) / 4 = 4.0%. Notice how CVaR reacts to the single −5.2% day, while VaR at 90% does not see it at all. That sensitivity to the size of the worst losses is the reason to use CVaR.
Finite samples: with few observations, conventions differ. Our calculator uses the worst ⌊n(1 − α)⌋ observations (at least one); other software interpolates between observations and can give slightly different numbers. With only 40 data points the 95% tail rests on two days, so treat any historical CVaR from a short sample as a rough estimate.
The same idea with a normal (parametric) model
If you assume returns are normal with mean μ and volatility σ, there are closed forms: VaR = zασ − μ and CVaR = σ·φ(zα)/(1 − α) − μ, where zα is the standard normal quantile and φ its density. At 95%, z = 1.645 and φ(z)/(1 − α) = 2.063. With the calculator's default daily inputs (μ = 0.04%, σ = 1.2%, $100,000), the one-day VaR is about $1,934 and CVaR about $2,435. The historical figures above are much larger because the sample contains crash days a normal model treats as very unlikely. Always state the horizon: a one-day CVaR is not an annual CVaR.
Calculate VaR and CVaR for your own returns →
From Measuring CVaR to Optimizing It
Measuring CVaR describes a portfolio you already hold. CVaR optimization is a different task: choosing the weights that minimize CVaR (optionally for a target return) across a set of assets.
Rockafellar and Uryasev (2000) showed that, with historical or simulated scenarios, minimizing CVaR can be written as a linear program by adding one auxiliary variable for the VaR level and one for each scenario's excess loss beyond it. That makes it practical even for fairly large portfolios.
Implementation choices
- Confidence level: 95% is common; 99% looks further into the tail but rests on fewer observations.
- Scenarios: historical returns or Monte Carlo simulations (see Monte Carlo simulation for portfolios).
- Sample length: a short history may contain no crisis at all, which makes tail estimates look deceptively low.
- Expected returns: CVaR optimization still needs return assumptions if you set a return target, and those are hard to estimate.
- Rebalancing frequency and trading costs.
Higher confidence levels (for example 99%) focus on more extreme events and often produce more conservative allocations; lower levels give allocations closer to minimum-variance portfolios.
CVaR vs. Mean-Variance Optimization: What to Expect
CVaR and mean-variance optimization agree when returns are normal: in that case minimizing CVaR and minimizing variance lead to the same efficient portfolios. They diverge when assets have skewed or fat-tailed returns, for example options-like strategies, credit, or assets with occasional crashes. Then a CVaR optimizer penalizes assets that contribute to the worst scenarios more heavily than a variance optimizer does.
Whether this produces better results depends on the data and the period. Studies report mixed outcomes, and a CVaR-optimal portfolio built on a calm sample period gives no protection against a type of crisis that is absent from that sample. Treat CVaR optimization as a way to express a preference about tail losses, not as a guarantee of smaller drawdowns.
Integrating CVaR with Other Portfolio Techniques
CVaR and Factor Investing
By incorporating factor investing principles, investors can target specific risk premia while limiting tail risk through a CVaR constraint, rather than through volatility alone.
Regime-Based CVaR Implementation
Tail behavior changes across market regimes. Regime-based allocation can adjust the confidence level or the look-back window to the current environment, at the cost of more model risk.
CVaR and Machine Learning
Machine learning techniques can be used to generate return scenarios for CVaR estimation, but they add their own estimation error and should be validated out of sample.
Practical Implementation Using QuantStock's Portfolio Optimizer
The QuantStock Portfolio Optimizer runs a CVaR minimization on historical returns of the assets you choose:
- Enter the stocks or ETFs you want to combine.
- Select the analysis period and data frequency.
- Choose "Minimize CVaR (Tail Risk)" as the optimization method (the link above selects it for you).
- Set the confidence level (95% is a sensible default).
- Run the optimization and review the weights and risk metrics.
The optimizer uses long-only weights and historical data, so its results describe the past sample, not a forecast.
Limitations and Considerations
Data Requirements
Accurate CVaR estimation needs enough observations in the tail. At 99% confidence, 250 daily returns leave only two observations in the tail.
Estimation Risk
Like any statistical estimate, CVaR moves when the sample changes. Small changes in the worst few observations can shift optimal weights noticeably, so results should be checked for stability (for example on different periods).
Model Assumptions
Historical CVaR assumes the past sample is representative; parametric CVaR assumes a distribution that may understate fat tails. Neither captures events outside the data or the model.
Practical Constraints
Benchmark-relative evaluation, turnover limits and taxes can make a pure CVaR-optimal portfolio impractical; most implementations add constraints.
Frequently Asked Questions
What is the difference between VaR and CVaR?
VaR is a loss threshold: at 95% confidence, losses exceed it about 5% of the time. CVaR is the average of the losses beyond that threshold, so it tells you how severe the bad cases are. CVaR is always at least as large as VaR at the same confidence level.
Is 95% VaR the 5th or the 95th percentile?
It is the 95th percentile of the loss distribution, which corresponds to the 5th percentile of the return distribution with the sign flipped. Both descriptions point to the same number; mixing the two conventions is a common source of errors.
Which confidence level should I use for CVaR?
95% is a common default and balances tail focus with the number of observations available. 97.5% is used for Expected Shortfall in the Basel bank capital framework. 99% describes rarer events but needs much more data to estimate reliably.
How much historical data do I need?
Enough that the tail contains a reasonable number of observations and, ideally, at least one stress period. With 40 observations a 95% tail contains only two; with 1,000 daily returns it contains 50.
When should I use the calculator and when the optimizer?
Use the VaR and CVaR calculator to measure the tail risk of returns you already have (a portfolio, a fund, a strategy). Use the portfolio optimizer when you want to choose weights across several assets that minimize CVaR.
Conclusion
CVaR complements variance by describing what happens in the worst outcomes rather than on average. It is easy to compute from historical returns, it has sound mathematical properties, and it can be minimized efficiently. Its weak point is the data: tail estimates rest on few observations and on the period you choose. Measure first, check how stable the estimate is, and only then optimize.
Sources: Markowitz, H. (1952), "Portfolio Selection", Journal of Finance; Artzner, P., Delbaen, F., Eber, J.-M. and Heath, D. (1999), "Coherent Measures of Risk", Mathematical Finance; Rockafellar, R.T. and Uryasev, S. (2000), "Optimization of Conditional Value-at-Risk", Journal of Risk; Basel Committee on Banking Supervision (2019), Minimum capital requirements for market risk.
Educational content only, not investment advice. See our disclaimer.
Free Trading Math & Risk Cheat Sheet
Every key formula in one PDF: breakeven win rates, expectancy, position sizing, drawdown recovery, volatility drag, VaR and CVaR. Plus occasional emails when we publish new quant tools.