business-science / alphavantager

A lightweight R interface to the Alpha Vantage API
69 stars 30 forks source link

av_get returns only the default "compact" result set of 100 rows #3

Closed scottdoubet closed 6 years ago

scottdoubet commented 6 years ago

fDF <- av_get("MSFT", "TIME_SERIES_DAILY_ADJUSTED", "full") cDF <- av_get("MSFT", "TIME_SERIES_DAILY_ADJUSTED", "compact")

The number of rows returned is 100 in both cases. Docs state that the default outputsize parameter is "compact". Perhaps the parameter is not seen or processed properly

If I use a url and do a read.table: url <- "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&apikey=MYapiKey&outputsize=full&datatype=csv&symbol=MSFT" csvDF <- read.table(url, header=TRUE, sep=",")

csvDF has 4000+ rows

mdancho84 commented 6 years ago

Maybe try specifying arguments per the documentation.

fDF <- av_get("MSFT", av_fun = "TIME_SERIES_DAILY_ADJUSTED", outputsize = "full")

scottdoubet commented 6 years ago

Thanks. Typing that from the R command line worked this time and has worked previously

Some magic is missing from my R code writing world. I have looked but not found a way to programmatically construct the argument string parameters with the quotes and commas, etc. When I saw documentation that seemed to show position and keyword sensitivity, I thought maybe av_get would just “see”, “full” and be happy.

Do you know how to construct (“paste”, “cat”, etc.) this: "MSFT", av_fun = "TIME_SERIES_DAILY_ADJUSTED", outputsize = "full")

Because I sure can’t seem to do it. In Perl, maybe, but R? Not so much.

Thanks in advance,

mdancho84 commented 6 years ago

Hmm, not sure. A good avenue might be to add your question to StackOverflow. I'm sure someone has previously tried to do something similar (and may have succeeded).