gs_quant.timeseries.econometrics.max_drawdown

max_drawdown(x, w=<gs_quant.timeseries.helper.Window object>)[source]

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

i.e. if the max drawdown for a period is 20%, this function will return 0.2.

Parameters:
  • x (Series) – time series

  • w (Union[Window, int, str]) – Window, int, or str: size of window and ramp up to use. e.g. Window(22, 10) where 22 is the window size and 10 the ramp up value. If w is a string, it should be a relative date like ‘1m’, ‘1d’, etc. Window size defaults to length of series.

Return type:

Series

Returns:

time series of rolling maximum drawdown

Examples

Compute the maximum peak to trough drawdown

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

See also

returns()