Calculate the Maximum Drawdown Recovery Time of an investment portfolio or asset’s returns.

The Maximum Drawdown Recovery Time is the number of periods it takes for the cumulative return to climb back to its previous peak after the lowest point of the largest drawdown. If the drawdown has not yet been recovered from within the selected period, this returns NaN.

The formula is as follows:

\[\text{Maximum Drawdown Recovery Time} = t(\text{recovery}) - t(\text{trough})\]

Where t(trough) is the period of the lowest Drawdown (see get_maximum_drawdown) and t(recovery) the first period at or after it in which Wealth is back at or above the high that drawdown is measured from.

Also known as: time to recovery, drawdown recovery.

Maximum Drawdown Recovery Time in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_maximum_drawdown_recovery_time as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["TLT", "IEF", "HYG"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.risk.get_maximum_drawdown_recovery_time(period="yearly", within_period=True)

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

How many trading days did TLT, IEF, HYG and the S&P 500 take to recover from the trough of their maximum drawdown in each year from 2021 to 2025?

Which returns:

  TLT IEF HYG Benchmark
2021 nan nan 19 12
2022 nan nan nan nan
2023 nan nan 98 23
2024 nan nan 14 32
2025 100 49 23 54

Parameters

get_maximum_drawdown_recovery_time accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”."weekly"
within_periodboolWhether to calculate the recovery time within the specified period or for the entire period. Thus whether to look at the recovery time within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to False. Note that this requires intraday data when period = ‘daily’, since a single day only nests observations when intraday data was fetched.True
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 recovery time values over time. 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