streaming_hpc
Subject
Section titled “Subject”Scaling, HPC and Infrastructure
Why This Module Exists
Section titled “Why This Module Exists”Streaming decisions are turnaround-time constrained; this module maintains VPIN/HHI-style indicators incrementally and supports multi-stream scaling across cores/chunk sizes.
Mathematical Foundations
Section titled “Mathematical Foundations”VPIN (Rolling Buckets)
Section titled “VPIN (Rolling Buckets)”
Market Fragmentation HHI
Section titled “Market Fragmentation HHI”
Streaming Throughput
Section titled “Streaming Throughput”
Usage Examples
Section titled “Usage Examples”Incremental early-warning pipeline on streaming trades
Section titled “Incremental early-warning pipeline on streaming trades”use openquant::hpc_parallel::{ExecutionMode, HpcParallelConfig, PartitionStrategy};use openquant::streaming_hpc::{ run_streaming_pipeline_parallel, AlertThresholds, HhiConfig, StreamingPipelineConfig, SyntheticStreamConfig, VpinConfig, generate_synthetic_flash_crash_stream,};
let streams: Vec<_> = (0..16) .map(|k| generate_synthetic_flash_crash_stream(SyntheticStreamConfig { events: 2_000, crash_start_fraction: 0.7, calm_venues: 8, shock_venue: k % 2, })) .collect::<Result<Vec<_>, _>>()?;
let report = run_streaming_pipeline_parallel( &streams, StreamingPipelineConfig { vpin: VpinConfig { bucket_volume: 1_000.0, support_buckets: 20 }, hhi: HhiConfig { lookback_events: 200 }, thresholds: AlertThresholds { vpin: 0.45, hhi: 0.30 }, }, HpcParallelConfig { mode: ExecutionMode::Threaded { num_threads: 8 }, partition: PartitionStrategy::Linear, mp_batches: 4, progress_every: 8, },)?;
println!("streams={} molecules={} events/s={:.0}", report.stream_summaries.len(), report.parallel_metrics.molecules_total, report.parallel_metrics.throughput_atoms_per_sec);API Reference
Section titled “API Reference”Rust API
Section titled “Rust API”StreamEventVpinStateHhiStateStreamingEarlyWarningEnginerun_streaming_pipelinerun_streaming_pipeline_parallelgenerate_synthetic_flash_crash_streamStreamingPipelineConfigStreamingRunMetrics
Implementation Notes
Section titled “Implementation Notes”- Chapter 22 stresses turnaround-time over pure throughput: bounded rolling windows avoid unbounded latency/memory growth.
- For low-latency alerts, keep stream partitioning stable and calibrate
mp_batchesagainst scheduling overhead and cache locality. - Use synthetic flash-crash replays to validate that warning thresholds react early without excessive false positives.