opendeviationbar-streaming
Real-time streaming engine for open deviation bar construction over Binance WebSocket feeds, with bounded memory, circuit breaker pattern, and checkpoint recovery.
Installation
From crates.io
[]
= "12"
From git (latest)
[]
= { = "https://github.com/terrylica/opendeviationbar-py", = "crates/opendeviationbar-streaming" }
With Binance WebSocket integration
[]
= { = "12", = ["binance-integration"] }
Quick Start
Stream Processing
use StreamingProcessor;
use StreamExt;
// Create processor: 250 dbps = 0.25% threshold
let mut processor = new?;
// Process an async trade stream
let metrics = processor.process_stream.await?;
println!;
Live Bar Engine (multiplexed WebSocket)
use LiveBarEngine;
// Process multiple symbols × thresholds concurrently
let engine = new;
engine.start;
loop
Custom Configuration
use ;
let config = StreamingProcessorConfig ;
let mut processor = with_config?;
Features
| Feature | Default | Description |
|---|---|---|
binance-integration |
No | Binance WebSocket stream support |
stats |
No | Rolling statistics (rolling-stats, tdigests) |
indicators |
No | Technical indicators |
all |
No | Enable all features |
Architecture
Binance WS → LiveBarEngine (tokio, multiplexed)
│
├─ OpenDeviationBarProcessor (per symbol × threshold)
│ └─ process_single_trade() → Option<CompletedBar>
│
└─ next_bar() → completed bars to consumer
- Bounded memory: Configurable buffer size prevents exhaustion
- Circuit breaker: Fault tolerance with automatic error threshold detection
- Graceful shutdown:
engine.stop()+engine.collect_checkpoints()for recovery
MSRV
Minimum supported Rust version: 1.90
License
MIT