-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Getting 429 error (rate-limit) when in loop, suggestion to add try-catch if fails #2125
Comments
Im running into this issue also for the same reason, would love a fix. |
same reason |
yfinance sends cookie-crumb with requests so Yahoo could track you despite VPN hopping (which is against their terms btw). Do less spam? https://github.com/ValueRaider/yfinance-cache |
I've been using this library for a while without an issue, I noticed just 2 days ago that me too I I get flagged for too many requests and the server blocks me, It's not about spamming the server, my strategy as an active trader requires that I iterate over a thousand or two thousand symbols throughout the day so I really don't know what to do except for try to look for an alternative source, I'm not sure why they decided to do this now because before it used to be working 100% fine, could it be temporary? Is there a workaround? |
@ValueRaider I'm not spamming just because I'm requesting data on a daily basis. The yfinance-cache fork does not contain the same amount of endpoints as the main yfinance libray so that's not a viable solution. It also does not work with my meltano tap here: https://github.com/melgazar9/tap-yfinance due to referencing a cached file. This issue and can be resolved by passing a User-agent to the requests header. Is this something that can be implemented? I'm not sure if this library is using the requests library to get the data? If so you can just pass a header and problem solved :) |
So im not losing my mind i had just noticed it a couple days as well, thought i broke my code some how. I sure most of the info can be got at nasdaq if you can figure out their weird naming scheme for the datasets. |
Hitting the 429 error less than 100 tickers in, and also started past day or two. Seems like yahoo has some new rule? |
Adding this while loop right after the call to Ticker() seemed to get me limping along. |
YF should already be setting the user-agent https://github.com/ranaroussi/yfinance/blob/main/yfinance/data.py#L59-L60 Does a 1-second rate limiter help?
yfinance PIP downloads are up last 2 weeks, maybe getting too popular? https://pypistats.org/packages/yfinance |
I had this problem until yesterday, does anyone have a solution? I transfer cash at any cost. Thank you. |
Yes, seems so, I was able to fetch info for 320 tickers using small code changes:
@nike576 there is a Patreon link on the repo's main page: https://patreon.com/ranaroussi |
Yeah i'm having some issues and concerns over the possible rate limiting on their end. Im doing a less than 100 tickers daily data retrieval and yet im not able to retrieve any data (or only a 1 or 2 times per day trial basis) |
Just to clarify, it doesn't happen for all endpoints |
|
Hey @daymiani the issue is not particularly an issue for me on a regular basis when downloading price history. I notice it's primarily happening for other methods in the library like income_stmt, insider_roster_holders, or upgrades_downgrades |
I seem to be facing a similar issue and the error I get is example: however, my use case requires me to fetch a batch of end-of-day data per day for 1000+ symbols but now, it seems to download the first few symbols and then returns the number of successful symbols varies on each try any suggestions? |
In some users works, in others not as me even if yesterday worked, today wasnt the case. I decided to change to EODHD, if someone wants to have the yfinance experience can try the follow engine https://github.com/Gerard9199/EODHD_API (the main API Class in the EODHD github is some confuse) |
Im wondering if the randomness of this is because all of us are hitting their server trying to do the same thing. |
@bwzheng2010 Redistributing Yahoo's data is against their terms of use. |
Having problems when "Too many requests" are made. |
Here is my suggestion to make it more clear when being rate limited #2180 |
Describe bug
When running a loop over multiple tickers, yahoo flags me even when using a VPN and switching servers multiple times per day. I found that there are many yahoo data sources where this happens, and I'll be happy to go through all of them and share them here if this is approved to be implemented.
Simple code that reproduces your problem
It's a bit tricky to reproduce this error because you would have to run numerous requests over a period of time in order for yahoo to flag you. However, if it returns 429 error we can fix it with the following code block:
example where it fails for me
Debug log
Bad data proof
No response
yfinance
version0.2.38
Python version
3.10.12
Operating system
using both linux and MacOS
The text was updated successfully, but these errors were encountered: