Excess Volatility
Calculate the Excess Volatility of an investment portfolio or asset’s returns for a given period based on the daily historical returns.
Excess Volatility is the Volatility of the Excess Return, i.e. the daily return minus the risk free rate, scaled to the given period in the same way as the Volatility.
The formula is as follows:
\[\text{Excess Volatility} = \operatorname{Std}(\text{Daily Return} - \text{Daily Risk Free Rate}) \cdot \sqrt{\text{Trading Days per Period}}\]Where Std is the sample standard deviation (ddof=1) over the days within the period, the annualized risk free rate is converted to a daily rate, and the trading days per period are 252 / 52 (weekly), 252 / 12 (monthly), 252 / 4 (quarterly) or 252 (yearly). With rolling, the result is the sample standard deviation of the last rolling excess returns of the chosen period itself, without scaling.
Also known as: standard deviation of excess returns.
Excess Volatility in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_excess_volatility as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["ADBE", "CRM", "ORCL"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_excess_volatility(period="yearly")
Or, after setting up the Finance Toolkit MCP, ask:
What was the annualized volatility of the returns of Adobe, Salesforce, Oracle and the S&P 500 in excess of the risk-free rate in each year from 2021 to 2025?
Which returns:
| Date | ADBE | CRM | ORCL | Benchmark |
|---|---|---|---|---|
| 2021 | 0.2924 | 0.282 | 0.2927 | 0.1293 |
| 2022 | 0.4506 | 0.4722 | 0.3053 | 0.2425 |
| 2023 | 0.3178 | 0.2958 | 0.302 | 0.1307 |
| 2024 | 0.3663 | 0.3594 | 0.3226 | 0.1257 |
| 2025 | 0.3062 | 0.319 | 0.6169 | 0.1948 |
Parameters
get_excess_volatility accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The data frequency for returns (weekly, monthly, quarterly, or yearly). Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”. | "quarterly" |
rolling | int | The rolling window size to use for the calculation. If set, Excess Volatility is calculated over a rolling window of this many periods (e.g. period=’monthly’ and rolling=6 gives the rolling 6-month Excess Volatility) instead of one value per period. Defaults to None. | 4 |
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 Excess Volatility 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 |