Files
yfinance-fork/README.md
T
Alessandro Colace 5d10c0c48e Make curl_cffi optional with graceful fallback to requests
Some platforms (e.g. older macOS, exotic Linux distros) cannot build the
curl-impersonate binary that backs curl_cffi, leaving yfinance unusable.
This change keeps curl_cffi as the preferred and default backend but no
longer hard-requires it at runtime.

- New `yfinance/_http.py` abstracts the HTTP backend. If `curl_cffi` is
  importable it is used as before; otherwise yfinance falls back to plain
  `requests` with a realistic Chrome User-Agent and logs a warning so the
  downgrade is explicit.
- `data.py`, `base.py`, `multi.py`, `scrapers/history.py` build sessions
  via `_http.new_session()`.
- Scrapers and screener catch `_http.HTTPError` instead of importing
  `curl_cffi.requests.exceptions.HTTPError` directly.
- `is_supported_session()` accepts either backend; `cookie_jar()` papers
  over the small API difference between curl_cffi (`cookies.jar`) and
  requests (`cookies` is itself the jar).
- New Advanced > Installation page documents the curl_cffi-free install
  recipe; README links to it just under the install instruction.

Empirically verified that plain `requests` with a Chrome UA does not hit
the 401-after-~10-requests issue that the earlier `curl_adapter` approach
ran into; 15/15 quoteSummary calls succeed without rate limiting.

`setup.py` is unchanged -- `curl_cffi>=0.15` remains the default install
requirement (CVE-pinned). The fallback only activates when the import
fails at runtime; moving curl_cffi to extras_require can be a follow-up
decision for the maintainer.
2026-05-20 14:17:02 +02:00

4.2 KiB

Download market data from Yahoo! Finance's API

Python version PyPi version PyPi status PyPi downloads Star this repo Follow me on twitter

ranaroussi%2Fyfinance | Trendshift

yfinance offers a Pythonic way to fetch financial & market data from Yahoo!Ⓡ finance.


Important

Yahoo!, Y!Finance, and Yahoo! finance are registered trademarks of Yahoo, Inc.

yfinance is not affiliated, endorsed, or vetted by Yahoo, Inc. It's an open-source tool that uses Yahoo's publicly available APIs, and is intended for research and educational purposes.

You should refer to Yahoo!'s terms of use (here, here, and here) **for details on your rights to use the actual data downloaded.

Remember - the Yahoo! finance API is intended for personal use only.**


Tip

THE NEW DOCUMENTATION WEBSITE IS NOW LIVE! 🤘

Visit ranaroussi.github.io/yfinance


Main components

  • Ticker: single ticker data
  • Tickers: multiple tickers' data
  • download: download market data for multiple tickers
  • Market: get information about a market
  • WebSocket and AsyncWebSocket: live streaming data
  • Search: quotes and news from search
  • Sector and Industry: sector and industry information
  • EquityQuery and Screener: build query to screen market

Installation

Install yfinance from PYPI using pip:

$ pip install yfinance

To install without curl_cffi for requests fallback, see Advanced ▸ Installation.

yfinance relies on the community to investigate bugs and contribute code. Here's how you can help.


Star History Chart


yfinance is distributed under the Apache Software License. See the LICENSE.txt file in the release for details.

AGAIN - yfinance is not affiliated, endorsed, or vetted by Yahoo, Inc. It's an open-source tool that uses Yahoo's publicly available APIs, and is intended for research and educational purposes. You should refer to Yahoo!'s terms of use (here, here, and here) for details on your rights to use the actual data downloaded.


P.S.

Please drop me a note with any feedback you have.

Ran Aroussi