Expand description
Real-time price streaming with pluggable provider backends.
This module provides a Stream-based API for receiving real-time price updates, similar to Kotlin Flow or Rx observables.
§Overview
A StreamSource trait abstracts the provider-specific
transport and wire protocol. Yahoo (YahooStreamSource)
is the reference implementation, with additional providers (e.g. Polygon)
supported through the same abstraction.
This module handles:
- Provider-agnostic reconnection logic
- Subscription management with automatic heartbeats
- Protobuf message decoding (Yahoo)
- 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§
- News
Stream - A continuous subscription to one or more RSS/Atom sources.
- News
Stream Builder - Builder for creating a
NewsStreamwith custom configuration. - Price
Stream - A streaming price subscription that yields real-time price updates.
- Price
Stream Builder - Builder for creating price streams with custom configuration
- Price
Update - Real-time price update from Yahoo Finance WebSocket.
Enums§
- Market
Hours Type - Market hours type enumeration
- Option
Type - Option type enumeration
- Quote
Type - Quote type enumeration
- Stream
Error - Errors that can occur during streaming
Type Aliases§
- Stream
Result - Result type for streaming operations