I’m trying to use quantmod
package in R to get financial data from Yahoo. It works perfectly on my personal laptops (Mac and Win). But I cannot make it work on my working computer (Win7).
My code is:
getSymbols("JPM", src = "yahoo")
Please note it only doesn't work on my company laptop.
Here's the error code:
Error in curl::curl_download(cu, tmp, handle = h) :
SSL certificate problem: unable to get local issuer certificate
I have tried to solve the problems in the following ways:
install httr
package
Delete curl
, quantmod
and reinstall
Update to the latest version of R, RStudio, curl
, httr
, RCurl
and quantmod
Install openssl
package
Set ssl_verifypeer = 0L
add the following before getSymbols
options(download.file.method = "wget", download.file.extra = c("--no-check-certificate"))
Unfortunately, none of the above works. BTW, fetch data from google finance works but Google only provide ~ 4000 records per request.
I think our company has some restrictions on SSL but I'm totally fine in accessing websites start with https://
Also, the following code works:
library('httr')
content(GET('https://www.linkedin.com/in/lillyzhu'))
and
devtools::install_github
I have spent a week to solve this problem but I didn't make any progress. Now, I'm wondering is that possible to fix it? Any ideas will be helpful!
Thanks to all the contributors, have a great one!
Appendix: output from libcurlVersion()
[1] "7.40.0"
attr(,"ssl_version")
[1] "OpenSSL/1.0.0o"
attr(,"libssh_version")
[1] "libssh2/1.4.3"
attr(,"protocols")
[1] "dict" "file" "ftp"
[4] "ftps" "gopher" "http"
[7] "https" "imap" "imaps"
[10] "ldap" "pop3" "pop3s"
[13] "rtmp" "rtsp" "scp"
[16] "sftp" "smtp" "smtps"
[19] "telnet" "tftp"
Please feel free to let me know if you need any additional information of my laptop.
UPDATE: I test the function on my company's laptop without logging in VPN, it works. So any idea to make it work inside VPN?
The problem is because cURL
is using OpenSSL
by default. It can be fixed to use winSSL
by installing a special version of cURL
by,
Sys.setenv(LIBCURL_BUILD="winssl")
install.packages("https://github.com/jeroen/curl/archive/master.tar.gz", repos = NULL)
Please refer to this link: