get_data {qrmtools} | R Documentation |
Tools for Getting and Working with Data
Description
Download (and possibly) merge data from freely available databases.
Usage
get_data(x, from = NULL, to = NULL,
src = c("yahoo", "quandl", "oanda", "FRED", "google"),
FUN = NULL, verbose = TRUE, warn = TRUE, ...)
Arguments
x |
vector of ticker symbols (e.g. |
from |
start date as a |
to |
end date as a |
src |
character string specifying the data source
(e.g. |
FUN |
|
verbose |
|
warn |
|
... |
additional arguments passed to the underlying
|
Details
FUN
is typically one of quantmod's Op
,
Hi
, Lo
, Cl
, Vo
,
Ad
or one of the combined functions OpCl
,
ClCl
, HiCl
, LoCl
, LoHi
,
OpHi
, OpLo
, OpOp
.
Value
xts
object containing the data with column name(s)
adjusted to be the ticker symbol (in case lengths match; otherwise the
column names are not adjusted); NA
if
data is not available.
Author(s)
Marius Hofert
Examples
## Not run:
## Note: This needs a working internet connection
## Get stock and volatility data (for all available trading days)
dat <- get_data(c("^GSPC", "^VIX")) # note: this needs a working internet connection
## Plot them (Alternative: plot.xts() from xtsExtra)
library(zoo)
plot.zoo(dat, screens = 1, main = "", xlab = "Trading day", ylab = "Value")
## End(Not run)