getIndexComp: getIndexComp

Description Usage Arguments Value Examples

Description

get the components of the specific index on certain day.

Usage

1
2
getIndexComp(indexID, endT = Sys.Date(), drop = TRUE,
  datasrc = defaultDataSRC())

Arguments

indexID

the stockID of the index

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"

Examples

1
2
3
4
5
tmp <- getIndexComp("EI000300") # get the latest components, a vector
tmp <- getIndexComp("EI000300",drop=FALSE) # get the latest components, a dataframe
tmp <- getIndexComp("EI000300",as.Date("2012-12-31")) # get the components on single day,a vector
tmp <- getIndexComp("EI000300",as.Date(c("2011-12-31","2012-12-31"))) # get the components on multi-days, a data frame
tmp <- getIndexComp("EI000300",as.Date(c("2005-12-31","2012-12-31"))) # get the components before index's pubdate, a data frame

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