Struct barter_data::subscription::book::OrderBook
source · pub struct OrderBook {
pub last_update_time: DateTime<Utc>,
pub bids: OrderBookSide,
pub asks: OrderBookSide,
}Expand description
Normalised Barter OrderBook snapshot.
Fields§
§last_update_time: DateTime<Utc>§bids: OrderBookSide§asks: OrderBookSideImplementations§
source§impl OrderBook
impl OrderBook
sourcepub fn snapshot(&mut self) -> Self
pub fn snapshot(&mut self) -> Self
Generate an OrderBook snapshot by cloning Self after sorting each OrderBookSide.
sourcepub fn mid_price(&self) -> Option<f64>
pub fn mid_price(&self) -> Option<f64>
Calculate the mid price by taking the average of the best bid and ask prices.
See Docs: https://www.quantstart.com/articles/high-frequency-trading-ii-limit-order-book
sourcepub fn volume_weighed_mid_price(&self) -> Option<f64>
pub fn volume_weighed_mid_price(&self) -> Option<f64>
Calculate the volume weighted mid price (micro-price), weighing the best bid and ask prices with their associated amount.
See Docs: https://www.quantstart.com/articles/high-frequency-trading-ii-limit-order-book
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
source§impl From<BinanceOrderBookL2Snapshot> for OrderBook
impl From<BinanceOrderBookL2Snapshot> for OrderBook
source§fn from(snapshot: BinanceOrderBookL2Snapshot) -> Self
fn from(snapshot: BinanceOrderBookL2Snapshot) -> Self
Converts to this type from the input type.
source§impl Ord for OrderBook
impl Ord for OrderBook
source§impl PartialEq<OrderBook> for OrderBook
impl PartialEq<OrderBook> for OrderBook
source§impl PartialOrd<OrderBook> for OrderBook
impl PartialOrd<OrderBook> for OrderBook
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Eq for OrderBook
impl StructuralEq for OrderBook
impl StructuralPartialEq for OrderBook
Auto Trait Implementations§
impl RefUnwindSafe for OrderBook
impl Send for OrderBook
impl Sync for OrderBook
impl Unpin for OrderBook
impl UnwindSafe for OrderBook
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.