[][src]Struct cxmr_orderbook::OrderBook

pub struct OrderBook {
    pub last_update: u64,
    // some fields omitted
}

Exchange Order book.

Fields

last_update: u64

Timestamp of last update.

Methods

impl OrderBook[src]

pub fn asks(&self) -> &OrderBookSide<u64>[src]

Returns ask side of the orderbook.

pub fn bids(&self) -> &OrderBookSide<ReverseRate>[src]

Returns bid side of the orderbook.

pub fn spread(&self) -> Option<f64>[src]

Calculates bid-ask spread percentage relational to bid rate.

pub fn spread_nth(&self, n: usize) -> Option<f64>[src]

Calculates bid-ask spread percentage relational to bid rate.

pub fn update<'a, I>(&mut self, events: I) where
    I: Iterator<Item = &'a Event>, 
[src]

Updates orderbook from events reference.

pub fn consume(&mut self, ev: Events) -> Result<Events, Error>[src]

Consumes events to update orderbook. Returns events with orderbook events flattened.

pub fn consume_events(&mut self, events: Vec<Event>) -> Vec<Event>[src]

Consumes events to update orderbook. Returns events with orderbook events flattened.

pub fn consume_event(&mut self, event: Event) -> Vec<Event>[src]

Consumes event to update orderbook. Returns events with orderbook events flattened.

pub fn update_from_event(&mut self, event: &Event)[src]

Updates orderbook from a single event.

pub fn update_from_rows(&mut self, events: &[EventData])[src]

Updates orderbook from data rows.

pub fn update_from_row(&mut self, event: &EventData)[src]

Updates orderbook from a single event.

Trait Implementations

impl Clone for OrderBook[src]

impl Debug for OrderBook[src]

impl Default for OrderBook[src]

impl<'de> Deserialize<'de> for OrderBook[src]

impl<'_> From<&'_ OrderBook> for OrderBook[src]

impl<'_> From<&'_ OrderBook> for Vec<EventData>[src]

impl<'_> From<&'_ OrderBook> for Event[src]

impl<'a> From<&'a [EventData]> for OrderBook[src]

impl PartialEq<OrderBook> for OrderBook[src]

impl Serialize for OrderBook[src]

impl StructuralPartialEq for OrderBook[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.