Crawl: the most reliable web crawler APISee what’s new
Zenrows
Talk to sales Start free

Web scraping stock prices

Web scraping stock prices means collecting quotes, historical prices, fundamentals and headlines from finance portals like Yahoo Finance, Nasdaq and MarketWatch. Zenrows renders those pages, captures the JSON they load in the background or the fields you name with CSS selectors, and returns structured data for spreadsheets, dashboards and backtests.

Updated

Sample output: one stock quote
{
  "symbol": "EXMP",
  "exchange": "NASDAQ",
  "source_url": "https://finance.example.com/quote/EXMP",
  "price": 184.27,
  "change": -2.13,
  "change_pct": -1.14,
  "currency": "USD",
  "market_state": "closed",
  "quote_time": "2026-10-16T20:00:00Z",
  "captured_at": "2026-10-16T20:05:31Z",
  "open": 186.10,
  "day_range": [182.90, 187.45],
  "volume": 31842210,
  "market_cap": 412500000000,
  "pe_ratio_ttm": 27.4,
  "eps_ttm": 6.73,
  "dividend_yield": 0.0061,
  "fifty_two_week_range": [141.20, 199.80],
  "next_earnings_date": "2026-10-29"
}
Illustrative, fictional ticker. quote_time is the portal's time for the price; captured_at is when you read the page.

What stock data scraping covers

Portals spread one ticker across tabs (quote, history, statistics, news), each its own page with its own refresh rhythm.

JobData you collectTypical sources
End-of-day price capture Close, open, high, low, volume Yahoo Finance, Nasdaq, MarketWatch quote pages
Historical price tables Daily or weekly OHLC, adjusted close, splits, dividends Yahoo Finance and Nasdaq history tabs, Barchart
Fundamentals snapshots Market cap, P/E, EPS, yield, shares outstanding Statistics and financials tabs, Zacks, GuruFocus, Morningstar
Earnings and analyst calendars Report dates, consensus, rating changes Nasdaq earnings calendar, MarketWatch, Zacks
Ticker news and chatter Headlines, timestamps, tickers, message volume Yahoo Finance news, Seeking Alpha, StockTwits, Reddit
Non-US listings Local quotes, currency, exchange suffixes finanzen.net, BSE India, Google Finance

Why stock price scrapers break

It starts as a few lines of requests and BeautifulSoup, and breaks when the portal moves the price to a background call or challenges repeat visitors.

What it looks like

Layout but no price, or a placeholder dash

How Zenrows handles it

A full render with XHR capture returns the page plus the quote data

How to scrape stock prices with Zenrows

  1. List the tickers and pages: quote, history and statistics URLs from each portal's pattern.
  2. Capture the quote data: full render with network capture; keep the call carrying the price.
  3. Name fields where the HTML is enough: CSS selectors for statistics and calendars, with Adaptive Stealth Mode for access.
  4. Run the watchlist after the close in Batch, daily or at your dashboard's interval.
  5. Validate before storing against the previous day and a reference close.
# pip install requests
import json
import requests

params = {
    "apikey": "YOUR_ZENROWS_API_KEY",
    "url": QUOTE_URL,  # a portal's quote page for one ticker
    "js_render": "true",
    "premium_proxy": "true",
    "json_response": "true",
}
data = requests.get("https://api.zenrows.com/v1/", params=params).json()

# The page loads the price in a background call; keep the one that holds it
for call in data["xhr"]:
    if "quote" in call["url"] and call["status_code"] == 200:
        print(json.loads(call["body"]))

What success looks like

MeasureWhat good looks likeHow to check it
Price accuracy Closes match the official close Weekly reconcile of a random sample
Ticker coverage Every symbol, every trading day Missing symbol-date pairs per run
Timestamp hygiene Quote time and capture time on each record Reject empty or unexpectedly old quote times
Parse rate Clean numbers; "N/A" and dashes as nulls Type-check failures per portal
Run time Done well before the dashboard or backtest reads it Batch start and finish against ticker count

Web scraping stock prices FAQ

  • Yes. Yahoo Finance loads parts of its quote pages with JavaScript, so render them and capture the background calls, including the one carrying the quote. Zenrows' stealth keeps requests going across many tickers. The same works for Nasdaq.com, MarketWatch and most portals.

  • Public portal prices are widely used for personal research and internal analysis. Redistribution differs: exchange data is licensed and portal terms often restrict commercial reuse. Check each site's terms and licensing, and ask your legal team before publishing or reselling.

  • Open the ticker's history page with the date range in the URL and use Extract or the tables output filter for JSON rows. Backfill once, then append daily. Store splits and dividends, often in the same table, as separate events.

  • You set the interval: every few minutes intraday, daily for research. Many portals show delayed quotes and say so, so store the quote time. End-of-day after the close is the most common schedule.

  • Call the Zenrows API with requests, the quote URL and the parameters above, and read the JSON. Zenrows handles rendering, stealth and retries; your code builds URLs, parses fields and stores rows. Past a few hundred tickers, use Batch.

  • Use the symbol's news tab, on Yahoo Finance or MarketWatch for example. Fetch it as Markdown or name headline, source, link and time with CSS selectors; store each with ticker and capture time, deduplicated on article URL since stories repeat across portals.

  • Yes. Statistics, financials and earnings calendars are separate URLs per ticker. Use CSS selectors or Extract, and store dated snapshots: market cap and P/E change daily.

Turn the live web into usable data.