gs_quant.timeseries.analysis.diff — gs_quant 0.1 documentation

# gs_quant.timeseries.analysis.diff

`diff`(x, obs=1)

  Diff observations with given lag

  Parameters

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

    - obs (`int`) – number of observations to lag

  Return type

    `Series`

  Returns

    date-based time series of return

  Usage

  Compute the difference in series values over a given lag:

  \(R_t = X_t - X_{t-obs}\)

  where \(obs\) is the number of observations to lag series in diff function

  Examples

  Diff prices levels:

      >>> series = generate_series(100)
      >>> returns = diff(series)

  See also

  `lag()`