Imports financial time series data from fred.stlouisfed.org.
fredSeries(symbols, from = NULL, to = Sys.timeDate(),
nDaysBack = 366, ...)
fredImport(query, file = "tempfile", source = NULL, frequency = "daily",
from = NULL, to = Sys.timeDate(), nDaysBack = NULL,
save = FALSE, sep = ";", try = TRUE)for fredSeries, an object of class timeSeries.
for fredImport, an object of class fWEBDATA with the
following slots:
the function call.
the downloaded data as an object from class "timeSeries".
a character vector whose elements contain the values of selected parameters of the argument list.
a character string with the name of the download. This can be overwritten specifying a user defined input argument.
a character string with an optional user defined description. By default just the current date when the test was applied will be returned.
a character string with the symbols to be downloaded.
the start date of the time series to extract.
the end date of the data download, by default the current date.
the number of days back.
optional arguments to be passed to fredImport.
a character string, denoting the location of the data at the web site.
where to save the downloaded data, a character string with filename, usually having extension ".csv".
a character string setting the URL of the source. If NULL,
then the URL will be set automatically to its default value.
a character string, one of "auto", "quarterly",
"monthly", or "daily", defining the frequency of the
data records. Only needed if the import function fails to
autodetect the frequency of the time series to be dowwnloaded.
a logical value, if set to TRUE the downloaded data file will be
stored under the path and file name specified by the string
file. By default FALSE.
a character value specifying the column separator.
a logical value, if set to TRUE the Internet access will be checked.
Diethelm Wuertz for the Rmetrics R-port.
Diethelm Wuertz, Yohan Chalabi, and Andrew Ellis, (2010); Financial Market Data for R/Rmetrics, Rmetrics eBook, Rmetrics Association and Finance Online, Zurich, www.rmetrics.org.
# \donttest{
a <- fredImport("DEXSZUS")
head(a@data) # a@data is a "timeSeries" object
b <- fredSeries("DEXSZUS")
head(b) # a "timeSeries" object
# }
Run the code above in your browser using DataLab