Conditional Expected Drawdown (CED)
Calculate the Conditional Expected Drawdown (CED) of an investment portfolio or asset’s returns: the average of the worst Maximum Drawdowns over paths of a fixed length.
The Maximum Drawdown of the whole history is a single number that depends on how long the history is. Goldberg and Mahmoud (2017) fix the length instead: the Maximum Drawdown of every path of window returns forms a distribution, and the CED is the tail average of it, as the CVaR is of the returns. With a window of 21 daily returns it reads as how deep the decline within a bad month gets, on average over the worst 5% of months. Where the Conditional Drawdown at Risk averages the drawdown of single days, the CED averages the worst decline of whole paths, and unlike the Maximum Drawdown it is a tail average, so a single crash moves it less and it does not grow with the length of the data.
The formula is as follows (with the default window of 21 and alpha of 0.05):
\[\operatorname{Wealth}(t) = \prod(1 + \operatorname{Return}(s)) \;\text{for}\; s \leq t,\;\; \text{starting at 1 before the first return of each path}\] \[\text{Maximum Drawdown}(s) = \min \;\text{over}\; t \;\text{in} \;\left[s,\; s + \frac{\text{window)} \;\text{of Wealth}(t)}{\max(1,\; \max(\operatorname{Wealth}(u) \;\text{for}\; u \leq t))} - 1\right]\] \[\text{CED} = \frac{\sum_{i <= k} \;\operatorname{MDD}(i) + (m \cdot \alpha - k) \cdot \operatorname{MDD}(k + 1)}{m \cdot \alpha}\]Where MDD(1) <= MDD(2) <= … are the m Maximum Drawdowns in ascending order and k = floor(m · alpha). The paths overlap, one starting at every return, so n returns give \(m = n\) - window + 1 paths. The tail average is the exact one of Rockafellar and Uryasev (2002), the average of the deepest m · alpha paths with the one at the boundary counted with its fraction. Overlapping paths often share their Maximum Drawdown, so a cut at an interpolated quantile, as the Toolkit’s CDaR and historic CVaR make, would take or leave such ties on the last digit of the rounding. Without compounding the drawdowns are measured on the summed returns instead, as an absolute decline from their peak.
Also known as: CED, conditional expected drawdown, expected maximum drawdown in the tail.
Example · ^STOXX50E, ^N225, ^GSPC · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_conditional_expected_drawdown:
from financetoolkit import Toolkit
toolkit = Toolkit(
["^STOXX50E", "^N225", "^GSPC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_conditional_expected_drawdown(period="yearly", within_period=True)
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
What was the conditional expected drawdown, the average of the worst 5% of one-month maximum drawdowns, of the Euro Stoxx 50, the Nikkei 225 and the S&P 500 in each year from 2021 to 2025?
Which returns:
| Item | ^STOXX50E | ^N225 | ^GSPC | Benchmark |
|---|---|---|---|---|
| 2021 | -0.0769 | -0.1009 | -0.0464 | -0.0454 |
| 2022 | -0.1575 | -0.1059 | -0.1269 | -0.1263 |
| 2023 | -0.0646 | -0.0886 | -0.0660 | -0.0651 |
| 2024 | -0.0844 | -0.2420 | -0.0799 | -0.0792 |
| 2025 | -0.1587 | -0.1812 | -0.1374 | -0.1372 |
5 rows
Parameters
get_conditional_expected_drawdown accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The data frequency for returns. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “daily”. | "weekly" |
window | int | The length of each path in returns of period. Defaults to 21, a month of trading days. | 20 |
alpha | float | The tail probability for the CED calculation (e.g., 0.05 for the worst 5% of paths). Defaults to 0.05. | 0.01 |
within_period | bool | Whether to calculate the CED within the specified period or for the entire period. Thus whether to look at the CED 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, the CED is calculated over a rolling window of this many periods across the full return history instead of per period; it needs to be at least window. Defaults to None. | 4 |
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 CED 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 |
compound_returns | bool | Whether to compound the returns into the wealth path the drawdowns are measured on, or to sum them (absolute drawdowns). Defaults to True. | True |
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 |
References
- Paper Goldberg, L.R. and Mahmoud, O. (2017). “Drawdown: From Practice to Theory and Back Again.” Mathematics and Financial Economics, 11(3), 275-297.
- Library Shares similar logic as RiskLabAI’s conditional_expected_drawdown