EGARCH Volatility Model
Calculates the conditional variance (sigma_t^2) of the returns with an EGARCH(1, 1) model fitted to them. Take the square root for the conditional volatility, and see get_egarch_forecast for the variance forecast.
EGARCH models the log of the conditional variance, which avoids having to constrain the parameters to keep the variance positive and, like GJR-GARCH, lets negative and positive shocks of the same size have a different impact on volatility (the leverage effect).
For more information about the method, see the following paper:
- Nelson, D.B. (1991). “Conditional Heteroskedasticity in Asset
Returns: A New Approach.” Econometrica, 59(2), 347-370.
The formula is as follows:
- ln sigma_t^2 = Omega + Alpha * (|z_(t-1)| - √(2 / π)) + Gamma * z_(t-1) + Beta * ln sigma_(t-1)^2
- z_t = r_t / sigma_t
- ln sigma_1^2 = Omega + Beta * ln(Backcast)
Where r_t are the returns (not demeaned), √(2 / π) is the expected |z| of a standard normal shock, the
log variance is kept within [-20, 20] and the Backcast is the same as in get_garch. The parameters
maximize the Gaussian log-likelihood with |Beta| < 1 (see get_egarch_parameters).
Also known as: exponential GARCH, log-GARCH.
EGARCH Volatility Model in Python
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_egarch as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["AMZN", "TSLA"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_egarch(period="quarterly")
Which returns:
| Date | AMZN | TSLA | Benchmark |
|---|---|---|---|
| 2021Q2 | 0.0229 | 0.0923 | 0.0077 |
| 2021Q3 | 0.0158 | 0.1671 | 0.0049 |
| 2021Q4 | 0.0244 | 0.1704 | 0.0131 |
| 2022Q1 | 0.0411 | 0.0597 | 0.0062 |
| 2022Q2 | 0.0737 | 0.1035 | 0.0116 |
| 2022Q3 | 0.0642 | 0.2104 | 0.009 |
| 2022Q4 | 0.0868 | 0.1936 | 0.0145 |
| 2023Q1 | 0.0975 | 0.3935 | 0.0105 |
| 2023Q2 | 0.0675 | 0.0902 | 0.0078 |
| 2023Q3 | 0.0321 | 0.0321 | 0.0048 |
| 2023Q4 | 0.0565 | 0.0654 | 0.0108 |
| 2024Q1 | 0.0348 | 0.133 | 0.0046 |
| 2024Q2 | 0.0167 | 0.2705 | 0.0017 |
| 2024Q3 | 0.0149 | 0.3389 | 0.002 |
| 2024Q4 | 0.0239 | 0.2276 | 0.0015 |
| 2025Q1 | 0.0094 | 0.0473 | 0.0033 |
| 2025Q2 | 0.0077 | 0.0964 | 0.0076 |
| 2025Q3 | 0.0013 | 0.0458 | 0.0033 |
| 2025Q4 | 0.0025 | 0.0022 | 0.0017 |
Parameters
get_egarch accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”. | "weekly" |
time_steps | int | Time steps to calculate EGARCH for. Defaults to None, which uses the length of the returns. | 252 |
optimization_t | int | Time steps to optimize EGARCH for. It is only used if no weights are given. Defaults to None, which uses the length of the returns. | 252 |
within_period | bool | Whether to calculate EGARCH within the specified period or for the entire period. Defaults to False. | True |
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 EGARCH 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 |