from datetime import date
from gs_quant.datetime.relative_date import RelativeDate
from gs_quant.markets.securities import ExchangeCode
from gs_quant.session import GsSession, Environment
# external users should substitute their client id and secret; please skip this step if using internal jupyterh
GsSession.use(Environment.PROD, client_id=None, client_secret=None, scopes=('read_product_data',))
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-9373366b8431> in <module> ----> 1 yesterday: date = date.today() - timedelta(days=1) 2 date: date = RelativeDate('-1d', base_date=yesterday).apply_rule() # Returns 2 days ago NameError: name 'date' is not defined
A: first day of th year b: business days of calendar passed, USD by default d: Gregorian calendar days e: end of month (ignores number) m: month r: end of year u: business days ignoring USD holidays v: gets last business day of month (does not ignore number) x: gets last business day of month (ignores the number) y: add years, Result will be moved to the next week if falling on a weekend
# Returns four business days after the first business day on or after the 15th calendar day of the month
date: date = RelativeDate('14d+0u+4u').apply_rule(exchanges=[ExchangeCode.NYSE])