Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions R/getSymbols.R
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ function(Symbols,env,return.class='xts',

# getSymbols.FRED {{{
`getSymbols.FRED` <- function(Symbols,env,
return.class="xts", ...) {
return.class="xts", timeout=10, ...) {
importDefaults("getSymbols.FRED")
this.env <- environment()
for(var in names(list(...))) {
Expand All @@ -742,12 +742,13 @@ function(Symbols,env,return.class='xts',

returnSym <- Symbols
noDataSym <- NULL
ch <- curl::new_handle(timeout=timeout)

for(i in seq_along(Symbols)) {
if(verbose) cat("downloading ",Symbols[[i]],".....\n\n")
test <- try({
URL <- paste0(FRED.URL, Symbols[[i]])
fr <- read.csv(curl::curl(URL),na.strings=".")
fr <- read.csv(curl::curl(URL, handle=ch),na.strings=".")

if(verbose) cat("done.\n")
fr <- xts(as.matrix(fr[,-1]),
Expand Down
2 changes: 2 additions & 0 deletions man/getSymbols.FRED.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ additional getSymbols \sQuote{methods}.
getSymbols.FRED(Symbols,
env,
return.class = "xts",
timeout=10,
...)
}
%- maybe also 'usage' for other objects documented here.
Expand All @@ -27,6 +28,7 @@ getSymbols.FRED(Symbols,
the names of each symbol to be loaded}
\item{env}{ where to create objects. (.GlobalEnv) }
\item{return.class}{ class of returned object }
\item{timeout}{ timeout for the call in seconds }
\item{\dots}{ additional parameters }
}
\details{
Expand Down