Quantmod Error 'cannot open URL'

∥☆過路亽.° 提交于 2019-11-27 15:17:04

FRED changed the URL scheme from http:// to https://. I'm working on determining a patch that will work on all platforms. The current code still works for me on Windows if --internet2 is set.

On unix-alikes, one potential solution is to add method="curl" or method="wget" to the download.file call in getSymbols.FRED.

Another (temporary) solution is to call one of the following before the actual getSymbols script:

options(download.file.method="libcurl")
or
options(download.file.method="wget")
or
options(download.file.method="wininet")

The first option works for me (on Mac).
Thanks Paul Gilbert from Rmetrics (bottom post)

Aditsan

The problem appeared yesterday:
Cannot verify certificate for stlouisfed.org issued by GoDaddy.

A workaround:

temp = tempfile()

download.file(url="http://research.stlouisfed.org/fred2/series/DAAA/downloaddata/CPIAUCNS.csv",destfile=temp, method="libcurl")

result <- read.csv(temp,na.string=".")

I hope having to use this fix is temporary.

Here is solution that works for me, assuming you trust FRED's SSL certificate.

All you need to do is adding the following extra line of code before executing getSymbols:

options(download.file.method = "wget", download.file.extra = c("--no-check-certificate"))

Example:

getSymbols("M2", from = start_date, to = end_date, src = "FRED")

[1] "M2"

str(M2)

An ‘xts’ object on 1980-11-03/2015-10-05 containing: Data: num [1:1823, 1] 1591 1593 1596 1597 1596 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr "M2" Indexed by objects of class: [Date] TZ: UTC xts Attributes:
List of 2 $ src : chr "FRED" $ updated: POSIXct[1:1], format: "2015-10-21 11:01:39"

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!