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§
- Alert
Evaluator - Evaluates
AlertRules against a price feed, tracking the per-symbol history that crossing conditions need. - Alert
Event - A fired alert, carrying the tick that triggered it.
- Alert
Rule - A symbol paired with the condition that should trigger an alert.
- Alert
Stream - A
Stream<Item = AlertEvent>over any price stream. - Batched
- A stream that yields
Vec<T>batches collected over a time window. - Book
Level - One price level of an order book.
- Depth
Stream - A subscription to level-2 order-book depth.
- Depth
Stream Builder - Builder for a
DepthStream. - Economic
Stream - A continuous subscription to economic-series releases.
- Economic
Stream Builder - Builder for an
EconomicStreamwith a custom poll interval. - Greeks
- Option greeks for a contract.
- News
Stream - A continuous subscription to one or more RSS/Atom sources.
- News
Stream Builder - Builder for creating a
NewsStreamwith custom configuration. - Option
Contract Update - A live update for one options contract.
- Options
Chain Stream - A live subscription to one or more options chains.
- Options
Chain Stream Builder - Builder for an
OptionsChainStream. - Order
Book Update - A depth-of-book update: both sides, best level first.
- 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.
- Series
Update - A newly published (or revised) observation for an economic series.
- Trade
Stream - A subscription to every trade print for the given symbols.
- Trade
Stream Builder - Builder for a
TradeStream. - Trade
Tick - A single executed trade.
Enums§
- Alert
Condition - A predicate over incoming price ticks.
- Alert
Condition Kind - Which predicate an
AlertConditionapplies, without its threshold. - Asset
Class - Asset class of a Polygon real-time cluster.
- Market
Hours Type - Market hours type enumeration
- Option
Type - Option type enumeration
- Price
Source - Which upstream backend a
PriceStreamconnects to. - Quote
Type - Quote type enumeration
- Stream
Error - Errors that can occur during streaming
Traits§
- Alert
Ext - Adds
alertsto every price stream. - Stream
Batch Ext - Adds
batchedto everyStream.
Type Aliases§
- Stream
Result - Result type for streaming operations