okama.Portfolio.recovery_period

property Portfolio.recovery_period

Get recovery period time series for the portfolio value.

The recovery period (drawdown duration) is the number of months to reach the value of the last maximum.

Returns:
pd.Series

Recovery period time series for the portfolio value

See also

drawdowns

Calculate drawdowns time series.

Notes

The largest recovery period does not necessary correspond to the max drawdown.

Examples

>>> pf = ok.Portfolio(['SPY.US', 'AGG.US'], weights=[0.5, 0.5])
>>> pf.recovery_period.nlargest()
date
2010-10    35
2004-10     7
2012-01     7
2019-03     6
2018-07     5
Freq: M, Name: portfolio_5724.PF, dtype: int32