gs_quant.timeseries.algebra.smooth_spikes — gs_quant 0.1 documentation

# gs_quant.timeseries.algebra.smooth_spikes

`smooth_spikes`(x, threshold)

  Smooth out the spikes of a series. If a point is larger/smaller than (1 +/- threshold) times both neighbors, replace it with the average of those neighbours. Note: the first and last points in the input series are dropped.

  Parameters

    - x (`Series`) – timeseries

    - threshold (`float`) – minimum increment to trigger filter

  Return type

    `Series`

  Returns

    smoothed timeseries

  Usage

  Returns series where values that exceed the threshold relative to both neighbors are replaced.

  Examples

  Generate price series and smooth spikes over a threshold of 0.5.

      >>> prices = generate_series(100)
      >>> smooth_spikes(prices, 0.5)

  See also

  `exponential_moving_average()`