gs_quant.datetime.relative_date.RelativeDate

class RelativeDate(rule, base_date=None)[source]

RelativeDates are objects which provide utilities for getting dates given a relative date rule. Some rules require a business day calendar.

Parameters:
  • rule (str) – Rule to use

  • base_date (Optional[date]) – Base date to use (Optional).

Returns:

new RelativeDate object

Usage

Create a RelativeDate object and then call apply_rule to get a date back.

Examples

RelativeDate to return relative previous day:

>>> my_date: date = RelativeDate('-1d').apply_rule()

Documentation

Full Documentation and examples can be found here: https://developer.gs.com/docs/gsquant/api/datetime.html

Methods

apply_rule([currencies, exchanges, ...])

Applies business date logic on the rule using the given holiday calendars for rules that use business day logic.

as_dict()