joshuaulrich / quantmod

Quantitative Financial Modelling Framework
http://www.quantmod.com/
GNU General Public License v3.0
828 stars 225 forks source link

Are Yahoo and FRED resources down? Is it temporary? #357

Closed DavisVaughan closed 2 years ago

DavisVaughan commented 2 years ago

Hi @joshuaulrich,

CRAN ran revdeps for dplyr for us, and we found some false positive failures that seem like they may have been related to quantmod::getSymbols(), so I wanted to pass it along just in case you wanted to take a look:

BatchGetSymbols (which uses quantmod):

Package: BatchGetSymbols
Check: examples
New result: ERROR
  Running examples in ‘BatchGetSymbols-Ex.R’ failed
  The error most likely occurred in:

  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: BatchGetSymbols
  > ### Title: Function to download financial data
  > ### Aliases: BatchGetSymbols
  >
  > ### ** Examples
  >
  > tickers <- c('FB','MMM')
  >
  > first.date <- Sys.Date()-30
  > last.date <- Sys.Date()
  >
  > l.out <- BatchGetSymbols(tickers = tickers,
  +                          first.date = first.date,
  +                         last.date = last.date, do.cache=FALSE)

  Running BatchGetSymbols for:
     tickers =FB, MMM
     Downloading data for benchmark ticker
  ^GSPC | yahoo (1|1) - Error in download..
  FB | yahoo (1|2) - Error in download..
  MMM | yahoo (2|2) - Error in download..Warning: Unknown or
uninitialised column: `ticker`.
  Warning: Unknown or uninitialised column: `threshold.decision`.
  Warning: Unknown or uninitialised column: `ticker`.
  Warning: Unknown or uninitialised column: `price.adjusted`.
  Error in `vec_slice()`:
  ! `x` must be a vector, not NULL.
  Backtrace:
      ▆
   1. ├─BatchGetSymbols::BatchGetSymbols(...)
   2. │ └─BatchGetSymbols::calc.ret(...)
   3. │   └─dplyr::lag(P)
   4. │     ├─vctrs::vec_c(...)
   5. │     └─vctrs::vec_slice(inputs$x, seq_len(xlen - n))
   6. └─vctrs:::stop_scalar_type(`<fn>`(NULL), "x", `<env>`)
   7.   └─vctrs:::stop_vctrs(...)
   8.     └─rlang::abort(message, class = c(class, "vctrs_error"),
..., call = vctrs_error_call(call))
  Execution halted

treasuryTR

Package: treasuryTR
Check: examples
New result: ERROR
  Running examples in ‘treasuryTR-Ex.R’ failed
  The error most likely occurred in:

  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: total_return
  > ### Title: Calculate bond total returns from constant-maturity yield data
  > ### Aliases: total_return
  >
  > ### ** Examples
  >
  > library(dplyr)
  > # download US treasury 10Y constant-maturity
  > #   yield data and compute a total return series
  > t10_yield <- get_yields("DGS10")
  Error in getSymbols.FRED(Symbols = "DGS10", env = <environment>,
verbose = FALSE,  :
    Unable to import “DGS10”.
  HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
  Calls: get_yields -> <Anonymous> -> do.call -> getSymbols.FRED
  Execution halted
joshuaulrich commented 2 years ago

Howdy. These types of errors from Yahoo Finance are usually intermittent and due to the Yahoo server. I've never seen that error from FRED, and I'm not able to replicate... so I'm not sure what's going on there.

DavisVaughan commented 2 years ago

Gotcha, probably just an intermittent issue in both cases then. Feel free to close, just wanted to let you know!

joshuaulrich commented 2 years ago

Thanks, appreciate the heads-up!

joshuaulrich commented 2 years ago

@DavisVaughan looks like there may be an issue with getSymbols() for Yahoo. I must have been hitting an older cache this morning. I was able to replicate the behavior in #358. I'm testing a fix.

FRED still works for me.

datawookie commented 2 years ago

Hi @joshuaulrich, just wondering about the progress with your fix. We use the {quantmod} package quite extensively (thank you, it's brilliant!! :1st_place_medal:) and it'd be great to know when a fix will be available. At the same time, no pressure, I'm sure that you have a lot on your plate. Best regards, Andrew.