pub struct OrderBook {
pub symbol: Symbol,
pub bids: Vec<OrderBookLevel>,
pub asks: Vec<OrderBookLevel>,
pub timestamp: DateTime<Utc>,
pub exchange_checksum: Option<u32>,
pub local_checksum: Option<u32>,
}Expand description
Snapshot of the order book depth.
Fields§
§symbol: Symbol§bids: Vec<OrderBookLevel>§asks: Vec<OrderBookLevel>§timestamp: DateTime<Utc>§exchange_checksum: Option<u32>§local_checksum: Option<u32>Implementations§
Source§impl OrderBook
impl OrderBook
Sourcepub fn best_bid(&self) -> Option<&OrderBookLevel>
pub fn best_bid(&self) -> Option<&OrderBookLevel>
Returns the best bid if available.
Sourcepub fn best_ask(&self) -> Option<&OrderBookLevel>
pub fn best_ask(&self) -> Option<&OrderBookLevel>
Returns the best ask if available.
Sourcepub fn imbalance(&self, depth: usize) -> Option<Decimal>
pub fn imbalance(&self, depth: usize) -> Option<Decimal>
Calculates bid/ask imbalance for the top depth levels.
Sourcepub fn computed_checksum(&self, depth: Option<usize>) -> u32
pub fn computed_checksum(&self, depth: Option<usize>) -> u32
Compute a checksum for the current order book using up to depth levels (or full depth when None).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for OrderBook
impl<'de> Deserialize<'de> for OrderBook
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
impl StructuralPartialEq for OrderBook
Auto Trait Implementations§
impl Freeze for OrderBook
impl RefUnwindSafe for OrderBook
impl Send for OrderBook
impl Sync for OrderBook
impl Unpin for OrderBook
impl UnwindSafe for OrderBook
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