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

YFinance changed their api's (or their security) #25

Open
TobiasFP opened this issue Feb 23, 2023 · 32 comments
Open

YFinance changed their api's (or their security) #25

TobiasFP opened this issue Feb 23, 2023 · 32 comments

Comments

@TobiasFP
Copy link

Hi.
There seams to be an issue with the finance-go, since yFinance changed its encryption keys.
Apparantly they change their encryption keys every day or even sometimes more than once a day.
This has lead to finance-go not working for a while.
yFinance has the same issue:
ranaroussi/yfinance#1407

I just wanted to bring it to your attention. I have been very happy with this library, so thank you very much for your work.

@ktpx
Copy link

ktpx commented May 5, 2023

v6 of the API seems to work, not 7.

@md-dev-lab
Copy link

@ktpx You saved me! :)

@ktpx
Copy link

ktpx commented May 24, 2023

I think they pulled the plug on v6 now. :(

@joce
Copy link
Contributor

joce commented May 25, 2023

All projects I see using the Yahoo API are facing this. There is this nugget I got from the ticker issue report on the subject:

https://stackoverflow.com/questions/76065035/yahoo-finance-v7-api-now-requiring-cookies-python

Not sure how/if that helps...

@TiagoNH
Copy link

TiagoNH commented May 26, 2023

Saw somewhere that for instance, an url like this:
https://query2.finance.yahoo.com/v6/finance/quoteSummary/AAPL?modules=financialData
is working, but I'm not sure if the data structures are the same.
Is someone working on a patch?

@joce
Copy link
Contributor

joce commented May 26, 2023

achannarasappa/ticker#250 (comment)
Looks like we're out of luck. 😢

@ktpx
Copy link

ktpx commented May 28, 2023

Saw somewhere that for instance, an url like this: https://query2.finance.yahoo.com/v6/finance/quoteSummary/AAPL?modules=financialData is working, but I'm not sure if the data structures are the same. Is someone working on a patch?

Totally different structure than the quotes. This show financial data. But atleast one can grab the currentprices.

@LandRover
Copy link

Crumb is a param that is easy to gain, not sure how it will behave in long term.

For now, it is possible to generate crumb via https://query2.finance.yahoo.com/v1/test/getcrumb and then pass crumb value as param https://query2.finance.yahoo.com/v7/finance/quote?symbols=AAPL&crumb=abcdef.g. (Works with v7 only)

I have had the same crumb for a few days now, so it's possible to cache it locally on disk to avoid this call.

@ktpx
Copy link

ktpx commented Jun 6, 2023

If you inspect the cookie header, it says one year. "Expires=Wed, 5 Jun 2024 22:54:09 GMT"

@rosimildo
Copy link

Hi there, is there any workaround I could use to test ? This is broken for a while.

@joce
Copy link
Contributor

joce commented Jun 29, 2023

So I have a fix for this and I have opened a PR for it. Not sure who should be reviewing it.
I also have "modernized" the finance-mock project used to test finance-go. PR can be found here: piquette/finance-mock#1

@TobiasFP
Copy link
Author

I would love to review it, but i don't think we can get it in as i think the project is dead here. Maybe fork?

@joce
Copy link
Contributor

joce commented Jun 29, 2023

Is it, though? There were a couple of PR that were merged a month ago by @ackleymi .

@TobiasFP
Copy link
Author

My bad. Just add me to the pr if you want

@joce
Copy link
Contributor

joce commented Jun 29, 2023

Doesn't look like I can add you, but feel free to head over the the PR and comment on it: #28

@TobiasFP
Copy link
Author

Doesn't look like I can add you, but feel free to head over the the PR and comment on it: #28

Done. Good job!

@ktpx
Copy link

ktpx commented Jul 20, 2023

Did they add some kind of rate limit? I don't get a crumb anymore, just "Too many requests".

@joce
Copy link
Contributor

joce commented Jul 20, 2023 via email

@ktpx
Copy link

ktpx commented Jul 20, 2023

I don't have access to a machine with the library on it atm. I'll check about this later today.

On Thu, Jul 20, 2023 at 3:32 PM ktpx @.> wrote: Did they add some kind of rate limit? I don't get a crumb anymore, just "Too many requests". — Reply to this email directly, view it on GitHub <#25 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATT2NOHUSYZVJRSGVCHALXRGBTHANCNFSM6AAAAAAVGDRPD4 . You are receiving this because you commented.Message ID: @.>

Not a software issue really, API.

curl  https://query2.finance.yahoo.com/v1/test/getcrumb
Too Many Requests

Thats atleast the URL i used in my progs

@joce
Copy link
Contributor

joce commented Jul 21, 2023 via email

@ktpx
Copy link

ktpx commented Jul 21, 2023

I do set cookie in the code, curl was bad example. But I still get same error. It worked, and literary didnt work half hour later, no code changed, so gotta be something yahoo changed.

@joce
Copy link
Contributor

joce commented Jul 21, 2023 via email

@ktpx
Copy link

ktpx commented Jul 21, 2023

Which site do you query to get the cookie? Seems might be the problem. Ive used fc.yahoo.com, as its the only one that worked for me. For regular api calls, query2.

@joce
Copy link
Contributor

joce commented Jul 21, 2023 via email

@ktpx
Copy link

ktpx commented Jul 21, 2023

Ok using login subdomain again got me the cookie, but still no crum. Mind showing your crumb URL.....? I didnt find it in the source

@joce
Copy link
Contributor

joce commented Jul 21, 2023

I will refer you to my pull request:

#28

You should be able to get everything you need there.

@ktpx
Copy link

ktpx commented Jul 21, 2023

Thanks, its same url. Im guessing they are doing some IP based limiting, or blocking, im just getting the too many requests from here (EU).

@joce
Copy link
Contributor

joce commented Jul 21, 2023

Have you sync'd my branch and run the examples program?

@ktpx
Copy link

ktpx commented Jul 21, 2023

Ok, confirmed is a location issue. So ill assume people using this tool wil also have
problem if aren't in US.

@TiagoNH
Copy link

TiagoNH commented Aug 8, 2023

So, that means this solution is only working if the request is made in the US?

@ktpx
Copy link

ktpx commented Aug 8, 2023

So, that means this solution is only working if the request is made in the US?

For the quotes API, it seems so yes. But I can't speak for other countries. But ive tried in 3 different EU countries, and no dice. It worked for a while, but no more.

@cbruno10
Copy link

Hi @ackleymi , I saw that #28 was merged in, but there's no new tag or release with this change. Are there any plans to formally release this change? Thanks!

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

No branches or pull requests

8 participants