Cornish-Fisher CVaR
The Cornish-Fisher CVaR, also called the modified CVaR or modified Expected Shortfall, averages the Cornish-Fisher VaR over the tail: it corrects the Gaussian CVaR for the skewness and excess kurtosis of the returns. The Cornish-Fisher expansion corrects a quantile rather than a density, so the tail has no closed form and the average is taken over many quantiles.
The formula for the Cornish-Fisher CVaR splits the tail probability alpha (0.05 for the 95% confidence level) into 1,000 equally wide intervals, with \(p_{j}\) the middle of the j-th interval:
\[p_{j} = \frac{(j - 0.5) \cdot \alpha}{1000}\]At each \(p_{j}\) it takes the standard normal quantile \(z_{j}\) and corrects it for the sample skewness S and the sample excess kurtosis K of the returns with the Cornish-Fisher expansion:
\[z_{\text{cf},j} = z_{j} + \frac{\left(z_{j}^{2} - 1\right) \cdot S}{6} + \frac{\left(z_{j}^{3} - 3 \cdot z_{j}\right) \cdot K}{24} - \frac{\left(2 \cdot z_{j}^{3} - 5 \cdot z_{j}\right) \cdot S^{2}}{36}\]The CVaR is then the average of the Cornish-Fisher VaRs at these probabilities, with Mean and Std the average and the sample standard deviation of the returns (with n - 1 in the denominator):
\[\text{Cornish-Fisher CVaR} = \frac{\sum_{j=1}^{1000} (\text{Mean} + z_{\text{cf},j} \cdot \text{Std})}{1000}\]Negative skewness and fat tails make it worse than the Gaussian CVaR, and for close-to-normal returns it converges to the Gaussian CVaR. The expansion is only monotone for moderate skewness and excess kurtosis (Maillard, 2012): beyond that it bends back in the far tail and the Cornish-Fisher CVaR understates the loss.
The Conditional Value at Risk (CVaR), also called the Expected Shortfall (ES), is the average return of the periods that fall at or below the Value at Risk (VaR). Where the VaR says how bad a period gets at the chosen confidence level, the CVaR says how bad the periods beyond it are on average: a 5% CVaR of -0.045 means that the worst one in twenty periods lose 4.5% on average. At the same alpha the CVaR is always at least as bad as the VaR, and the gap between the two shows how fat the tail is.
The CVaR exists because the VaR has two flaws. Artzner, Delbaen, Eber and Heath (1999) set out the properties a coherent risk measure needs, and the VaR fails one of them, subadditivity: the VaR of a portfolio can exceed the sum of the VaRs of its parts, so it can penalise diversification. The VaR also ignores everything beyond its quantile, so a position with rare but catastrophic losses can have the same VaR as a much safer one. The CVaR is coherent (Acerbi and Tasche, 2002) and weighs the size of the losses in the tail, and Rockafellar and Uryasev (2000) showed that it can be minimized as a linear program, which made it a standard objective in portfolio optimization. The Basel Committee’s minimum capital requirements for market risk (the Fundamental Review of the Trading Book) replaced the 99% VaR with the 97.5% Expected Shortfall for banks’ market-risk capital.
The CVaR is a return (negative for a loss). It rests on the few returns in the tail (a year of daily returns at the 95% confidence level leaves about 12 days), so a single extreme day can move it a lot; a longer window or a fitted distribution gives a steadier figure. Compare assets over the same period and confidence level. The methods differ in how they estimate the tail, from the plain history to fitted distributions and volatility models.
Several tail probabilities \(\alpha_{1}\) to \(\alpha_{K}\) can be combined into the Weighted Conditional Value at Risk (Weighted CVaR), the weighted sum of the CVaR at each of them.
The formula for the Weighted Conditional Value at Risk is as follows:
\[\text{Weighted CVaR} = \sum_{k=1}^{K} \text{Weight}_{k} \cdot \text{CVaR}(\alpha_{k})\]Where \(\text{CVaR} (\alpha_{k})\) is the CVaR at the tail probability \(\alpha_{k}\) and \(\text{Weight}_{k}\) its weight. With non-negative weights that sum to 1 this is a spectral risk measure (Acerbi, 2002): it weighs the worst returns more than the CVaR at the largest alpha does, and any weighting of the tail can be built from enough tail probabilities.
Also known as: modified CVaR, modified expected shortfall, mES, CF CVaR.
In the Finance Toolkit this is get_conditional_value_at_risk with method="cornish-fisher", the same function as Conditional Value at Risk (cVaR).
Example · XOM, CVX, COP · 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_conditional_value_at_risk:
from financetoolkit import Toolkit
toolkit = Toolkit(
["XOM", "CVX", "COP"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_conditional_value_at_risk(method="cornish-fisher")
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The data frequency for returns. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “daily”. | "weekly" |
alpha | float | list[float] | The tail probability for the CVaR calculation (e.g., 0.05 for the 95% confidence level), or a list of them for the Weighted CVaR. Defaults to 0.05. | 0.01 |
within_period | bool | Whether to calculate CVaR within the specified period or for the entire period. Thus whether to look at the CVaR within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to False. Note that this requires intraday data when period = ‘daily’, since a single day only nests observations when intraday data was fetched. | True |
rolling | int | The rolling window size to use for the calculation. If set, CVaR is calculated over a rolling window of this many periods across the full return history instead of per period (e.g. a rolling 60-day CVaR). Only available for the historic, GARCH and filtered historic methods (the number of returns of every fit, at least 100); see get_acerbi_szekely_test for a rolling, out-of-sample CVaR path under the other parametric distributions. At least 2. Defaults to None. | 20 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the CVaR values over time. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |
method | str | The estimator of the CVaR, a distribution or a model. Options are: “historic” (Historical CVaR, the empirical tail average), “gaussian” (Gaussian CVaR, a normal distribution), “cornish-fisher” (Cornish-Fisher CVaR, the Cornish-Fisher expansion), “studentt” (Student-T CVaR, a Student-T distribution), “laplace” (Laplace CVaR, a Laplace distribution), “logistic” (Logistic CVaR, a logistic distribution), “evt” (EVT CVaR, Extreme Value Theory), “kernel” (Kernel CVaR, a Gaussian kernel density), “garch” (GARCH CVaR, a GARCH-family model), “filtered_historic” (Filtered Historical CVaR, filtered historical simulation). Defaults to “historic”. “garch” and “filtered_historic” fit a GARCH-family model per ticker (and per period with within_period), see get_value_at_risk. | |
threshold_percentile | float | Only used with the “evt” method. The percentile of losses above which the Generalized Pareto Distribution is fitted; alpha can be at most 1 - threshold_percentile, and a larger alpha gives an empty result (with a logged error). The fit needs at least 10 losses above the threshold (about 200 returns at 0.95); a period with fewer is NaN, with a logged warning. Defaults to 0.95. | 0.9 |
alpha_weights | list[float] | None | The weight of the CVaR at each tail probability in alpha, non-negative and summing to 1. Defaults to None, which weighs every tail probability equally. | None, which weighs every tail probability equally |
refit_every | int | Only used with the GARCH and filtered historic methods and rolling. The number of returns between two fits. Defaults to 21. | 21 |
garch_method | str | Only used with the GARCH and filtered historic methods. The variance model of get_garch. Options are: “garch” (GARCH), “gjr” (GJR-GARCH), “egarch” (EGARCH), “igarch” (IGARCH), “aparch” (APARCH), “tgarch” (threshold GARCH), “ngarch” (nonlinear GARCH), “avgarch” (absolute value GARCH), “nagarch” (nonlinear asymmetric GARCH), “component” (component GARCH), “figarch” (FIGARCH). Defaults to “garch”. | "garch" |
garch_distribution | str | Only used with the GARCH and filtered historic methods. The innovation distribution. Options are: “normal” (normal), “t” (Student-t), “skewt” (Hansen’s skewed Student-t), “skewt_fernandez_steel” (Fernández and Steel’s skewed Student-t), “ged” (generalized error distribution), “johnson_su” (Johnson’s SU). Defaults to “normal”. | "normal" |
transform | str | list[str] | None | Time series steps applied in order, such as “sma:12” (moving average), “ema:12”, “std:12”, “zscore:60”, “percentile:120”, “yoy”, “pct_change:3,annualize:3”, “log”, “diff”, “cumsum” or “hp_trend” and “hp_cycle” (Hodrick-Prescott), before growth. A window needs that many periods of history, so the first periods can be empty. Defaults to None. | None |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
Which returns:
| Item | 0 |
|---|---|
| XOM | -0.0409 |
| CVX | -0.0519 |
| COP | -0.0689 |
| Benchmark | -0.0495 |
4 rows
References
- Paper Conditional Value at Risk: Artzner, P., Delbaen, F., Eber, J.-M. and Heath, D. (1999). “Coherent Measures of Risk.” Mathematical Finance, 9(3), 203-228.
- Paper Conditional Value at Risk: Basel Committee on Banking Supervision (2019). “Minimum capital requirements for market risk.”
- Paper Weighted CVaR: Acerbi, C. (2002). “Spectral Measures of Risk: A Coherent Representation of Subjective Risk Aversion.” Journal of Banking & Finance, 26(7), 1505-1518.
- Paper Weighted CVaR: Cajas, D. (2021). “OWA Portfolio Optimization: A Disciplined Convex Programming Framework.” SSRN Electronic Journal.
- Paper Cornish, E.A. and Fisher, R.A. (1938). “Moments and Cumulants in the Specification of Distributions.” Revue de l’Institut International de Statistique, 5(4), 307-320.
- Paper Favre, L. and Galeano, J.A. (2002). “Mean-Modified Value-at-Risk Optimization with Hedge Funds.” Journal of Alternative Investments, 5(2), 21-25.
- Paper Maillard, D. (2012). “A User’s Guide to the Cornish Fisher Expansion.” SSRN Working Paper 1997178.
- Library Shares similar logic as PerformanceAnalytics (R)’s ES (Historical CVaR, Gaussian CVaR, Cornish-Fisher CVaR)