trday.nearest: trday.nearest

Description Usage Arguments Value Author(s) Examples

Description

get the nearest tradingday.

Usage

1
trday.nearest(datelist, dir = -1L, stockID = NULL, TS, drop)

Arguments

datelist

a vector of class Date

dir

a integer. Indicating forward or backward to find, if datelist is not tradingday. -1 for backward, 1 for forward.

stockID

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

Value

a vector of class Date, the value of which is the nearest tradingday before/after the datelist if datelist is not a tradingday, otherwise,the datelist itself.

Author(s)

Ruifei.Yin

Examples

1
2
3
4
datelist <- as.Date(c("2012-07-21","2012-07-22","2012-07-23","2013-01-30"))
trday.nearest(datelist)
trday.nearest(datelist, dir = 1)
trday.nearest(datelist, dir = 1, stockID="EQ000527")

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