tyrauber / stock_quote

A ruby gem that retrieves stock quotes from IEX
MIT License
211 stars 55 forks source link

IEX Library - Specific date syntax in RoR #58

Closed pabloliberona closed 1 year ago

pabloliberona commented 6 years ago

Good afternoon,

I've been able to succesfully use the library, using different methods in RoR, like:

StockQuote::Stock.quote StockQuote::Stock.stats StockQuote::Stock.chart

But I'm having issues to fetch an specific date. For example, I can fetch the last 6 months in a daily basis, using:

@stock_chart = StockQuote::Stock.chart(params[:id], '6m')

But I need to fetch an specific date with this method. In the iextrading documentation, it says:

"Specific date : IEX-only data by minute for a specified date in the format YYYYMMDD if available. Currently supporting trailing 30 calendar days''

And the HTTP requested is:

/stock/aapl/chart/date/20180620

I tried to execute this commend in Ruby On Rails. But I haven't been able to translate the HTTP request, into RoR format in order to be succesfully fetched the trend data. In the stock_quote documentation there is not also any reference to this specific command.

I appreciate any help with this issue, I've tried around 20+ syntax ways but didn't worked.

Thanks in advance. Regards, Pablo L.

Post Data: Is my first time commenting in Github. Maybe this section is not the proper one to ask this kind of question. If so, I'd appreciate to kindly be refered to the proper site to ask this question. Thanks!

tyrauber commented 6 years ago

Hi @Liberona, welcome.

I think I know what the issue is. The gem uses IEX's batching endpoint to make these queries, allowing the gem to query multiple stock symbols per request. Unfortunately, it looks like batching doesn't support a chart with a date, just a range. Other people have requested this feature of IEX, but as of now it isn't available.

Unfortunately, that means the gem would have to be modified to accommodate this request. I'll need to think on the best way of doing this without sacrificing the simplicity of the gem.