Economagic {fImport} | R Documentation |
A collection and description of functions to import
financial and economic market data from Economagic.
The functions are:
economagicImport | Economic series from Economagic's Web site, |
economagicSeries | easy to use download from Economagic. |
economagicImport(query, file = "tempfile", source = "http://www.economagic.com/em-cgi/data.exe/", frequency = c("quarterly", "monthly", "daily"), save = FALSE, colname = "VALUE", try = TRUE) economagicSeries(query, frequency = c("quarterly", "monthly", "daily"), returnClass = c("timeSeries", "ts", "matrix", "data.frame"), getReturns = FALSE, ...)
getReturns |
a logical flag. Should return values be computed using the
function returnSeries ?
|
colname |
a character string which defines the name of the value column. By default "VALUE". |
file |
a character string with filename, usually having extension ".csv", where to save the downloaded data. |
frequency |
a character string, one of "quarterly", "monthly", or "daily", defining the frequency of the data records. |
query |
a character string, denoting the location of the data at the web site. |
returnClass |
a character string naming the class of the object to be
returned. By default the function returns
a "timeSeries" object, alternatives are: "ts" ,
"matrix" , or "data.frame" .
|
save |
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.
|
source |
a character string with the download URL. |
try |
a logical value, if set to TRUE the Internet access will be checked. |
... |
optional arguments to be passed. |
Import data from www.economagic.com
Frequently requested data files from Economagic for the US economy include:
[query] | Description: |
var/leading-ind-long | Index of Leading Economic Indicators |
beana/t102l01 | Real Gross Domestic Product |
fedstl/trsp500 | SP 500 Total Return |
fedstl/gnp | Gross National Product in Current Dollars |
var/cpiu-long | Consumer Price Index - All Urban Consumers |
feddal/ru | Unemployment Rate |
fedstl/indpro | Total Industrial Production Index |
fedstl/exjpus+2 | FX Rate: Japanese Yen to one US Dollar |
fedstl/fedfunds+2 | Federal Funds Rate |
fedstl/mdiscrt+2 | Discount Rate |
fedbog/tcm30y+2 | 30-Year Treasury Constant Maturity Rate |
fedstl/mprime+2 | Bank Prime Loan Rate |
fedstl/tb3ms+2 | 3-Month Treasury Bills - Secondary Market |
fedstl/tb6ms+2 | 6-Month Treasury Bills - Secondary Market |
fedbog/cm+2 | 30 Year Federal Home Loan Mortgages |
var/west-texas-crude-long | Price of West Texas Intermediate Crude |
The function economagicImport
returns an S4 object of class
fWEBDATA
with the following slots:
@call |
the function call. |
@data |
the data as downloaded formatted as a data.frame. |
@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. |
The function economagicSeries
returns an S4 object of
class timeSeries
or alternatively an object specified by
the function argument returnClass
.
Internet Download Functions:
IMPORTANT NOTE: If the service provider changes the data file format
it may become necessary to modify and update the functions.
Diethelm Wuertz for the Rmetrics R-port.
## Not run: ## economagicImport - USDEUR = economagicImport(query = "fedny/day-fxus2eu", frequency = "daily", colname = "USDEUR") # Print Data Slot if Internet Download was Successful: if (!is.null(USDEUR)) print(USDEUR@data[1:20, ]) ## economagicImport - USFEDFUNDS = economagicImport(query = "fedstl/fedfunds+2", frequency = "monthly", colname = "USFEDFUNDS") if (!is.null(USFEDFUNDS)) print(USFEDFUNDS@data[1:20, ]) ## economagicImport - USGNP = economagicImport(query = "fedstl/gnp", frequency = "quarterly", colname = "USGNP") if(!is.null(USGNP)) print(USGNP@data[1:20, ]) ## End(Not run)