gs_quant.timeseries.datetime.date_range — gs_quant 0.1 documentation

# gs_quant.timeseries.datetime.date_range

`date_range`(x, start_date, end_date, weekdays_only=False)

  Create a time series from a (sub-)range of dates in an existing time series.

  Parameters

    - x (`Series`) – time series

    - start_date (`Union`[`date`, `int`]) – start date for the sliced time series. If integer, number of observations after the first

    - end_date (`Union`[`date`, `int`]) – end date for the sliced time series. If integer, number of observations before the last

    - weekdays_only (`bool`) – whether to include only weekdays in the sliced ranges

  Return type

    `Series`

  Returns

    sliced time series

  Usage

  Returns a restricted (“sliced”) time series based on start and end dates:

  \(Y_t = R_t |_{start < t < end}\)

  Examples

  Slice the first and last week of a time series:

      >>> series = generate_series(100)
      >>> sliced_series = date_range(series,7,7)

  See also

  `day()` :func: lag