Excess Return
Calculate the Excess Return of an investment portfolio or asset for a given period based on the daily historical returns.
The Excess Return is defined as the period Return minus the risk free rate.
If cumulative is set to True, the excess returns are compounded further into a cumulative excess return over time instead. The cumulative excess return is always rebased to start at 1 at the beginning of the selected date range.
Also known as: return minus the risk-free rate.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Excess Return for you. Just ask in plain English.
Calculate the Excess Return in Python
The Excess Return is available in the Performance module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_excess_return as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AMZN", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.performance.get_excess_return(period="yearly")
Which returns:
| Date | AMZN | TSLA | Benchmark |
|---|---|---|---|
| 2021 | 0.0085 | 0.4832 | 0.255 |
| 2022 | -0.5348 | -0.6891 | -0.2337 |
| 2023 | 0.7702 | 0.9787 | 0.2042 |
| 2024 | 0.3992 | 0.5798 | 0.1882 |
| 2025 | 0.01 | 0.0713 | 0.1222 |
| 2026 | 0.0059 | -0.1703 | 0.0469 |
Parameters
get_excess_return accepts the following parameters:
- period (str, optional): The data frequency for returns (weekly, monthly, quarterly, or yearly). Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
- cumulative (bool, optional): Whether to return the cumulative excess return over time instead of the discrete excess return per period. Defaults to False.
- 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 Excess Return 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.
Related Performance Metrics
The Performance module page introduces the module, and the sidebar lists all of its functions.