Conditional Drawdown at Risk (CDaR)
Calculate the Conditional Drawdown at Risk (CDaR) of an investment portfolio or asset’s returns.
Conditional Drawdown at Risk (CDaR) extends the concept of Value at Risk and Conditional Value at Risk to the drawdown series instead of the return series. It is calculated as the average of the worst drawdowns that exceed the Drawdown at Risk (DaR), i.e. the alpha-quantile of the drawdown distribution, giving insight into the depth of the most severe drawdowns an investment portfolio or asset could experience.
Also known as: CDaR.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Conditional Drawdown at Risk (CDaR) for you. Just ask in plain English.
Calculate the Conditional Drawdown at Risk (CDaR) in Python
The Conditional Drawdown at Risk (CDaR) is available in the Risk module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_conditional_drawdown_at_risk as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AMZN", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.risk.get_conditional_drawdown_at_risk()
Which returns:
| AMZN | TSLA | Benchmark | |
|---|---|---|---|
| 2021 | -0.1325 | -0.3407 | -0.0437 |
| 2022 | -0.499 | -0.6603 | -0.2424 |
| 2023 | -0.1756 | -0.2867 | -0.0832 |
| 2024 | -0.1612 | -0.3662 | -0.0576 |
| 2025 | -0.2721 | -0.4558 | -0.1459 |
| 2026 | -0.1869 | -0.2267 | -0.072 |
Parameters
get_conditional_drawdown_at_risk accepts the following parameters:
- period (str, optional): The data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
- alpha (float, optional): The confidence level for CDaR calculation (e.g., 0.05 for 95% confidence). Defaults to 0.05.
- within_period (bool, optional): Whether to calculate CDaR within the specified period or for the entire period. Thus whether to look at the CDaR within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to True.
- rolling (int, optional): The rolling window size to use for the calculation. If set, CDaR is
calculated over a rolling window of this many periods across the full return history instead
of per
period. Defaults to None. - rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the CDaR values over time. Defaults to False.
- lag (int | list[int], optional): The lag to use for the growth calculation. Defaults to 1.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
Related Risk Metrics
The Risk module page introduces the module, and the sidebar lists all of its functions.