Calculate Jensen’s Alpha, a measure of an asset’s performance relative to its expected return based on the Capital Asset Pricing Model (CAPM).

Jensen’s Alpha is used to assess whether an investment has outperformed or underperformed its expected return given its systematic risk, as represented by the asset’s Beta.

The formula is as follows:

\[\text{Jensen's Alpha} = \text{Asset's Actual Return} - \left[\text{Risk-Free Rate} + \text{Beta} \cdot (\text{Benchmark Return} - \text{Risk-Free Rate})\right]\]

See definition: https://en.wikipedia.org/wiki/Jensen%27s_alpha

Also known as: Jensen alpha, risk-adjusted excess return.

Jensen’s Alpha in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_jensens_alpha as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["UNH", "JNJ", "PFE"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2020-01-01",
    end_date="2025-12-31",
)

toolkit.performance.get_jensens_alpha()

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

What was Jensen's alpha of UnitedHealth, Johnson & Johnson and Pfizer in each year from 2021 to 2025?

Which returns:

Date UNH JNJ PFE
2021 0.2601 -0.0093 0.6493
2022 0.1608 0.0945 -0.0261
2023 -0.0951 -0.2013 -0.5539
2024 -0.0911 -0.0803 -0.1158
2025 -0.4155 0.4249 -0.0976

Parameters

get_jensens_alpha accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”."quarterly"
rollingintThe rolling window size to use for the Beta component of the calculation. If set, Beta is estimated over a rolling window of this many periods across the full return history instead of per period. Defaults to None.4
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 ratios. 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