getrptDate_newest: getrptDate_newest

Description Usage Arguments Value Note Author(s) Examples

Description

get the newest rptDate of the stocks on specific dates.

Usage

1
2
3
getrptDate_newest(TS, stockID, endT = Sys.Date(), freq = c("q", "y", "h"),
  mult = c("last", "first", "all"), drop = FALSE,
  datasrc = defaultDataSRC())

Arguments

TS

a TS object

stockID

a vector of stockID

endT

a vector of Date

mult

a character string. Could be one of "last","first","all". IF a listed company publish more than one financial reports in a single day, which one should be returned? the newest one(the default value), the earliest one or all of them? See example for dedail.

drop

a logical. Shoud the TS be exculded in the result?

Value

a data.frame,with the same cols of TS,added by "rptDate". Or a vector if drop is TRUE.

Note

param TS and combination of stockID and endT should at least have one and only have one. The combination of vector stockID and endT could be different length, which abide by the recycling rule.

Author(s)

Ruifei.Yin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# - with TS
TS <- getTS(getRebDates(as.Date('2007-03-17'),as.Date('2012-05-20'),rebFreq="year"),'EI000300')
getrptDate_newest(TS)
# - one stock, multiple dates
getrptDate_newest(stockID="EQ000001", endT=seq(from=as.Date("2010-12-31"),to=as.Date("2011-12-31"),by="month"))
# - one date, multiple stocks
getrptDate_newest(stockID=c("EQ000001","EQ000002","EQ000004"), endT=as.Date("2003-04-30"))
# - multi="all"
getrptDate_newest(stockID=c("EQ000001","EQ000002","EQ000004"), endT=as.Date("2003-04-30"),mult="all")
# - multi="first"
getrptDate_newest(stockID=c("EQ000001","EQ000002","EQ000004"), endT=as.Date("2003-04-30"),mult="first")

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