Calculate the Entropic Value at Risk (EVaR) of an investment portfolio or asset’s returns.

Entropic Value at Risk (EVaR) is a risk management metric that quantifies upper bound for the value at risk (VaR) and the conditional value at risk (CVaR) over a specified time horizon and confidence level. EVaR is obtained from the Chernoff inequality. It provides insights into the downside risk associated with an investment and helps investors make informed decisions about risk tolerance.

The EVaR is calculated as the upper bound of VaR and CVaR with a given confidence level (e.g., 5% for alpha=0.05).

Also known as: EVaR.

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

Calculate the Entropic Value at Risk (eVaR) in Python

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

pip install financetoolkit -U

Then call get_entropic_value_at_risk as shown below.

from financetoolkit import Toolkit

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

toolkit.risk.get_entropic_value_at_risk()

Which returns:

  AMZN TSLA SPY
2012 -0.0392 -0.0604 -0.0177
2013 -0.0377 -0.0928 -0.0152
2014 -0.0481 -0.0689 -0.0162
2015 -0.046 -0.0564 -0.0227
2016 -0.043 -0.0571 -0.0188
2017 -0.0289 -0.0501 -0.0091
2018 -0.0518 -0.085 -0.0252
2019 -0.0327 -0.071 -0.0173
2020 -0.054 -0.1211 -0.0497
2021 -0.0352 -0.0782 -0.0183
2022 -0.0758 -0.1012 -0.0362
2023 -0.0471 -0.0793 -0.0188

Parameters

get_entropic_value_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 EVaR calculation (e.g., 0.05 for 95% confidence). Defaults to 0.05.
  • within_period (bool, optional): Whether to calculate EVaR within the specified period or for the entire period. Thus whether to look at the CVaR within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to True.
  • 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 CVaR 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.

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

Share