gs_quant.timeseries.algebra.abs_ — gs_quant 0.1 documentation

# gs_quant.timeseries.algebra.abs_

`abs_`(x)

  Absolute value of each element in series

  Parameters

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

  Return type

    `Series`

  Returns

    date-based time series of absolute value

  Usage

  Return the absolute value of \(X\). For each value in time series \(X_t\), return \(X_t\) if \(X_t\) is greater than or equal to 0; otherwise return \(-X_t\):

  \(R_t = |X_t|\)

  Equivalent to \(R_t = \sqrt{X_t^2}\)

  Examples

  Generate price series and take absolute value of \(X_t-100\)

      >>> prices = generate_series(100) - 100
      >>> abs_(prices)

  See also

  `exp()` `sqrt()`