Calculate Morningstar Risk, the return a risk-averse investor would give up to remove the variation of the returns: Morningstar Return (the annualized geometric mean excess return) minus the Morningstar Risk-Adjusted Return. It is zero for returns that never vary and grows with their variation, most with variation on the downside. Morningstar rates funds Low to High on it within their category, over 36, 60 and 120 months (rolling=36, 60 and 120).

The formula is as follows:

\[\text{Morningstar Risk} = \operatorname{MRAR}(0) - \operatorname{MRAR}(\gamma)\]

with MRAR the Morningstar Risk-Adjusted Return (see get_morningstar_risk_adjusted_return) and MRAR(0) Morningstar Return.

For more information, see the following:

Morningstar Risk in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_morningstar_risk as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["VOO", "QQQ", "SCHD"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
    risk_free_rate="13w",
)

toolkit.performance.get_morningstar_risk()

Which returns:

Date VOO QQQ SCHD
2021 0.0148 0.0205 0.0214
2022 0.0375 0.0449 0.0339
2023 0.023 0.0445 0.0183
2024 0.0121 0.0145 0.016
2025 0.0125 0.0257 0.0126

Parameters

get_morningstar_risk accepts the following parameters.

ParameterTypeDescriptionExample
gammafloatThe risk aversion, 0 or higher. Defaults to 2.0, which Morningstar uses for its ratings.
periodstrThe period to group the monthly returns by, “yearly” or “quarterly”. Defaults to “yearly”."weekly"
within_periodboolWhether to calculate the risk of the months within each period or of all months in the range. Defaults to True.True
rollingintThe number of months in a rolling window, e.g. 36 for the three year figure at every month end. Overrides period and within_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 values. 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