tyrauber / stock_quote

A ruby gem that retrieves stock quotes from IEX
MIT License
210 stars 57 forks source link

IEX Trading API #56

Closed tyrauber closed 6 years ago

tyrauber commented 6 years ago

Unfortunately, on or around March 15th, 2018, Google once again terminated public access to the Finance API. Having rebuilt this gem more times than I'd like to admit - switching back and forth between Yahoo and Google with every API change and discontinuation - I seriously considered pulling stock_quote from rubygems and closing this repo.

Last night I found the IEX Trading AP, a free, open, high-performance, comprehensive, well-documented finance API. I played around with the API a bit and was pretty impressed. It's functionally an improvement over previous versions that utilized Yahoo and Google Finance APIs.

I am a little hesitant about switching to IEX, an unknown newcomer, given how little stability Yahoo or Google provided - and I HATE breaking changes - but the stock_quote is currently broken.

This branch updates stock_quote to use the IEX trading API. It's free. No registration or API key is required.

To test out this branch, using the following syntax in your Gemfile:

gem "stock_quote", github: 'tyrauber/stock_quote', branch: 'iex'

The following query syntax still applies:

StockQuote::Stock.query('aapl')

With a whole host of additional functionality.

I'd like to propose we merge this in as V2.0.0 of stock_quote. Thoughts?

henrydabrow commented 6 years ago

thank You so much, it works well again.

tohakotliarenko commented 6 years ago

Works good, thank you! Deserves to be a new version! Unfortunately IEX doesn't support stocks that I need.

henrydabrow commented 6 years ago

i notticed that StockQuote::Stock.quote('aapl').company_name doesnt work

tyrauber commented 6 years ago

That's unfortunate. What stocks does IEX not support, @tohakotliarenko?

@henrydabrow, just pushed a fix to address the bug, v1.6.0 branch IEX.

tohakotliarenko commented 6 years ago

@tyrauber for example FRA:XCS5/6

tyrauber commented 6 years ago

@tohakotliarenko, is that a mutual fund? It looks like IEX is working on Mutual Fund Support. Perhaps you could post your data requirements there? Or if you can provide another API that has that support already, we could see about integrating that API into stock_quote as well?

In the meantime, I am going to merge this in. My tests indicate that - for stocks, at least - IEX coverage is really good and API performance is stellar.

Besides, any version is better than broken.

tyrauber commented 6 years ago

Merged and pushed. 2.0.0.

dblock commented 6 years ago

If someone is looking for a dedicated IEX client, see https://github.com/dblock/iex-ruby-client. Also opened https://github.com/iexg/IEX-API/issues/273.

tyrauber commented 6 years ago

Thanks @dblock, How does iex-ruby-client differ from stock_quote? iex-ruby-client appears to only utilize the Quote endpoint, while stock_quote implements the majority of IEX endpoints. What benefit does iex-ruby-client provide over stock_quote?

dblock commented 6 years ago

Just like you, @tyrauber I've gone from using Yahoo, Google Finance and now IEX. So first I want to say that this library is great and you're doing an amazing job keeping track of the underling API changes and constantly moving forward. And so this library is a moving target, trying to preserve the same interface regardless of the backend. I wanted to create something dedicated for IEX and with IEX specifics, if any. Currently there're only a few major differences.

You're right that it doesn't implement the majority of the API. It's easy to add, just didn't have time.