yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

Requests to yahoo finance take way too long to be responded via `yfinance`, while sending the same request via postman is responded instantly

Open ahnazary opened this issue 1 year ago • 0 comments

Describe bug

Getting financial data sometimes takes way too longThe source of issue lies in this line. The session.get (...)uses IPv6 which some times does not work, while IPv4 works. (also discussed in this answer)

Simple code that reproduces your problem

Executing this piece of code a couple of times(or requesting any other financial data) even without surpassing yahoo finance's API constraint, will cause the next calls to yahoo finance really slow.

import yfinance as yf

ticker = yf.Ticker("AAPL")

ticker.quarterly_financials

Debug log

No bug logs, just takes too long to response.

Bad data proof

No response

yfinance version

yfinance==0.2.37

Python version

Python 3.11.4

Operating system

MacOS

ahnazary avatar Mar 06 '24 18:03 ahnazary