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 Intermittently working #1111

Closed
locfinessemonster opened this issue Oct 24, 2022 · 20 comments
Closed

Yfinance Intermittently working #1111

locfinessemonster opened this issue Oct 24, 2022 · 20 comments

Comments

@locfinessemonster
Copy link

I have used yfinance for a while using a very old mac and haven't had any problems. I recently upgraded my computer to Windows 11 and am trying to run basic yfinance functions like yf.download in jupyter notebook on a chrome browser and I keep gettting the error message "No data found for this date range, symbol may be delisted" as well as error 10060. I have tried downgrading to older library versions and using the "pip install yfinance --upgrade --no-cache-dir" recommended fix but I am still getting this problem. The workaround I came up with is to keep retrying the yf.download and sleeping for a couple seconds if it fails. It seems to eventually download after around 10 tries or so but this doesn't seem to be the most elegant solution. I have tried changing my firewall settings and it doesn't seem like my computer is blocking anything. I am pretty stumped, if you have any suggestions I would really appreciate it!

@locfinessemonster
Copy link
Author

Code with errors that I am seeing:
image
image

@locfinessemonster
Copy link
Author

Work around code:
image

@locfinessemonster
Copy link
Author

locfinessemonster commented Oct 24, 2022

Longer sleep interval between requests seems to help me get it with less requests, still a mystery as to why I consistently can't get it on the first try.
image

@ValueRaider
Copy link
Collaborator

Did you try 0.1.74 or older?

@jordangrodecki
Copy link

Also had this bug after building a new venv - spent ages before dropping back to 0.1.74 which works fine.

@ValueRaider
Copy link
Collaborator

ValueRaider commented Oct 24, 2022

We think we know why (related to #1076) and plan a release very soon.

@locfinessemonster
Copy link
Author

Also had this bug after building a new venv - spent ages before dropping back to 0.1.74 which works fine.

I tried pip install yfinance==0.1.7.4 and still got the same issue.
Tried yfinance==0.1.67 and got the same error

@locfinessemonster
Copy link
Author

We think we know why (related to #1076) and plan a release very soon.

Awesome, thank you for the update.

@ValueRaider
Copy link
Collaborator

Also had this bug after building a new venv - spent ages before dropping back to 0.1.74 which works fine.

I tried pip install yfinance==0.1.7.4 and still got the same issue. Tried yfinance==0.1.67 and got the same error

Oh, if you have same problem with 0.1.74 or older then no, that needs investigation. What version was on your Mac?

@locfinessemonster
Copy link
Author

Also had this bug after building a new venv - spent ages before dropping back to 0.1.74 which works fine.

I tried pip install yfinance==0.1.7.4 and still got the same issue. Tried yfinance==0.1.67 and got the same error

Oh, if you have same problem with 0.1.74 or older then no, that needs investigation. What version was on your Mac?

I was using version 0.1.74 on my Mac and never ran into many issues.
I tried running a Beautiful Soup Scraper on my Windows 11 machine, and I got error #10060 from that as well and that code never had any problems either on my old Mac. I wonder if I somehow got blacklisted by yfinance? I don't think I really ever sent too many requests yfinance though which seems odd.
image

@ValueRaider
Copy link
Collaborator

Any blacklisting is very temporary, so rolling back to 0.1.74 should have eventually restored normal behaviour.

For 0.1.75 and later, a release went out yesterday that should resolve problem.

@locfinessemonster
Copy link
Author

Built both the yf v0.1.83 and v0.1.84 from the tar.gz files released yesterday and still having same issues unfortunately.

@ValueRaider
Copy link
Collaborator

ValueRaider commented Oct 27, 2022

Ok thanks for feedback on 0.1.84, but did rolling back to 0.1.74 solve?

Does the for w in range loop with sleep removed always encounter your error? If yes, how many iterations?

What is the actual loop you are trying to run?

What happens if you run in command line shell instead of Jupyter?

@locfinessemonster
Copy link
Author

locfinessemonster commented Oct 30, 2022

Did rolling back to 0.1.74 solve?
No, still getting same errors with 0.1.74
Does the for w in range loop with sleep removed always encounter your error? If yes. how many iterations?
Yes, it pretty typically does, the standard range of iterations pretty typically seems to be between 2 and 10
image
What is the actual loop you are trying to run?
The actual loop I am trying to run is trying to collect minutely price movement data for a list of stocks generally around 75 stocks long and export to csv.
image
What happens if you run in command line shell instead of Jupyter?
Running from command line using a virtual environment with yfinance==0.1.74 installed still gives me the same errors I have been seeing
image

@ValueRaider
Copy link
Collaborator

ValueRaider commented Oct 30, 2022

Curious that this only started with Windows, but the typical cause of these errors is spamming Yahoo with 100s requests/day - are you? If only running 1-2 times/day then unlikely to be Yahoo, which implies a Windows problem.

The solution to rate limiting is stop spamming Yahoo for data you could cache locally. Caching solutions:

@locfinessemonster
Copy link
Author

locfinessemonster commented Nov 1, 2022

Since this code has not been working properly, I haven't been running it at all outside of trying to debug yfinance. It's definitely a bit odd, I was thinking it was maybe my internet or firewall or something but I have some similar code that requests data from the WeBull API and it has been running without any problems.

I gave requests_cache a shot and still no luck.
image

I gave yfinance_cache a shot as well still getting an error
image

Do you think rolling back my os to Windows 10 could potentially fix the issues I am having?

@ValueRaider
Copy link
Collaborator

That last error looks like a Windows networking issue. Maybe start with Googling 10060 error code

@locfinessemonster
Copy link
Author

I had some old tor code that I used to set a proxy on yf.download and now it seems as if everything is consistently working.
image

@ValueRaider
Copy link
Collaborator

ValueRaider commented Nov 2, 2022

If you don't mind, I'll tag this issue as "Windows" and close. I know Tor isn't ideal but I don't see what yfinance can do.

@locfinessemonster
Copy link
Author

That sounds good, thanks for your help!

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

3 participants