Closed daviddigital closed 1 year ago
Hi @daviddigital,
Yes, there have been some changes and using the v6
instead of the v7
API is just a workaround for now. I will nevertheless plan a new release of this gem probably still today.
@daviddigital the new version 0.4.0 of the gem has now been released.
Awesome work @brigriffin
Now v6 is down đ˘ https://query1.finance.yahoo.com/v6/finance/quote?symbols=AAPL
Looking into alternatives and I'll create a PR if I find one
Short of doing something like using this endpoint for the graph (very wasteful) https://query1.finance.yahoo.com/v8/finance/chart/AAPL I couldn't see anything having a google and inspecting the network tab on their site.
I am probably going to have to investigate other options like https://site.financialmodelingprep.com/developer/docs/#Ticker-Search which unfortunately may not be suitable for this gem but meets my use case of getting some data for a hobby project.
If I'm wrong and you do think this resource provider would be useful I could submit a PR. Users of this gem would need to provide an API key for the service still.
I have seen some others move to this service e.g. OpenBB
Iâll submit a PR for the v10 option yfinance use for review shortly
It was really just a matter of time until they also take down the v6 version of their API unfortunately... If you have a moment a PR would be very welcome for their new v10 API.
Thanks for merging the the PR @brigriffin
Checking out your commits, looks good, like defaulting to price, but I had one thought about this inefficient process of handling multiple tickers.
For the request https://github.com/towards/basic_yahoo_finance/blob/156a24137209e73b7e17483e7f5b0c9ce3abbdfa/lib/basic_yahoo_finance.rb#L23
Do you know how open-uri
is handling the requests in terms of whether its starting a new connection each time? Yahoo finance's api can handle persistent connections so we should be able to use sometihng like this so that we open the connection -> perform each of the requests -> close the connection.
Let me know your thoughts. Maybe something for the future
Relevant gem which is a wrapper on the above https://github.com/drbrain/net-http-persistent
Confirming that open-uri
is opening up a new connection each time.
Let me know if you'd like me to put together a PR @brigriffin
Great idea regarding the persistent connections, it should make the querying of multiple symbols faster. I tested with around 15 symbols and the speed it not too bad. If you have time a PR would be good, no urgency though as for now it works nicely.
Cool, I'll have a look next weekend, do you mind if we release the current build now and I'll close this issue?
Actually I ended up implementing this, just sorting out the error handling, seems to be a lot faster, PR to come shortly.
Have a look at my latest commit 6644308 it includes full code coverage and that would be the commit I will use for a new release of the gem if you are fine with that.
Looks great @brigriffin thanks for fixing that test, letâs ship it!
Whatâs the best way let people know that they will need to append [âfmtâ] to their existing code to get the formatted value? Itâs in the updated readme under usage, do you think thatâs enough?
Thanks for your feedback and contribution. I think for now it's fine like that, if many people open an issue because of that, we can always add a big warning in the README. I just released version 0.5.0 of the gem which includes all the newest changes.
Thanks for building this gem.
As you are no doubt aware the current version API is broken (https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL), and the fix is committed but not released (using v6 instead of v7 in api path).