Calculate the Component Value at Risk (Component VaR) of each asset in a portfolio.

Component VaR allocates total portfolio VaR across its constituent assets, such that the allocations sum exactly back to the portfolio VaR - an “Euler” (or “fully consistent”) risk decomposition:

\[\text{Component VaR}_{i} = \text{weight}_{i} \cdot \text{Marginal VaR}_{i} (\text{see} \text{get\_marginal\_value\_at\_risk})\] \[\operatorname{SUM}(\text{Component VaR}_{i}) = \text{Portfolio VaR}\]

Where Marginal VaR measures each asset’s risk sensitivity, Component VaR measures its actual contribution in the same units as portfolio VaR, making it directly usable to identify which holdings account for the largest share of portfolio risk.

For more information about the method, see the following sources:

  • Garman, M.B. (1997). “Taking VaR to Pieces.” Risk, 10(10), 70-71.
  • Litterman, R. (1996). “Hot Spots and Hedges.” Goldman Sachs Risk Management Series.
  • Jorion, P. (2006). “Value at Risk: The New Benchmark for Managing Financial Risk.” 3rd ed., McGraw-Hill, Chapter 7.

Also known as: Component VaR, risk contribution.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Component Value at Risk (cVaR) for you. Just ask in plain English.

Calculate the Component Value at Risk (cVaR) in Python

The Component Value at Risk (cVaR) is available in the Risk module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_component_value_at_risk as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AMZN", "TSLA", "MSFT"], api_key="FINANCIAL_MODELING_PREP_KEY")

toolkit.risk.get_component_value_at_risk(weights={"AMZN": 0.5, "TSLA": 0.3, "MSFT": 0.2})

Which returns:

  Component VaR
AMZN -0.0256
TSLA -0.0209
MSFT -0.0066
Portfolio -0.0531

Parameters

get_component_value_at_risk accepts the following parameters:

  • weights (dict[str, float] | None, optional): Portfolio weights keyed by ticker. Normalized internally to sum to 1. Defaults to None, which uses equal weights across every ticker in the Toolkit instance (excluding the “Portfolio” and “Benchmark” pseudo-tickers, if present).
  • period (str, optional): The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
  • column (str, optional): The historical data column to use. Defaults to “Return”.
  • alpha (float, optional): The confidence level (e.g., 0.05 for 95% confidence). Defaults to 0.05.
  • distribution (str, optional): The distribution to use for the underlying portfolio VaR calculation (historic, gaussian, cornish-fisher or studentt). Defaults to “historic”.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.

The Risk module page introduces the module, and the sidebar lists all of its functions.

Share