pub struct OrderBookEvent {
pub exchange: Exchange,
pub symbol: Symbol,
pub timestamp: i64,
pub sequence: u64,
pub is_snapshot: bool,
pub bids: Vec<PriceLevel>,
pub asks: Vec<PriceLevel>,
}Expand description
Order book snapshot or delta update
Fields§
§exchange: ExchangeExchange that produced this order book
symbol: SymbolTrading pair symbol
timestamp: i64Event timestamp (Unix microseconds)
sequence: u64Sequence number for ordering updates
is_snapshot: boolWhether this is a snapshot (true) or delta (false)
bids: Vec<PriceLevel>Bid levels (price, quantity)
asks: Vec<PriceLevel>Ask levels (price, quantity)
Implementations§
Source§impl OrderBookEvent
impl OrderBookEvent
Sourcepub fn best_bid(&self) -> Option<&PriceLevel>
pub fn best_bid(&self) -> Option<&PriceLevel>
Get the best bid price
Sourcepub fn best_ask(&self) -> Option<&PriceLevel>
pub fn best_ask(&self) -> Option<&PriceLevel>
Get the best ask price
Sourcepub fn spread_bps(&self) -> Option<Decimal>
pub fn spread_bps(&self) -> Option<Decimal>
Calculate the spread in basis points
Trait Implementations§
Source§impl Clone for OrderBookEvent
impl Clone for OrderBookEvent
Source§fn clone(&self) -> OrderBookEvent
fn clone(&self) -> OrderBookEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OrderBookEvent
impl Debug for OrderBookEvent
Source§impl<'de> Deserialize<'de> for OrderBookEvent
impl<'de> Deserialize<'de> for OrderBookEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for OrderBookEvent
impl RefUnwindSafe for OrderBookEvent
impl Send for OrderBookEvent
impl Sync for OrderBookEvent
impl Unpin for OrderBookEvent
impl UnsafeUnpin for OrderBookEvent
impl UnwindSafe for OrderBookEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more