finance-query 3.0.0

A Rust library for querying financial data
Documentation
//! 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
//!
//! ```no_run
//! use finance_query::streaming::PriceStream;
//! use futures::StreamExt;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // 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
//!     );
//! }
//! # Ok(())
//! # }
//! ```

mod alerts;
mod batch;
#[cfg(feature = "polygon")]
mod book;
mod client;
#[cfg(feature = "fred")]
mod economic;
mod handle;
mod news;
#[cfg(feature = "polygon")]
mod options;
#[cfg(feature = "polygon")]
mod polygon;
mod pricing;
mod source;
mod subscription;
#[cfg(feature = "polygon")]
mod trades;
mod yahoo;

pub use alerts::{
    AlertCondition, AlertConditionKind, AlertEvaluator, AlertEvent, AlertExt, AlertRule,
    AlertStream,
};
pub use batch::{Batched, StreamBatchExt};
#[cfg(feature = "polygon")]
pub use book::{BookLevel, DepthStream, DepthStreamBuilder, OrderBookUpdate};
pub use client::{PriceSource, PriceStream, PriceStreamBuilder, StreamError, StreamResult};
#[cfg(feature = "fred")]
pub use economic::{EconomicStream, EconomicStreamBuilder, SeriesUpdate};
pub use news::{NewsStream, NewsStreamBuilder};
#[cfg(feature = "polygon")]
pub use options::{Greeks, OptionContractUpdate, OptionsChainStream, OptionsChainStreamBuilder};
#[cfg(feature = "polygon")]
pub use polygon::AssetClass;
pub use pricing::{MarketHoursType, OptionType, PriceUpdate, QuoteType};
#[cfg(feature = "polygon")]
pub use trades::{TradeStream, TradeStreamBuilder, TradeTick};