EVT VaR
The EVT VaR uses Extreme Value Theory: it fits a Generalized Pareto Distribution to the losses beyond a high threshold only (peaks over threshold) and takes the VaR from that tail.
The formula for the EVT VaR is as follows:
\[\text{EVT VaR} = -\left(u + \left(\frac{\text{Scale}_{\text{GPD}}}{\xi}\right) \cdot \left(\left(\frac{\alpha}{p}\right)^{-\xi} - 1\right)\right)\]Where u is the loss at a high percentile of the losses (the threshold), xi and Scale_GPD the shape and scale of the Generalized Pareto Distribution fitted to the losses above it, p the fraction of losses above it and alpha the tail probability (0.05 for the 95% confidence level). It models the extreme tail directly and suits small alphas, but rests on few observations, so it needs a long history.
The Value at Risk (VaR) is a risk measure: the return that a period only falls below with a small probability alpha, so a 5% VaR of -0.03 means a loss of more than 3% in about one period out of twenty. It is the most widely used measure of downside risk in banking and asset management: risk managers set limits with it and the Basel rules built banks’ market-risk capital on it (their current framework uses the Expected Shortfall), because it sums up the risk of a position in one number in the unit that matters, the loss. The VaR is a return (negative for a loss). The methods differ in how they estimate the tail of the returns, from the plain history to fitted distributions and volatility models.
A VaR says how bad a period gets at the chosen confidence level, not how bad the periods beyond it are, so two assets with the same VaR can have very different tails (see the Conditional Value at Risk for that). Compare assets over the same period and confidence level. Scaling a daily VaR to a longer horizon with the square root of time assumes independent returns, which tends to understate risk when volatility clusters.
Also known as: extreme value VaR, peaks over threshold VaR, POT VaR, GPD VaR.
In the Finance Toolkit this is get_value_at_risk with method="evt", the same function as Value at Risk (VaR).
Example · BTCUSD, ETHUSD, ^GSPC · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_value_at_risk:
from financetoolkit import Toolkit
toolkit = Toolkit(
["BTCUSD", "ETHUSD", "^GSPC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_value_at_risk(method="evt", period="yearly", within_period=True)
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The data frequency for returns. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “daily”. | "weekly" |
alpha | float | The tail probability for the VaR calculation (e.g., 0.05 for the 95% confidence level). Defaults to 0.05. | 0.01 |
within_period | bool | Whether to calculate VaR within the specified period or for the entire period. Thus whether to look at the VaR 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, VaR 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 VaR). Only available for the historic, GARCH and filtered historic methods (the number of returns of every fit, at least 100); see get_var_backtest for a rolling, out-of-sample VaR 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 VaR 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 VaR, a distribution or a model. Options are: “historic” (Historical VaR, the empirical quantile), “gaussian” (Gaussian VaR, a normal distribution), “cornish-fisher” (Cornish-Fisher VaR, the Cornish-Fisher expansion), “studentt” (Student-T VaR, a Student-T distribution), “evt” (EVT VaR, Extreme Value Theory), “kernel” (Kernel VaR, a Gaussian kernel density), “garch” (GARCH VaR, a GARCH-family model), “filtered_historic” (Filtered Historical VaR, filtered historical simulation), “expectile” (Expectile VaR, the alpha expectile). Defaults to “historic”. The parametric distributions use the sample standard deviation; “cornish-fisher” adjusts the gaussian quantile for the skewness and excess kurtosis of the returns (see var_model.get_var_cornish_fisher), “studentt” uses the quantile of a Student-T distribution fitted by maximum likelihood and “kernel” the quantile of a Gaussian kernel density of the returns. “garch” fits a GARCH-family model per ticker (and per period with within_period), which takes one to five seconds per fit and needs at least 100 returns; a ticker or period with fewer is NaN. “filtered_historic” fits the same model. | |
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 |
refit_every | int | Only used with the GARCH and filtered historic methods and rolling. The number of returns between two fits; the fitted model filters the returns in between. Every refit after the first starts from the previous fit and takes a fraction of a second. 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 | BTCUSD | ETHUSD | ^GSPC | Benchmark |
|---|---|---|---|---|
| 2021 | -0.0641 | -0.0847 | -0.0135 | -0.0131 |
| 2022 | -0.0588 | -0.0763 | -0.0268 | -0.0267 |
| 2023 | -0.0320 | -0.0380 | -0.0139 | -0.0139 |
| 2024 | -0.0415 | -0.0541 | -0.0136 | -0.0134 |
| 2025 | -0.0364 | -0.0583 | -0.0163 | -0.0167 |
5 rows
References
- Paper McNeil, A.J. and Frey, R. (2000). “Estimation of Tail-Related Risk Measures for Heteroscedastic Financial Time Series: An Extreme Value Approach.” Journal of Empirical Finance, 7(3-4), 271-300.
- Library Shares similar logic as empyrical’s gpd_risk_estimates (EVT VaR)