fin_stream/lib.rs
1// SPDX-License-Identifier: MIT
2#![deny(missing_docs)]
3//! # fin-stream
4//!
5//! Lock-free streaming primitives for real-time financial market data.
6//!
7//! ## Architecture
8//!
9//! ```text
10//! Tick Source
11//! |
12//! v
13//! SPSC Ring Buffer (lock-free, zero-allocation hot path)
14//! |
15//! v
16//! OHLCV Aggregator (streaming bar construction at any timeframe)
17//! |
18//! v
19//! MinMax Normalizer (rolling-window coordinate normalization)
20//! |
21//! +---> Lorentz Transform (spacetime boost for feature engineering)
22//! |
23//! v
24//! Downstream (ML model, trade signal engine, order management)
25//! ```
26//!
27//! ## Performance
28//!
29//! The SPSC ring buffer sustains 100 K+ ticks/second with no heap allocation
30//! on the fast path. All error paths return `Result<_, StreamError>` -- the
31//! library never panics in release builds.
32//!
33//! ## Modules
34//!
35//! | Module | Responsibility |
36//! |--------|----------------|
37//! [`book`] | Order book delta streaming and crossed-book detection |
38//! [`error`] | Typed error hierarchy (`StreamError`) |
39//! [`health`] | Feed staleness detection and circuit-breaker |
40//! [`lorentz`] | Lorentz spacetime transforms for time-series features |
41//! [`norm`] | Rolling min-max coordinate normalization |
42//! [`ohlcv`] | OHLCV bar aggregation at arbitrary timeframes |
43//! [`ring`] | SPSC lock-free ring buffer |
44//! [`session`] | Market session and trading-hours classification |
45//! [`tick`] | Raw-to-normalized tick conversion for all exchanges |
46//! [`ws`] | WebSocket connection management and reconnect policy |
47
48#[path = "book/mod.rs"]
49pub mod book;
50pub mod error;
51#[path = "health/mod.rs"]
52pub mod health;
53#[path = "lorentz/mod.rs"]
54pub mod lorentz;
55#[path = "norm/mod.rs"]
56pub mod norm;
57#[path = "ohlcv/mod.rs"]
58pub mod ohlcv;
59#[path = "ring/mod.rs"]
60pub mod ring;
61#[path = "session/mod.rs"]
62pub mod session;
63#[path = "tick/mod.rs"]
64pub mod tick;
65#[path = "ws/mod.rs"]
66pub mod ws;
67
68pub use book::{BookDelta, BookSide, OrderBook, PriceLevel};
69pub use error::StreamError;
70pub use health::{FeedHealth, HealthMonitor, HealthStatus};
71pub use lorentz::{LorentzTransform, SpacetimePoint};
72pub use norm::MinMaxNormalizer;
73pub use ohlcv::{OhlcvAggregator, OhlcvBar, Timeframe};
74pub use ring::{SpscConsumer, SpscProducer, SpscRing};
75pub use session::{MarketSession, SessionAwareness, TradingStatus};
76pub use tick::{Exchange, NormalizedTick, RawTick, TickNormalizer};
77pub use ws::{ConnectionConfig, ReconnectPolicy, WsManager};