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 reach a new high after the lowest point of the largest drawdown. If the drawdown has not yet been recovered from within the selected period, this returns NaN.

Also known as: time to recovery, drawdown recovery.

Maximum Drawdown Recovery Time in Python

get_maximum_drawdown_recovery_time is part of the Risk module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_maximum_drawdown_recovery_time as shown below.

from financetoolkit import Toolkit

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

toolkit.risk.get_maximum_drawdown_recovery_time()

Which returns:

  AMZN TSLA Benchmark
2021 nan 159 13
2022 nan nan nan
2023 46 nan 24
2024 66 51 32
2025 135 114 55
2026 40 nan 11

Parameters

get_maximum_drawdown_recovery_time accepts the following parameters:

  • period (str, optional): The data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “quarterly” if the Toolkit is initialized with quarterly=True, otherwise “yearly”.
  • within_period (bool, optional): Whether 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 True.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the recovery time values over time. Defaults to False.
  • lag (int | list[int], 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.
Share