trday.offset: trday.offset

Description Usage Arguments Value Author(s) Examples

Description

offset the datelist by months,quarters,ect. then get the nearest tradingday

Usage

1
2
trday.offset(datelist, by = months(1), stockID = NULL, dir = if
  (as.numeric(by) > 0) 1L else -1L, TS, drop)

Arguments

datelist

a vector of class Date

by

a period object. See detail in package lubridate.

stockID

a character string or null. If null, the market trading days, other wise the trading days of specific stock.

dir

1L or -1L. if the result date is not trdingday, get the forward nearest tradingday or the backward tradingday? See detail in trday.nearest

Value

a vector of trading days of class Date

Author(s)

Ruifei.Yin

Examples

1
2
3
4
5
(datelist <- as.Date(c("2012-07-21","2012-07-22","2012-07-23","2013-01-30")))
trday.offset(datelist,months(1)) # the tradingdays 1 month after the datelist
trday.offset(datelist,months(-1)) # the tradingdays 1 month before the datelist
trday.offset(datelist,years(1))
trday.offset(datelist,months(-1),stockID="EQ000527") 

QuantAndrew/QDataGet documentation built on May 14, 2019, 7:35 a.m.