Calculate the (Delta-)CoVaR of ticker conditional on conditioning_ticker being in its own distress state.

Ordinary Value at Risk treats each asset in isolation, which misses systemic risk – the fact that one asset’s distress can spill over and worsen another’s risk. CoVaR directly measures that spillover: it is the VaR of ticker, conditional on conditioning_ticker itself being at its own alpha-VaR, estimated via a linear Quantile Regression of ticker’s returns on conditioning_ticker’s returns at quantile alpha. The Delta-CoVaR isolates the marginal, distress-specific contribution by subtracting the same construction evaluated in the “normal” (median) state instead.

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

  • Adrian, T., & Brunnermeier, M.K. (2016). “CoVaR.” American Economic Review, 106(7), 1705-1741.

Also known as: Conditional Value at Risk (systemic risk sense), Delta-CoVaR.

CoVaR in Python

get_covar is part of the Risk module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_covar as shown below.

from financetoolkit import Toolkit

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

toolkit.risk.get_covar("AAPL", "MSFT", period="weekly")

Which returns:

Metric Value
CoVaR -0.1077
Delta-CoVaR -0.1134
Quantile Regression Slope 0.9214
Quantile Regression Intercept -0.0508
Observations 157

Parameters

get_covar accepts the following parameters:

  • ticker (str): The asset whose conditional VaR is being measured.
  • conditioning_ticker (str): The asset (or e.g. a benchmark/index) whose distress ticker is conditioned on.
  • period (str, optional): The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”, since a dependence estimate needs far more observations than a lower frequency provides – at “yearly” a decade of history is only ten observations.
  • column (str, optional): The historical data column to use. Defaults to “Return”.
  • alpha (float, optional): The confidence level for both the tail quantile regression and the VaR of conditioning_ticker (e.g., 0.05 for 95% confidence). Defaults to 0.05.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
Share