pub struct SharedSimdOrderBook<const N: usize = 64>(/* private fields */);Expand description
Thread-safe shared SIMD order book with read/write methods
Provides the same interface as SharedOrderBook but with SIMD-optimized
order book operations for better performance in HFT applications.
Implementations§
Sourcepub fn new(order_book: SimdOrderBook<N>) -> Self
pub fn new(order_book: SimdOrderBook<N>) -> Self
Create a new shared SIMD order book
Sourcepub fn from_orderbook<const M: usize>(order_book: &OrderBook<M>) -> Self
pub fn from_orderbook<const M: usize>(order_book: &OrderBook<M>) -> Self
Create from a regular OrderBook
Create from a SharedOrderBook by converting the inner OrderBook
Sourcepub fn read<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&SimdOrderBook<N>) -> R,
pub fn read<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&SimdOrderBook<N>) -> R,
Read the order book using closure-based API
§Panics
Panics if the internal RwLock is poisoned (due to a panic in another thread)
Sourcepub fn write<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&mut SimdOrderBook<N>) -> R,
pub fn write<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&mut SimdOrderBook<N>) -> R,
Write to the order book using closure-based API
§Panics
Panics if the internal RwLock is poisoned (due to a panic in another thread)
Sourcepub fn exchange_timestamp_ns(&self) -> u64
pub fn exchange_timestamp_ns(&self) -> u64
Get the exchange timestamp
Sourcepub fn system_timestamp_ns(&self) -> u64
pub fn system_timestamp_ns(&self) -> u64
Get the system timestamp
Sourcepub fn side_vwap(&self, is_bid: bool, target_volume: f64) -> Option<f64>
pub fn side_vwap(&self, is_bid: bool, target_volume: f64) -> Option<f64>
Calculate VWAP for a given side and target volume
Sourcepub fn total_bid_volume(&self) -> f64
pub fn total_bid_volume(&self) -> f64
Get total bid volume using SIMD
Sourcepub fn total_ask_volume(&self) -> f64
pub fn total_ask_volume(&self) -> f64
Get total ask volume using SIMD
Sourcepub fn update_from_orderbook<const M: usize>(&self, book: &OrderBook<M>)
pub fn update_from_orderbook<const M: usize>(&self, book: &OrderBook<M>)
Update the order book from a regular OrderBook
This is useful for maintaining compatibility with existing feeder systems
Trait Implementations§
Source§fn clone(&self) -> SharedSimdOrderBook<N>
fn clone(&self) -> SharedSimdOrderBook<N>
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more