max_drawdown

max_drawdown(x, w=Window(w=None, r=0))[source]

Compute the maximum peak to trough drawdown over a rolling window.

Parameters
  • x (Series) – time series

  • w (Union[Window, int]) – Window or int: number of observations and ramp up to use. e.g. Window(22, 10) where 22 is the window size

and 10 the ramp up value. Window size defaults to length of series. :rtype: Series :return: time series of rolling maximum drawdown

Examples

Compute the maximum peak to trough drawdown

>>> series = generate_series(100)
>>> max_drawdown(series)

See also

returns()