trday.nearby: trday.nearby

Description Usage Arguments Value Author(s) Examples

Description

get the nearby tradingday by shifting forward or backward.If the argument datelist is not a tradingday,the tradingday nearest by it will be firstly found by function trday.nearest(by=-1).

Usage

1
2
trday.nearby(datelist, by, stockID = NULL, dir = if (by > 0) 1L else -1L,
  TS, drop = FALSE)

Arguments

datelist

a vector of class Date

by

a integer giving the lagging days.If negetive,get the earlyer tradingday,if positive,get the later tradingday.

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 is not trading day, get the nearest trading day, here need the dir param to give a shifting direction. see trday.nearest

Value

a vector of trading days of class Date

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.nearby(datelist,-20) # the tradingday 20 days earlyer than datelist
trday.nearby(datelist,20) # the tradingday 20 days later than datelist 
trday.nearby(datelist,20,stockID="EQ000527") 

raphael210/QDataGet documentation built on May 26, 2019, 11:02 p.m.