pub struct ObDeltaPoint {
pub ts_ms: i64,
pub bid_changes: Vec<(f64, f64)>,
pub ask_changes: Vec<(f64, f64)>,
}Expand description
Incremental order-book delta — variable depth.
A delta carries the levels whose size changed since the previous
frame. size == 0.0 means the level was removed; otherwise the level
was inserted (new price) or updated (existing price, new size). The
consumer composes a live book by applying deltas on top of a snapshot.
Depth is whatever the exchange sent — OrderbookDelta.bids/asks is a
full Vec from the connector, never truncated. The on-disk record is a
fixed 20-byte header (ts_ms + blob pointer) plus a companion .blob
file holding the variable-length level pairs, so no hard level cap leaks
into either the channel Event or persistence.
Blob layout (LE): u32 bid_count | bid_count * (f64 price, f64 size) u32 ask_count | ask_count * (f64 price, f64 size)
Fields§
§ts_ms: i64§bid_changes: Vec<(f64, f64)>Bid-side changes: (price, new_size). new_size == 0.0 ⇒ remove.
ask_changes: Vec<(f64, f64)>Ask-side changes: (price, new_size). new_size == 0.0 ⇒ remove.
Implementations§
Source§impl ObDeltaPoint
impl ObDeltaPoint
pub fn from_delta(d: &OrderbookDelta) -> Self
Trait Implementations§
Source§impl Clone for ObDeltaPoint
impl Clone for ObDeltaPoint
Source§fn clone(&self) -> ObDeltaPoint
fn clone(&self) -> ObDeltaPoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataPoint for ObDeltaPoint
impl DataPoint for ObDeltaPoint
Source§const RECORD_SIZE: usize = HEADER_SIZE
const RECORD_SIZE: usize = HEADER_SIZE
Source§fn encode(&self, out: &mut [u8])
fn encode(&self, out: &mut [u8])
self to a fixed-size buffer (little-endian). Read moreSource§fn decode(bytes: &[u8]) -> Option<Self>
fn decode(bytes: &[u8]) -> Option<Self>
Source§fn timestamp_ms(&self) -> i64
fn timestamp_ms(&self) -> i64
Source§fn from_stream_event(ev: &StreamEvent) -> Option<Self>
fn from_stream_event(ev: &StreamEvent) -> Option<Self>
Self from a raw WS StreamEvent. Returns None if the
event doesn’t carry data for this class.Source§fn encode_blob(&self) -> Option<Vec<u8>>
fn encode_blob(&self) -> Option<Vec<u8>>
.blob file. Read more