Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for Alpha Vantage batch quotes #213

Closed
ethanbsmith opened this issue Jan 17, 2018 · 10 comments
Closed

add support for Alpha Vantage batch quotes #213

ethanbsmith opened this issue Jan 17, 2018 · 10 comments

Comments

@ethanbsmith
Copy link
Contributor

Description

Alpha Vantage recently added support for getting current price quotes fro multiple symbols. this is similar to the getQuote functionality form Yahoo. I think it would be good to extend the getQuote function to support this API, since AV provides real-time quotes vs yahoos 15 minutes delay

Full docs: https://www.alphavantage.co/documentation/#batchquotes

There are a few issues worth considering:

  1. I think its best to extend getQuote, not getSymbols. a. the intended use similar. b. the output form getSymbols is an xts object which is based on a matrix, and cannot handle the symbol column of the output
  2. The API only handles up to 100 symbols. I think it would be best for getQuote to internally handle the looping calls to av for input of over 100 symbols.
  3. AV only includes symbol,price,volume,timestamp in the output. this differs significantly from the yahoo version, but I think still fits within the quantmod framework, where different sources return different output

any issues/thoughts before i get started on a PR

@joshuaulrich
Copy link
Owner

Great idea! 1) I agree that this should go in getQuote(). 2) Just make it work for 100. Getting more than 100 is just an if statement and some recursive function calls. 3) Maybe check if users try to request more than that and warn if they do.

I don't have any specific thoughts right now. General comments are in the contributing guide. Thanks for contributing!

@ethanbsmith
Copy link
Contributor Author

I have this working version of mostly done. Along the way I realized this the AV function only returns current price, without OHL & V. I have reached out to AV asking them to enhance their API. will hold off on submitting this for a bit until I get a response (either way) from them.

@braverock
Copy link
Collaborator

@ethanbsmith quotes typically will only contain current price.

Trade feeds typically contain only trades. Many/Most exchanges don't report current volume, you typically have to aggregate that number yourself. The exchange only reports (if they report it at all) after the close.

Though I am a little confused that your prior report said 'volume' was one of the included fields.

@ethanbsmith
Copy link
Contributor Author

ethanbsmith commented Feb 6, 2018

their other single ticker functions all return an OHLCV time series result set
this new multi-ticker only includes latest price for each ticker
I don't think it's too much to ask them to include OHL & V for the day on the multi-ticker function. they certainly have the data

@ethanbsmith
Copy link
Contributor Author

ethanbsmith commented Feb 6, 2018

I know that for many of my use cases, i still need OHL & V for the day. The only way to get those is to loop through my ticker list, making round trip calls on their single ticker API. So, for me, i would never actually use the multi-ticker API as it stands.

@joshuaulrich
Copy link
Owner

@ethanbsmith any update on this? I need to get an update to CRAN in ~2 weeks, and it would be nice if this were included!

@ethanbsmith
Copy link
Contributor Author

I still have not heard back from AV on changing their API, so I have put in a PR with the working code based on the existing API. The PR failed CI, but from the logs, I think this may be an issue with getSymbols.google, rather than the new code. Any hints/suggestions welcome

@joshuaulrich
Copy link
Owner

@ethanbsmith Thanks for the update. You're correct that the failure is caused by getSymbols.google(). I just fixed that, so I can re-run your build(s?).

@helgasoft
Copy link

helgasoft commented Feb 3, 2020

It seems Alphavantage's API has changed and they do not have batch quotes anymore. Only single quote, like this.     So current getQuote does not work anymore:

getQuote(c('IBM','F'), src='av', api.key='yourOwn')   # No data for symbols: IBM, F

@joshuaulrich
Copy link
Owner

@helgasoft Thanks for the report! Could you please put this in a separate issue, so it doesn't get lost? I'd also really appreciate it if you could submit a PR. If you're not comfortable doing that, I'd still appreciate a suggested patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants