Calculate the exponentially weighted moving average (EWMA) Volatility of an investment portfolio or asset’s daily returns, following the RiskMetrics methodology.

Unlike a fixed-window rolling Volatility, EWMA Volatility weights recent observations more heavily than older ones, so it reacts faster to changes in the underlying volatility regime. It is a simpler, more interpretable alternative to a full GARCH fit.

The formula is as follows:

\[\text{EWMA Variance} (t) = \lambda \cdot \text{EWMA Variance} (t-1) + (1 - \lambda) \cdot \operatorname{Return}(t-1) ^{2}\] \[\text{EWMA Volatility} (t) = \sqrt{\text{EWMA Variance} (t)}\]

Where lambda is 0.94 by default and Return(t-1) the previous daily return, so the value on a day only uses the returns before it. The recursion starts from the first squared return.

With the RiskMetrics decay factor of 0.94, about 70% of the weight sits on the last 20 trading days, so EWMA Volatility reacts within days to a market shock and falls back almost as quickly. The values are daily; multiply them by the square root of 252 for an annualized figure comparable with get_volatility(period="yearly").

Also known as: RiskMetrics volatility, exponentially weighted volatility.

EWMA Volatility in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_ewma_volatility as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["USDJPY", "EURUSD"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.risk.get_ewma_volatility().tail(5)

Or, after setting up the Finance Toolkit MCP, ask:

How did the EWMA volatility of the dollar against the yen, the euro against the dollar and the S&P 500 move from 26 to 31 December 2025?

Which returns:

Date USDJPY EURUSD Benchmark
2025-12-26 0.0046 0.0046 0.0057
2025-12-28 0.0045 0.0044 0.0055
2025-12-29 0.0043 0.0043 0.0054
2025-12-30 0.0042 0.0042 0.0052
2025-12-31 0.0041 0.0045 0.0051

Parameters

get_ewma_volatility accepts the following parameters.

ParameterTypeDescriptionExample
lambda_floatThe decay factor. Higher values weight the past more heavily (slower to react), lower values weight recent returns more heavily (faster to react). RiskMetrics uses 0.94 for daily data. Defaults to 0.94.0.97
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the EWMA Volatility values over time. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
Share