8

Update: April 29, 2022

As per this discussion in Github, Joshua Ulrich had uploaded a patch into Github which resolves the issue.

The issue was with Yahoo website having stopped to provide the crumb(s) that were expected by the new.session() but not essential for getting getSymbols() to work.

To install the patch, exit all R and RStudio sessions. Start a new R or RStudio session. Execute the commands

remotes::install_github("joshuaulrich/quantmod@358-getsymbols-new.session")
library("quantmod")
quantmod::getSymbols("TSLA")

Original question

Today (April 28, 2022) I got an unusual situation with quantmod::getSymbols().

The following code works if executed in an RStudio session that was started yesterday (R version 4.2.0, Windows 10):

if (!require("quantmod")) install.packages("quantmod")
library("quantmod")
quantmod::getSymbols("TSLA")

However, the same code produces a timeout error in a new RStudio session on the same machine:

Error in new.session() : Could not establish session after 5 attempts.

What was tried:

  1. Same code in Jupyter notebook on a remote server produces the same timeout.
  2. Same code in a new RStudio (or R) session on a different Windows 10 computer produces the same timeout.
  3. Same code in an RStudio (or R) session works if the session was started yesterday on either Windows 10 computer.
  4. Same code on previous versions of R or RStudio works if the session was started yesterday on either Windows 10 computer.

Perhaps the quantmod package and getSymbols() have cached the SSL certificates?

whereupon
  • 81
  • 2
  • I don't use `quantmod`, but can you confirm that the API it uses is in fact working today? Outages happen. – r2evans Apr 29 '22 at 02:10
  • The API is working -- I am able to get the data for any stock symbol if I use the RStudio session that was started yesterday. But, I cannot do that if I start a new session, locally or on a remote machine. – whereupon Apr 29 '22 at 02:51
  • I had the same problem yesterday, but after a while it disappeared. Might just be worth the wait – Jack Po Apr 29 '22 at 06:40
  • 4
    I'm working on getting a fix to CRAN. You can use the development version in the meantime. Follow the [GitHub issue](https://github.com/joshuaulrich/quantmod/issues/358) – Joshua Ulrich Apr 29 '22 at 14:29
  • 1
    Thank you Joshua for fixing the problem! – whereupon Apr 29 '22 at 18:20
  • Something very odd is happening with the new package. I reinstalled quantmod and it appeared that it was working. I was able to download price information at first. But then in the middle of downloading price information for about 500 stocks, I started getting the "Error in Download" message. It seems to start the error message after about 195 stocks. That may be random, but I'm curious if there is a limit to how many stocks a person can download? Then after I get the "Error in Download" message, I have to reinstall the package again, sometimes to no avail... Any ideas? – Jcarl Apr 30 '22 at 15:23

0 Answers0