get_data | R Documentation |
Download (and possibly) merge data from freely available databases.
get_data(x, from = NULL, to = NULL,
src = c("yahoo", "quandl", "oanda", "FRED", "google"),
FUN = NULL, verbose = TRUE, warn = TRUE, ...)
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
|
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
.
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.
Marius Hofert
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.