gs_quant.timeseries.statistics.range_ — gs_quant 0.1 documentation

# gs_quant.timeseries.statistics.range_

`range_`(x, w=<gs_quant.timeseries.helper.Window object>)

  Range of series over given window

  Parameters

    - x (`Series`) – series: timeseries

    - w (`Union`[`Window`, `int`, `str`]) – Window or int: 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

    timeseries of range

  Usage

  Returns the range of the series (max - min) over rolling window:

  \(R_t = max(X_{t-w+1}:X_t) - min(X_{t-w+1}:X_t)\)

  where \(w\) is the size of the rolling window. If window is not provided, returns the range over the full series. If the window size is greater than the available data, will return range of all available values.

  Examples

  Range of price series over the last \(22\) observations:

      >>> prices = generate_series(100)
      >>> range_(prices, 22)

  See also

  `min_()` `max_()`