| import-fred | R Documentation |
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)
symbols |
a character string with the symbols to be downloaded. |
from |
the start date of the time series to extract. |
to |
the end date of the data download, by default the current date. |
nDaysBack |
the number of days back. |
... |
optional arguments to be passed to |
query |
a character string, denoting the location of the data at the web site. |
file |
where to save the downloaded data, a character string with filename, usually having extension ".csv". |
source |
a character string setting the URL of the source. If |
frequency |
a character string, one of |
save |
a logical value, if set to |
sep |
a character value specifying the column separator. |
try |
a logical value, if set to TRUE the Internet access will be checked. |
for fredSeries, an object of class timeSeries.
for fredImport, an object of class fWEBDATA with the
following slots:
@call |
the function call. |
@data |
the downloaded data as an object from class |
@param |
a character vector whose elements contain the values of selected parameters of the argument list. |
@title |
a character string with the name of the download. This can be overwritten specifying a user defined input argument. |
@description |
a character string with an optional user defined description. By default just the current date when the test was applied will be returned. |
Internet Download Functions:
IMPORTANT NOTE: If the service provider changes the data file format it may become necessary to modify and update the functions.
Feel free to inspect the code of the functions and to create your own download function from other Internet web sites and Portals.
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.
a <- fredImport("DEXSZUS")
head(a@data) # a@data is a "timeSeries" object
b <- fredSeries("DEXSZUS")
head(b) # a "timeSeries" object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.