     [Blog](https://scrapfly.io/blog)   /  [api](https://scrapfly.io/blog/tag/api)   /  [Yahoo Finance API: How to Get Yahoo Finance Data in Python (2026)](https://scrapfly.io/blog/posts/guide-to-yahoo-finance-api)   # Yahoo Finance API: How to Get Yahoo Finance Data in Python (2026)

 by [Ziad Shamndy](https://scrapfly.io/blog/author/ziad) Jul 17, 2026 14 min read [\#api](https://scrapfly.io/blog/tag/api) [\#data-parsing](https://scrapfly.io/blog/tag/data-parsing) [\#hidden-api](https://scrapfly.io/blog/tag/hidden-api) [\#python](https://scrapfly.io/blog/tag/python) [\#scrapeguide](https://scrapfly.io/blog/tag/scrapeguide) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fguide-to-yahoo-finance-api "Share on LinkedIn") [  ](https://x.com/intent/tweet?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fguide-to-yahoo-finance-api&text=Yahoo%20Finance%20API%3A%20How%20to%20Get%20Yahoo%20Finance%20Data%20in%20Python%20%282026%29 "Share on X") [  ](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fguide-to-yahoo-finance-api "Share on Facebook")    

 

 

Summarize this article with

 [  ](https://chat.openai.com/?q=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fguide-to-yahoo-finance-api) [  ](https://claude.ai/new?q=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fguide-to-yahoo-finance-api) [  ](https://x.com/i/grok?text=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fguide-to-yahoo-finance-api) [  ](https://www.perplexity.ai/search/new?q=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fguide-to-yahoo-finance-api) [  ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fguide-to-yahoo-finance-api) 



      

If you have ever searched for a Yahoo Finance API, you already know the punchline. There isn't one. Yahoo retired its official finance API years ago, so there is no key to request and no endpoint to sign up for.

Python developers reach for the [yfinance](https://pypi.org/project/yfinance/) library instead, on the same unofficial endpoints the Yahoo site uses. This guide covers it first, then the chart endpoint, scraping for the rest, and surviving Yahoo's throttling.

[What is HTTP Error 429 Too Many Request and How to Fix itHTTP 429 is an infamous response code that indicates request throttling or distribution is needed. Let's take a look at how to handle it.](https://scrapfly.io/blog/posts/what-is-http-error-429-too-many-requests)



## Key Takeaways

- **No official API**: Yahoo shut its public finance API down in 2017, so there is no key.
- **yfinance is the go-to library**: free quotes, history, fundamentals, and options.
- **Direct chart endpoint**: raw price history from Yahoo's JSON, with no extra dependency.
- **Scrape for page-only data**: requests and BeautifulSoup grab what the library misses.
- **Expect throttling**: unofficial endpoints rate-limit and break under load at scale.
- **Scrapfly for scale**: rotate proxies and bypass anti-bot when Yahoo starts blocking.

**Get web scraping tips in your inbox**Trusted by 100K+ developers and 30K+ enterprises. Unsubscribe anytime.







## Is There a Yahoo Finance API in 2026?

No, Yahoo does not offer an official public finance API. It shut the old one down on May 15, 2017, and never replaced it, so there is no signup, no key, and no supported contract.

What people call the "Yahoo Finance API" today is two things. The first is the `yfinance` library. The second is the set of unofficial JSON endpoints behind the site. Modern tools, `yfinance` included, hit those same endpoints.

That distinction matters. There is no key to protect and no rate plan to buy, but there is also no stability guarantee. Yahoo can change an endpoint or its page markup whenever it wants, and your code breaks with it.

For most Python work the practical answer is the `yfinance` section below. For a real-time API on your own scraper, see our guide on [turning web scrapers into data APIs](https://scrapfly.io/blog/posts/how-to-turn-web-scrapers-into-data-apis). It uses FastAPI to serve scraped data.



## What Is Yahoo Finance Data Used For?

Yahoo Finance data feeds a wide range of finance and research work, from backtesting a strategy to tracking a portfolio. Here is where it shows up most:

- **Financial modeling and forecasting**: historical prices and financials feed trend and performance models.
- **Investment research**: investors compare companies, evaluate growth, and shape a strategy.
- **Portfolio management**: managers rebalance, diversify, and react to market moves.
- **Economic analysis**: analysts read market cycles, inflation, and broad economic health.
- **Sentiment and trend analysis**: real-time news and quotes track short-term moves.
- **Risk assessment**: volatility and other metrics flag and limit downside.

Pulling this data with code turns a manual check into a repeatable pipeline. The rest of this guide shows how to get it.



## How to Use the yfinance Library in Python

`yfinance` is the closest thing to a Yahoo Finance API, and it is what most Python developers use. It wraps Yahoo's unofficial endpoints in a clean interface, so you get quotes, history, fundamentals, and options with a few lines of code.

Install it with `pip`:

bash```bash
pip install yfinance
```



### Installing and Fetching Your First Ticker

Every symbol starts as a `Ticker` object. From there you read live quote fields straight off the object:

python```python
import yfinance as yf

apple = yf.Ticker("AAPL")

# fast_info holds the live quote fields
print("Price:", apple.fast_info["last_price"])
print("Market cap:", apple.fast_info["market_cap"])
# Output:
# Price: 315.32
# Market cap: 4631217307648
```



The `fast_info` view is quick because it skips the heavier metadata fetch. Use it when you only need the current price and a few core numbers.

### Historical Prices, Dividends, and Splits

Call `.history()` to pull a price series. The `period` argument accepts values like `1d`, `1mo`, `1y`, or `max`, and `interval` sets the candle size:

python```python
import yfinance as yf

nvda = yf.Ticker("NVDA")
hist = nvda.history(period="1y", interval="1d")

# hist is a pandas DataFrame indexed by date
print(hist[["Open", "Close", "Volume"]].tail(3))
# Output:
#                                  Open        Close     Volume
# Date
# 2026-07-08 00:00:00-04:00  195.20  195.55  148223000
# 2026-07-09 00:00:00-04:00  196.10  196.93  132904000
# 2026-07-10 00:00:00-04:00  203.80  204.12  201338000
```



By default `.history()` returns split-adjusted and dividend-adjusted prices. Pass `auto_adjust=False` when you want the raw close alongside an `Adj Close` column, which matters if you compute your own total-return series.

Dividends and splits come off the same object through `.dividends` and `.splits`, both returned as pandas Series indexed by date. The combined `.actions` DataFrame merges the two into one corporate-actions table.

### Fundamentals and Options Data

The `.info` dictionary carries company fundamentals, from sector to trailing P/E. Options live behind `.options` (expiry dates) and `.option_chain()`:

python```python
import yfinance as yf

apple = yf.Ticker("AAPL")

info = apple.info
print(info["sector"], "|", info["trailingPE"])

# list expiries, then pull one chain
expiry = apple.options[0]
chain = apple.option_chain(expiry)
print(chain.calls[["strike", "lastPrice"]].head(3))
```



To pull many symbols at once, `yf.download()` returns one combined DataFrame:

python```python
import yfinance as yf

data = yf.download(["AAPL", "MSFT"], period="5d", progress=False)
print(data["Close"].tail(2))
```



News works the same way. `apple.news` returns a list of recent articles with titles, publishers, and links, which saves you from scraping the news page directly.

### Known Limits of yfinance

`yfinance` is convenient, but it is not an official or supported API. Keep these failure modes in mind:

- It wraps unofficial endpoints that Yahoo can change without notice, which breaks the library until `yfinance` ships a fix.
- Heavy or parallel requests trigger rate limits, and you get `429` errors or empty responses.
- There is no service contract, so uptime and data accuracy carry no guarantee.

These limits are exactly why the direct endpoint and scraping paths below still matter, and why production pipelines add a hardening layer.



## Is the Yahoo Finance API Free, and What Are the Rate Limits?

Yes, `yfinance` is free, and there is no paid Yahoo tier to upgrade to. Because Yahoo runs no official API, there is nothing to price, so the library and the underlying endpoints cost nothing to call.

The catch is reliability. The endpoints behind `yfinance` are the same ones Yahoo's own site uses, and Yahoo throttles them to protect the service. Under load you see intermittent `429 Too Many Requests` responses, empty payloads, or short-lived blocks.

A few habits push the free path further. Batch symbols with `yf.download()` instead of looping one `Ticker` at a time, and space requests with a short `time.sleep()`.

Caching responses you have already fetched helps too. Wrapping each call in a retry with exponential backoff also smooths over the odd `429`.

Even so, the free path has a ceiling. It is fine for research notebooks and small jobs, where you pull a few hundred symbols and it holds. The trouble starts when a pipeline runs on a schedule or fans out across thousands of tickers.

At that point teams add proxies, retries with backoff, and anti-bot handling so a single throttle does not stall the whole run. The scraping and Scrapfly sections below cover that hardening.



Scrapfly

#### Extract structured data automatically?

Scrapfly's Extraction API uses AI to turn any webpage into structured data — no selectors needed.

[Try Free →](https://scrapfly.io/register)## Scraping Yahoo Finance Directly (When the Library Is Not Enough)

Scrape Yahoo Finance when you need something on the page that the library does not expose, or when you want full control over the request. The site renders most data server-side, so a plain HTTP request gets you real content.

You only need [requests](https://pypi.org/project/requests/) and [BeautifulSoup](https://pypi.org/project/beautifulsoup4/) to start:

bash```bash
pip install requests beautifulsoup4
```



One caution before the examples. Yahoo rotates its DOM often, so treat every selector below as a snapshot, not a permanent contract. If a scrape returns nothing, the markup changed and the selector needs a refresh. For deeper selector work, see our [intro to parsing HTML with lxml](https://scrapfly.io/blog/posts/intro-to-parsing-html-xml-python-lxml).

### Scraping Ticker and Market Data

A ticker page lives at a predictable URL like `https://finance.yahoo.com/quote/AAPL`. The quote page marks its main price with a stable `data-testid` attribute, which is more reliable than the streamer tags that also feed the index bar:

python```python
import requests
from bs4 import BeautifulSoup

ticker = "AAPL"
url = f"https://finance.yahoo.com/quote/{ticker}/"

response = requests.get(url, headers={"User-Agent": "Mozilla/5.0"})
soup = BeautifulSoup(response.text, "html.parser")

price = soup.select_one('[data-testid="qsp-price"]').get_text(strip=True)
print(f"{ticker} price: {price}")
# Output: AAPL price: 315.32
```



The markets page groups indices by region. Find the region heading, then walk the table that follows it. Note the `string=` argument, which replaced the deprecated `text=` in current BeautifulSoup:

python```python
import requests
from bs4 import BeautifulSoup

url = "https://finance.yahoo.com/markets/"
response = requests.get(url, headers={"User-Agent": "Mozilla/5.0"})
soup = BeautifulSoup(response.text, "html.parser")

def extract_indices(region_title):
    region_data = {}
    heading = soup.find("h3", string=region_title)
    if heading:
        table = heading.find_next("table")
        for row in table.find_all("tr")[1:]:
            cols = row.find_all("td")
            if len(cols) >= 3:
                symbol = cols[0].get_text(strip=True)
                price = cols[1].get_text(strip=True)
                region_data[symbol] = price
    return region_data

for symbol, price in extract_indices("Americas").items():
    print(f"{symbol}: {price}")
```



Values shift every session, so the printed numbers are illustrative. What stays stable is the pattern, a region heading followed by a table of index rows.

### Pulling Price History From the Chart Endpoint

This is the technique library-only tutorials skip. Yahoo's front-end fetches price history from a hidden JSON endpoint, and you can call it directly with no extra dependency. It is a clean example of a [hidden API you scrape by watching network requests](https://scrapfly.io/blog/posts/how-to-scrape-hidden-apis).

python```python
import requests

ticker = "NVDA"
url = (
    f"https://query2.finance.yahoo.com/v8/finance/chart/{ticker}"
    "?range=1y&interval=1d"
)
response = requests.get(url, headers={"User-Agent": "Mozilla/5.0"})
data = response.json()

result = data["chart"]["result"][0]
timestamps = result["timestamp"]
closes = result["indicators"]["quote"][0]["close"]

for ts, price in list(zip(timestamps, closes))[:3]:
    print(f"Timestamp: {ts}, Close: {price}")
# Output:
# Timestamp: 1783344600, Close: 195.5500030517578
# Timestamp: 1783431000, Close: 196.9299926757812
# Timestamp: 1783517400, Close: 204.1199951171875
```



The `range` and `interval` parameters accept the same values as the library. Swap `range=1y` for `period1` and `period2` UNIX timestamps when you need an exact window.

### Scraping Stock News

Yahoo now renders the news feed with JavaScript, so a plain `requests` call returns an empty page. The clean fix is `yfinance`, which reads the same news endpoint the site uses:

python```python
import yfinance as yf

nvda = yf.Ticker("NVDA")
for article in nvda.news[:3]:
    content = article["content"]
    title = content["title"]
    publisher = content.get("provider", {}).get("displayName")
    print(f"{title} | {publisher}")
```



If you need the rendered news page itself rather than the feed data, you have to run a real browser so the JavaScript executes. That browser step is where the next section comes in.



## Scraping Yahoo Finance Reliably With Scrapfly

When `yfinance` or a raw scraper starts getting throttled or blocked, a fetch layer that rotates proxies and bypasses anti-bot keeps the pipeline alive. It also runs a real browser, so JavaScript-rendered pages like the news feed load fully.



ScrapFly's [Web Scraping API](https://scrapfly.io/web-scraping-api) is a single HTTP endpoint for collecting web data at scale, with a **99.99% success rate** across **130M+ proxies in 190+ countries**.

- [Anti-Scraping Protection bypass](https://scrapfly.io/docs/scrape-api/anti-scraping-protection) - automatically defeats Cloudflare, DataDome, PerimeterX, Akamai, and 90+ other bot systems.
- [Smart proxy rotation](https://scrapfly.io/docs/scrape-api/proxy) - residential and datacenter pools with country and ASN level geo-targeting.
- [JavaScript rendering](https://scrapfly.io/docs/scrape-api/javascript-rendering) - render SPAs and dynamic pages through real cloud browsers.
- [Browser automation scenarios](https://scrapfly.io/docs/scrape-api/javascript-scenario) - scroll, click, fill forms, and wait for elements without managing a browser fleet.
- [Format conversion](https://scrapfly.io/docs/scrape-api/getting-started#api_param_format) - return pages as HTML, JSON, clean text, or LLM ready Markdown.
- [Session management](https://scrapfly.io/docs/scrape-api/session) - keep cookies, headers, and IPs consistent across multi step flows.
- [Smart caching](https://scrapfly.io/docs/scrape-api/getting-started#api_param_cache) - cache successful responses to cut cost on repeat scraping jobs.
- [Python](https://scrapfly.io/docs/sdk/python), [TypeScript](https://scrapfly.io/docs/sdk/typescript), [Scrapy](https://scrapfly.io/docs/sdk/scrapy), and [no-code integrations](https://scrapfly.io/docs/integration/getting-started) including [Make](https://scrapfly.io/integration/make), [n8n](https://scrapfly.io/integration/n8n), [Zapier](https://scrapfly.io/integration/zapier), [LangChain](https://scrapfly.io/integration/langchain), and [LlamaIndex](https://scrapfly.io/integration/llamaindex).

Swapping a raw request for the SDK keeps your parsing logic and adds the anti-block layer:

python```python
from scrapfly import ScrapflyClient, ScrapeConfig

client = ScrapflyClient(key="YOUR_SCRAPFLY_KEY")

def scrape_yahoo_quote(symbol):
    result = client.scrape(ScrapeConfig(
        url=f"https://finance.yahoo.com/quote/{symbol}/",
        asp=True,          # bypass anti-bot protection
        render_js=True,    # run a real headless browser
        country="US",      # choose the proxy country
        cache=True,        # cache successful responses
    ))
    sel = result.selector
    return {
        "symbol": symbol,
        "price": sel.css('[data-testid="qsp-price"]::text').get(),
    }

print(scrape_yahoo_quote("AAPL"))
```





### Power your scraping with Scrapfly

Forget about getting blocked. Scrapfly handles anti-bot bypasses, browser rendering, and proxy rotation so you can focus on the data.



[Try for FREE!](https://scrapfly.io/register)



## Yahoo Finance API Alternatives

If `yfinance` and scraping are not enough, several data providers cover the same need with a real, supported API. The table below frames them as data sources, not a ranked contest, so you can pick by fit.

| Source | Best for | Free tier | Access method |
|---|---|---|---|
| yfinance (via Yahoo) | Python convenience for historical and current data | Free | Python library |
| Alpha Vantage | Daily data and technical indicators | Free tier (keyed) | REST API key |
| Twelve Data | Real-time stocks and forex time series | Free tier (keyed) | REST API key |
| Polygon.io | Clean real-time and historical market data | Limited free tier | REST API key |
| Finnhub | Quotes, news, and fundamentals | Free tier (keyed) | REST API / WebSocket |
| Tiingo | End-of-day data and fundamentals | Free for personal use | REST API key |
| Nasdaq Data Link | Fundamentals, macro, alternative datasets | Free and paid datasets | REST API key |

Match the source to the job. Use `yfinance` for free Python convenience, a keyed provider when you need a contract and uptime, and scraping when the data only lives on the page.

For a similar walkthrough on another source, see the [Google Finance guide](https://scrapfly.io/blog/posts/guide-to-google-finance-api). Free tiers change often, so confirm the current limits on each provider's site before you commit.



## FAQ

Does Yahoo Finance have a free API?No official API exists. The free `yfinance` library is the practical answer, but it relies on unofficial endpoints that can rate-limit or break without notice.







Is yfinance still free and working in 2026?Yes, `yfinance` is free and actively maintained. It wraps unofficial Yahoo endpoints, so expect occasional breakage and throttling under heavy load.







Do I need an API key for Yahoo Finance?No. There is no official API and no key. Both `yfinance` and direct scraping work without one.







How does Yahoo Finance compare to Google Finance for data scraping?Yahoo Finance offers deeper historical data and financial statements, while Google Finance leans toward real-time quotes with a simpler page structure. The full comparison lives in our Google Finance guide.









## Summary

There is no official Yahoo Finance API, and there has not been one since 2017. For Python work the `yfinance` library is the practical stand-in, covering quotes, history, fundamentals, options, and news through Yahoo's own unofficial endpoints.

When the library falls short, the direct chart endpoint gives you raw price history with no dependency. Requests-and-BeautifulSoup scraping pulls anything else on the page. Both lean on endpoints Yahoo throttles, so plan for occasional breakage.

At scale, a fetch layer that rotates proxies, runs real browsers, and bypasses anti-bot keeps a Yahoo pipeline alive. It holds up once the free path starts getting blocked.



Legal Disclaimer and PrecautionsThis tutorial covers popular web scraping techniques for education. Interacting with public servers requires diligence and respect:

- Do not scrape at rates that could damage the website.
- Do not scrape data that's not available publicly.
- Do not store PII of EU citizens protected by GDPR.
- Do not repurpose *entire* public datasets which can be illegal in some countries.

Scrapfly does not offer legal advice but these are good general rules to follow. For more you should consult a lawyer.

 

   [  Add as a preferred source ](https://google.com/preferences/source?q=scrapfly.io) Table of Contents















 

  Table of Contents- [Key Takeaways](#key-takeaways)
- [Is There a Yahoo Finance API in 2026?](#is-there-a-yahoo-finance-api-in-2026)
- [What Is Yahoo Finance Data Used For?](#what-is-yahoo-finance-data-used-for)
- [How to Use the yfinance Library in Python](#how-to-use-the-yfinance-library-in-python)
- [Installing and Fetching Your First Ticker](#installing-and-fetching-your-first-ticker)
- [Historical Prices, Dividends, and Splits](#historical-prices-dividends-and-splits)
- [Fundamentals and Options Data](#fundamentals-and-options-data)
- [Known Limits of yfinance](#known-limits-of-yfinance)
- [Is the Yahoo Finance API Free, and What Are the Rate Limits?](#is-the-yahoo-finance-api-free-and-what-are-the-rate-limits)
- [Scraping Yahoo Finance Directly (When the Library Is Not Enough)](#scraping-yahoo-finance-directly-when-the-library-is-not-enough)
- [Scraping Ticker and Market Data](#scraping-ticker-and-market-data)
- [Pulling Price History From the Chart Endpoint](#pulling-price-history-from-the-chart-endpoint)
- [Scraping Stock News](#scraping-stock-news)
- [Scraping Yahoo Finance Reliably With Scrapfly](#scraping-yahoo-finance-reliably-with-scrapfly)
- [Yahoo Finance API Alternatives](#yahoo-finance-api-alternatives)
- [FAQ](#faq)
- [Summary](#summary)
 
    Join the Newsletter  Get monthly web scraping insights 

 

  



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

 ## Related Articles

 [  

 http python 

### Web Scraping with Python

Introduction tutorial to web scraping with Python. How to collect and parse public data. Challenges, best practices and ...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-python) [     

 python data-parsing 

### How to Scrape an Entire Product Catalogue with Python

Learn how to discover, crawl, and extract every product from an e-commerce catalog in Python, then keep that data fresh ...

 

 ](https://scrapfly.io/blog/posts/how-to-scrape-large-product-catalogs) [  

 python 

### Everything to Know to Start Web Scraping in Python Today

Complete introduction to web scraping using Python: http, parsing, AI, scaling and deployment.

 

 ](https://scrapfly.io/blog/posts/everything-to-know-about-web-scraping-python) 

  ## Related Questions

- [ Q How to select dictionary key recursively in Python? ](https://scrapfly.io/blog/answers/how-to-select-dictionary-key-recursively-in-python)
 
  



   



 Extract structured data with AI, **1,000 free credits** [Start Free](https://scrapfly.io/register)