-
Notifications
You must be signed in to change notification settings - Fork 0
WebSocket
adasThePrime edited this page Apr 11, 2026
·
1 revision
Synchronous WebSocket client for real-time Yahoo Finance price streaming. Incoming data is Protocol Buffer (protobuf) encoded and base64-wrapped, Pyahoo decodes it automatically into PricingData objects for easy consumption.
from pyahoo import WebSocket
# or
from pyahoo.websocket import WebSocketWebSocket(
*,
url: str = STREAMER_URL,
version: int = STREAMER_VERSION,
reconnect: bool = True,
reconnect_base: float = STREAMER_RECONNECT_BASE,
reconnect_max: float = STREAMER_RECONNECT_MAX,
max_reconnect_attempts: int | None = None,
proxy: str | None = None,
queue_size: int = 10_000
)-
url (
str, optional): WebSocket URL, by default"wss://streamer.finance.yahoo.com/". -
version (
int, optional): API version parameter, by default2. -
reconnect (
bool, optional): Whether to auto-reconnect on disconnection, by defaultTrue. -
reconnect_base (
float, optional): Base delay for exponential backoff (seconds), by default1.0. -
reconnect_max (
float, optional): Maximum reconnect delay (seconds), by default60.0. -
max_reconnect_attempts (
int, optional): Maximum reconnection attempts, orNonefor unlimited. -
proxy (
str, optional): Proxy URL. -
queue_size (
int, optional): Maximum number of ticks buffered for iteration, by default10_000.