getComps: getComps

Description Usage Arguments Value See Also Examples

Description

get the components of the specific index, sector or plate on certain days.

Usage

1
getComps(ID, endT = Sys.Date(), drop = TRUE, datasrc = defaultDataSRC())

Arguments

ID

a character string. The ID of the index, sector or plate. Could be a single-ID-code(eg. "EI000300","ES09440000",...) or a more complicated express containing some set operations and ID-codes(eg. "setdiff(union(EI000300,EI000905),ES09440000)")

endT

a vector of class Date. IF missing, then get the latest components.

drop

if drop the field of date and return a vector when endT is length 1 ?

Value

If endT is missing or is length 1 and drop is TRUE, a vector of stockID of the components; else a dataframe, with cols: "date" and "stockID"

See Also

Other getComps functions: getIndexCompWgt, getSectorComp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
re1 <- getComps("EI000300") # same as getIndexComp("EI000300")
ID <- "setdiff(union(EI000300,EI399006),ES09440000)"
re2 <- getComps(ID)
re3 <- getComps(ID,endT=as.Date(c("2011-12-31","2012-12-31")))
more examples:
# CSI300 ex. financial servive sector
getComps("setdiff(EI000300,ES09440000)")
# CSI300 and financial servive sector
getComps("intersect(EI000300,ES09440000)")
# not drop
getComps("EI000300",drop=FALSE)

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