Expand description
§fin-stream
Lock-free streaming primitives for real-time financial market data.
§Architecture
Tick Source
|
v
SPSC Ring Buffer (lock-free, zero-allocation hot path)
|
v
OHLCV Aggregator (streaming bar construction at any timeframe)
|
v
MinMax Normalizer (rolling-window coordinate normalization)
|
+---> Lorentz Transform (spacetime boost for feature engineering)
|
v
Downstream (ML model, trade signal engine, order management)§Performance
The SPSC ring buffer sustains 100 K+ ticks/second with no heap allocation
on the fast path. All error paths return Result<_, StreamError> — the
library never panics on the hot path. Construction functions validate their
arguments and panic on misuse with a clear message (e.g. ring capacity of 0,
normalizer window size of 0).
§Modules
| Module | Responsibility |
|---|---|
book | Order book delta streaming and crossed-book detection |
error | Typed error hierarchy (StreamError) |
health | Feed staleness detection and circuit-breaker |
lorentz | Lorentz spacetime transforms for time-series features |
norm | Rolling min-max coordinate normalization |
ohlcv | OHLCV bar aggregation at arbitrary timeframes |
ring | SPSC lock-free ring buffer |
session | Market session and trading-hours classification |
tick | Raw-to-normalized tick conversion for all exchanges |
ws | WebSocket connection management and reconnect policy |
Re-exports§
pub use book::BookDelta;pub use book::BookSide;pub use book::OrderBook;pub use book::PriceLevel;pub use error::StreamError;pub use health::FeedHealth;pub use health::HealthMonitor;pub use health::HealthStatus;pub use lorentz::LorentzTransform;pub use lorentz::SpacetimePoint;pub use norm::MinMaxNormalizer;pub use norm::ZScoreNormalizer;pub use ohlcv::OhlcvAggregator;pub use ohlcv::OhlcvBar;pub use ohlcv::Timeframe;pub use ring::SpscConsumer;pub use ring::SpscProducer;pub use ring::SpscRing;pub use session::MarketSession;pub use session::SessionAwareness;pub use session::TradingStatus;pub use tick::Exchange;pub use tick::NormalizedTick;pub use tick::RawTick;pub use tick::TickNormalizer;pub use ws::ConnectionConfig;pub use ws::ReconnectPolicy;pub use ws::WsManager;
Modules§
- book
- Order book — delta streaming with full reconstruction.
- error
- Typed error hierarchy for fin-stream.
- health
- Feed health monitoring — staleness detection and status tracking.
- lorentz
- Lorentz (special-relativistic) transforms applied to financial time series.
- norm
- Rolling-window coordinate normalization for financial time series.
- ohlcv
- Real-time tick-to-OHLCV aggregation at arbitrary timeframes.
- ring
- Lock-free single-producer / single-consumer (SPSC) ring buffer.
- session
- Market session awareness — trading hours, holidays, status transitions.
- tick
- Tick normalization — raw exchange messages → canonical NormalizedTick.
- ws
- WebSocket connection management — auto-reconnect and backpressure.