Closed sillasgonzaga closed 3 years ago
HTTP 404 means the site is not found. That's most likely because Yahoo doesn't provide historical data for that ticker.
The Yahoo Finance page itself suggests that too. https://finance.yahoo.com/quote/BIYW39.SA/history?p=BIYW39.SA
So there's nothing I can fix here.
That's a pity. Thanks for the quick reply.
@sillasgonzaga Did you figure out a solution here? I'm curious since I'm hitting a similar issue. Here's an example:
stock.list <- c("AAPL", "GFL.TO","RICHT.BD")
stock.df <- tidyquant::tq_get(stock.list, get = "stock.prices",
from = "2021-06-17", to = "2021-06-22")
It returns:
There were 50 or more warnings (use warnings() to see the first 50)
When I run warnings()
, I see:
Warning messages:
1: Problem with `mutate()` column `data..`.
ℹ `data.. = purrr::map(...)`.
ℹ x = 'REAL.TO', get = 'stock.prices': Error in getSymbols.yahoo(Symbols = "REAL.TO", env = <environment>, verbose = FALSE, : Unable to import “REAL.TO”.
Operation was aborted by an application callback
Removing REAL.TO.
2: Problem with `mutate()` column `data..`.
ℹ `data.. = purrr::map(...)`.
ℹ x = 'YRI.TO', get = 'stock.prices': Error in getSymbols.yahoo(Symbols = "YRI.TO", env = <environment>, verbose = FALSE, : Unable to import “YRI.TO”.
argument "conn" is missing, with no default
Removing YRI.TO.
etc
It eventually stops running my scripts (which is trying to get a lot of stock quotes) with Execution halted
. I'd love to figure out how I can run this and handle the warning where it doesn't break my script.
Note - I know that I'm using tidyquant
and not quantmod
but it seems like we're both facing the same problem with the Yahoo Finance API.
@aqsmith08 the error was improved in #333. You're using tidyquant, but tq_get() is basically a wrapper around getSymbols(). It's not a different implementation.
Try the latest development version of quantmod and see what the actual error is. If it's HTTP 404, there's nothing I can do. That means Yahoo doesn't have historical data for the stock.
Thanks @joshuaulrich. It does look to be the HTTP 404.
> getSymbols.yahoo("RICHT.BD", auto.assign = FALSE)
Warning: RICHT.BD download failed; trying again.
Warning: Unable to import “RICHT.BD”.
argument "conn" is missing, with no default
[1] "Error in open.connection(file, \"rt\") : HTTP error 404.\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in open.connection(file, "rt"): HTTP error 404.>
I'll consider creating a blacklist of stock tickers and filter them out prior to running them through Yahoo Finance or consider another data source. Appreciate your quick reply!
I had this exact same problem when calling with to="", which used to work. Removing the parameter and letting it default fixed my problem.
Don't know if that's a clue?
@IanWorthington did you encounter this in the latest development version? It should be fixed.
getSymbols("BTC-USD") Warning: BTC-USD download failed; trying again. Error in getSymbols.yahoo(Symbols = "BTC-USD", env =
, verbose = FALSE, : Unable to import “BTC-USD”. argument "conn" is missing, with no default
This issue does not occur when using the get symbols sourced to FRED
This issue does not occur when using the get symbols sourced to FRED
Right. It's specific to Yahoo. It shouldn't occur for any other source.
BTC-USD works for me. Your issue might have been a temporary issue with Yahoo, or something specific to your setup.
R$ quantmod::getSymbols("BTC-USD")
[1] "BTC-USD"
Warning message:
BTC-USD contains missing values. Some functions will not work if objects contain missing values in the
middle of the series. Consider using na.omit(), na.approx(), na.fill(), etc to remove or replace them.
R$ head(`BTC-USD`)
BTC-USD.Open BTC-USD.High BTC-USD.Low BTC-USD.Close BTC-USD.Volume BTC-USD.Adjusted
2014-09-17 465.864 468.174 452.422 457.334 21056800 457.334
2014-09-18 456.860 456.860 413.104 424.440 34483200 424.440
2014-09-19 424.103 427.835 384.532 394.796 37919700 394.796
2014-09-20 394.673 423.296 389.883 408.904 36863600 408.904
2014-09-21 408.085 412.426 393.181 398.821 26580100 398.821
2014-09-22 399.100 406.916 397.130 402.152 24127600 402.152
This issue does not occur when using the get symbols sourced to FRED
Right. It's specific to Yahoo. It shouldn't occur for any other source.
BTC-USD works for me. Your issue might have been a temporary issue with Yahoo, or something specific to your setup.
R$ quantmod::getSymbols("BTC-USD") [1] "BTC-USD" Warning message: BTC-USD contains missing values. Some functions will not work if objects contain missing values in the middle of the series. Consider using na.omit(), na.approx(), na.fill(), etc to remove or replace them. R$ head(`BTC-USD`) BTC-USD.Open BTC-USD.High BTC-USD.Low BTC-USD.Close BTC-USD.Volume BTC-USD.Adjusted 2014-09-17 465.864 468.174 452.422 457.334 21056800 457.334 2014-09-18 456.860 456.860 413.104 424.440 34483200 424.440 2014-09-19 424.103 427.835 384.532 394.796 37919700 394.796 2014-09-20 394.673 423.296 389.883 408.904 36863600 408.904 2014-09-21 408.085 412.426 393.181 398.821 26580100 398.821 2014-09-22 399.100 406.916 397.130 402.152 24127600 402.152
Thanks a lot for the reply. Its definitely due to my PC, my other computer runs it fine. When I first installed Quantmod on this PC it wouldnt load the most recent version. Any insight as to why my setup is experiencing this error with Yahoo?
Hey guys, just wanna comment that I solved this issue in my script by changing auto.assign to FALSE.
Example
From this:
getSymbols("KO", src = "yahoo", from = "2021-01-19", to = "2021-06-18", auto.assign = TRUE)
To this:
ko.data <- getSymbols("KO", src = "yahoo", from = "2021-01-19", to = "2021-06-18", auto.assign = FALSE)
It solved for me, maybe for some of you will too.
Description
I'm trying to run
getSymbos.yahoo()
for this specific ticker but it returns an error, even though it can be found on Yahoo Finance :Minimal, reproducible example
Output:
Session Info