Alpha, in a general sense, represents the excess return an investment generates relative to a benchmark or a risk-adjusted return. It can be positive (indicating the investment outperformed the benchmark) or negative (indicating underperformance).

The formula is as follows:

\[\text{Alpha} = \text{Asset's Actual Return} - \text{Benchmark's Actual Return}\]

See definition: https://en.wikipedia.org/wiki/Alpha_(finance)

Also known as: excess return, outperformance, active return.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Alpha for you. Just ask in plain English.

Calculate the Alpha in Python

The Alpha is available in the Performance module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_alpha as shown below.

from financetoolkit import Toolkit

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

toolkit.performance.get_alpha()

Which returns:

Date AAPL TSLA
2021 0.0678 0.2272
2022 -0.0735 -0.4555
2023 0.2389 0.7743
2024 0.0677 0.3922
2025 -0.0779 -0.0499
2026 0.0431 -0.2173

Parameters

get_alpha accepts the following parameters:

  • period (str, optional): The period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
  • rolling (int, optional): The rolling window size to use for the calculation. If set, Alpha is calculated as the rolling mean excess return over this many periods across the full return history instead of per period. Defaults to None.
  • rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the ratios. Defaults to False.
  • lag (int | str, 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 Performance module page introduces the module, and the sidebar lists all of its functions.

Share