getQuote: getQuote

Description Usage Arguments Value Author(s) Examples

Description

get Quote series of stocks, indexs, futures in certain period

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
getQuote(stocks, begT = as.Date("1990-12-19"), endT = Sys.Date(),
  variables = select.list(CT_TechVars(datasrc = datasrc, secuCate = "EQ",
  tableName = tableName)[["varName"]], graphics = TRUE, multiple = TRUE),
  melt = FALSE, split, splitNbin = "year", tableName = "QT_DailyQuote",
  datasrc = defaultDataSRC())

getIndexQuote(stocks, begT = as.Date("1990-12-19"), endT = Sys.Date(),
  variables = select.list(CT_TechVars(datasrc = datasrc, secuCate = "EI",
  tableName = "QT_IndexQuote")[["varName"]], graphics = TRUE, multiple = TRUE),
  melt = FALSE, datasrc = defaultDataSRC())

Arguments

stocks

a charactor vector of stockID or indexID.

begT

an object of class "Date"

endT

an object of class "Date"

variables

a vector of charactor. Call funtion CT_TechVars(secuCate="EQ") to get all available variables of equity, funtion CT_TechVars(secuCate="EI") of equity index, and funtion CT_TechVars(secuCate="IF") of index future.

melt

a logical. If FALSE(default), the style of result is "stockID+date~variable";If TRUE, the quote data will be melted(see the examples for details).

split

logical

splitNbin

an interval specification, one of "day", "week", "month", "quarter" and "year", optionally preceded by an integer and a space, or followed by "s". See cut.Date for detail.

tableName

character string, giving the table name from which get data.

Value

the quote data, a data frame object with cols:stockID,date and the elements the param variable containing. If melt is TRUE, data frame with cols:stockID,date,variable,value

Author(s)

Ruifei.Yin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# get stock's quote
stocks <- c("EQ002001","EQ002002")
begT <- as.Date("2007-01-01")
endT <- as.Date("2013-02-01")
variables <- c("close","pct_chg","vwap")
re <- getQuote(stocks,begT,endT,variables,datasrc="local")
re <- getQuote(stocks,begT,endT,variables,melt=TRUE,datasrc="local")
stocks <- getIndexComp("EI000300")
system.time(uu2 <- getQuote(stocks,begT,endT,variables,datasrc="local",split=FALSE))
system.time(uu1 <- getQuote(stocks,begT,endT,variables,datasrc="local",split=TRUE))
# get index quote
indexs <- c("EI000001","EI000300")
begT <- as.Date("2015-01-01")
endT <- as.Date("2016-08-01")
variables <- c("close","pct_chg")
re <- getIndexQuote(indexs,begT,endT,variables,datasrc="local")
re <- getIndexQuote(indexs,begT,endT,variables,datasrc="jy")

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