Module streaming

Module streaming 

Source
Expand description

Real-time price streaming from Yahoo Finance WebSocket

This module provides a Stream-based API for receiving real-time price updates, similar to Kotlin Flow or Rx observables.

§Overview

Yahoo Finance provides a WebSocket endpoint that streams real-time price data in protobuf format. This module handles:

  • WebSocket connection and reconnection
  • Protobuf message decoding
  • Subscription management with automatic heartbeats
  • A clean Stream API for consuming updates

§Example

use finance_query::streaming::PriceStream;
use futures::StreamExt;

// Subscribe to symbols
let mut stream = PriceStream::subscribe(&["AAPL", "NVDA", "TSLA"]).await?;

// Process updates as they arrive
while let Some(price) = stream.next().await {
    println!("{}: ${:.2} ({:+.2}%)",
        price.id,
        price.price,
        price.change_percent
    );
}

Structs§

PriceStream
A streaming price subscription that yields real-time price updates.
PriceStreamBuilder
Builder for creating price streams with custom configuration
PriceUpdate
Real-time price update from Yahoo Finance WebSocket.

Enums§

MarketHoursType
Market hours type enumeration
OptionType
Option type enumeration
QuoteType
Quote type enumeration
StreamError
Errors that can occur during streaming

Type Aliases§

StreamResult
Result type for streaming operations