Skip to content
adasThePrime edited this page Apr 11, 2026 · 1 revision

Pyahoo Documentation

A full-featured Python wrapper for Yahoo Finance APIs with synchronous and asynchronous clients, real-time WebSocket streaming, rich type hints, dataclasses, enums.

Python 3.10+ License: MIT

Tip

Use the Sidebar on the right (or at the bottom on mobile) for quick, hierarchical navigation across all clients, methods, models, enums, and types!

Warning

These APIs are unofficial and undocumented. Yahoo may throttle, block, or change them at any time without notice. Use at your own risk and respect Yahoo's terms of service.

Highlights

  • Dual Clients - Synchronous and asynchronous clients with identical API surfaces.
  • Real-Time Streaming - WebSocket clients for live market data.
  • Strongly Typed - Comprehensive type hints for improved code reliability and developer experience.
  • Rich Models - Almost all models feature pretty string representation, and collection models support len(), iter(), and truthiness checks bool().
  • Bound Methods - Chain API calls directly from model instances.
  • Enums - Type-safe enumerations for various API parameters and return values.
  • Proxy Support - Built-in proxy support for both REST and WebSocket clients.

Quick Start

Get quotes and historical data

from pyahoo import YahooFinance

with YahooFinance() as yf:
    quotes = yf.quote("AAPL", "NVDA", "MSFT")
    for q in quotes:
        print(q) # "Apple Inc. (AAPL) $255.63 +0.73% [PRE]"

    # Historical chart data
    chart = yf.chart("AAPL", range="1mo", interval="1d")
    print(chart)  # "ChartResult(AAPL 22 bars, 0 divs, 0 splits)"
    for bar in charts: # ChartResult is iterable
        print(bar)

Real-time streaming

from pyahoo import WebSocket

with WebSocket() as ws:
    ws.subscribe("AAPL", "NVDA", "MSFT")

    for tick in ws:
        print(tick)

Clone this wiki locally