joshuaulrich / quantmod

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

Alphavantage API error uninformative when symbol not available #271

Closed evelynmitchell closed 4 years ago

evelynmitchell commented 5 years ago

Description

getSymbols.av: Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY

[Describe the issue] API calls to Alphavantage failing for unavailable symbol.

Expected behavior

Should return details of failure [Describe the behavior/output you expected] Data from the api call returned with more details.

Minimal, reproducible example

library(quantmod, quietly = T) .stock.prices <- new.env() options(getSymbols.warning4.0 = FALSE) SYMBOL <- getSymbols("SYMBOL", src="av", api.key = "demo", periodicity = "daily", env = .stock.prices)

[Insert sample data and code]

Session Info

[Insert your sessionInfo() output]

This is not a quantmod error. This is an AV error.

joshuaulrich commented 4 years ago

I looked into this, and I'm not sure how to make the error message more informative. Here is the current output:

R> getSymbols("SYMBOL", src="av", api.key = av.key, periodicity = "daily")
Error in getSymbols.av(Symbols = "SYMBOL", env = <environment>, verbose = FALSE,  : 
  Unable to import "SYMBOL".
getSymbols.av: Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY.

So getSymbols() throws an error and says it can't import "SYMBOL". Then it returns the message from the AlphaVantage API. Unfortunately, the API message isn't helpful.

I'm not sure what we could do to know the cause of the "invalid API call" in a general way.

evelynmitchell commented 4 years ago

That's enough of an explanation for me. You're welcome to close this.

joshuaulrich commented 4 years ago

Thanks for the follow-up! Sorry I can't do more...