Serenity Index

Calculate the Serenity Index (Serenity Ratio) of an investment portfolio or asset, KeyQuant’s excess return per unit of drawdown risk: the Ulcer Performance Index, penalized further when the worst drawdowns are deep compared to the volatility of the returns.

The formula is as follows:

\[\text{Ulcer Index} = \sqrt{\operatorname{MEAN}(\text{Drawdown}^{2})},\;\; \text{with each day's drawdown measured from the highest value since the start of the period}\] \[\text{Pitfall Indicator} = \frac{\left|\text{Conditional Drawdown at Risk}(\alpha)\right|}{\text{Volatility}}\] \[\text{Serenity Index} = \frac{\text{Period Return} - \text{Risk-Free Rate}}{\text{Ulcer Index} \cdot \text{Pitfall Indicator}}\]

The Conditional Drawdown at Risk is the average of the worst alpha share of the daily drawdowns within the period and the Volatility the standard deviation of the daily returns within the period scaled to the period (times the square root of the trading days in it), so the Pitfall Indicator counts how many standard deviations the worst drawdowns reach. Two assets with the same Ulcer Performance Index get a lower Serenity Index when one of them has the deeper tail of drawdowns.

Also known as: Serenity Ratio.

Example · AAPL, MSFT, KO · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_serenity_index:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["AAPL", "MSFT", "KO"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.performance.get_serenity_index()

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

What was the serenity index of Apple, Microsoft and Coca-Cola in each year from 2022 to 2025?

Which returns:

Parameters

get_serenity_index accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe period to use for the calculation. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”."weekly"
alphafloatThe share of the worst drawdowns the Conditional Drawdown at Risk averages. Defaults to 0.05.0.01
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
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper KeyQuant (2017). “Assessing Performance Through Risk: Part 1.” KeyQuant white paper (the Serenity Ratio and the Pitfall Indicator).
  • Paper Martin, P.G., & McCann, B.B. (1989). “The Investor’s Guide to Fidelity Funds.” John Wiley & Sons (the Ulcer Index).
  • Library Shares similar logic as PerformanceAnalytics (R)’s Return.excess
  • Library Shares similar logic as quantstats’ serenity_index
Share