gs_quant.timeseries.technicals.smoothed_moving_average — gs_quant 0.1 documentation

# gs_quant.timeseries.technicals.smoothed_moving_average

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

  Smoothed moving average over specified window

  Parameters

    - x (`Series`) – time series of prices

    - 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

    date-based time series of return

  Usage

  A modified moving average (MMA), running moving average (RMA), or smoothed moving average (SMMA) is defined as:

  \(P_{MM,today} = \frac{(N-1)P_{MM,yesterday} + P_today}{N}\)

  where N is the number of observations in each rolling window, \(w\). If window is not provided, computes rolling mean over the full series

  See Modified moving average for more information

  Examples

  Generate price series with 100 observations starting from today’s date:

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

  See also

  `mean()` :func:’moving_average’