Closed ethanbsmith closed 4 years ago
I think the main jist of the fix is to replace line 59:
sq <- response$quoteResponse$result
with:
sq <- merge.data.frame(data.frame(symbol = Symbols), response$quoteResponse$result, by = "symbol", all = T)
if I can find some time, I'll try cruft up a pr
Thanks for the report and patch! Your suggestion is very close, but wouldn't quite work because Symbols
would be "DE,DEENF"
at line 59. You would need to do it after line 80.
It might also be good to only do the merge conditioned on NROW(sq) != length(Symbols)
. Also, it's not good practice to call methods directly, so I would change merge.data.frame()
to just be merge()
, and I would add a stringsAsFactors = FALSE
to the data.frame constructor, just to be safe.
So something like:
if (length(Symbols) != NROW(sq)) {
sq <- merge(data.frame(symbol = Symbols, stringsAsFactors = FALSE),
sq, by = "symbol", all = TRUE)
}
Please double-check that works, and make a PR when you're ready. Thanks!
This was fixed in #282. Closing.
Description
getQuote.yahoo fails if yahoo does not recognize any of the symbols. This is particularly problematic when a very large list of quotes is requested as identifying the offending symbol is near impossible. Since the identifying Symbol may be perfectly valid, but yahoo just doesn't recognize it. eg:
DEENF which is a valid OTC ticker: https://www.otcmarkets.com/stock/DEENF/overview
Expected behavior
ideally getQuote would return the values for the found symbols and NAs for the ones that weren't found
Minimal, reproducible example
Session Info