quantmod error in getSymbols(): download failed, HTTP error 404

I am trying to use the quantmod package. I do not understand how to fix this error. I am new to R and i feel like i've just hit a wall for 3 days. Please help Ive put my code below.

df <- data.frame()

install.packages("quantmod")
library(quantmod)


df<- data.frame(getSymbols("APPL",auto.assign = F))

This is the console output:

Warning: APPL download failed; trying again.
Error in getSymbols.yahoo(Symbols = "APPL", env = <environment>, verbose = FALSE,  : 
  Unable to import “APPL”.
APPL download failed after two attempts. Error message:
HTTP error 404.

"APPL" symbol doesn't exist, maybe you are making a typo and you mean "AAPL"

This works

library(quantmod)

df <- data.frame(getSymbols("AAPL", auto.assign = FALSE))

head(df)
#>            AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume
#> 2007-01-03  12.32714  12.36857 11.70000   11.97143   309579900
#> 2007-01-04  12.00714  12.27857 11.97429   12.23714   211815100
#> 2007-01-05  12.25286  12.31428 12.05714   12.15000   208685400
#> 2007-01-08  12.28000  12.36143 12.18286   12.21000   199276700
#> 2007-01-09  12.35000  13.28286 12.16429   13.22429   837324600
#> 2007-01-10  13.53571  13.97143 13.35000   13.85714   738220000
#>            AAPL.Adjusted
#> 2007-01-03      10.44763
#> 2007-01-04      10.67952
#> 2007-01-05      10.60347
#> 2007-01-08      10.65583
#> 2007-01-09      11.54101
#> 2007-01-10      12.09331

Created on 2019-08-10 by the reprex package (v0.3.0)

Hi, Adrian, and welcome

The ticker symbol for Apple is AAPL, not APPL.

The last line "HTTP error 404" indicates that 1) the API successfully connected to Yahoo, but 2) Yahoo had no page for APPL

In cases like this, where you find yourself repeatedly getting the same error, it's a good idea to test with other arguments to the function, such as "GE" to see whether the error affects all arguments or only the one you are using. Then, check your argument (no matter how confident you might feel!) and you'll usually find an error like the one you ran into.

Good luck!

You guys are awesome,

Thank you!

Hopefully one day i can pass the buck.

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.