[][src]Struct trade::order_book::OrderBook

pub struct OrderBook { /* fields omitted */ }

An order book. Internally uses two BTreeMap, one for the bid side and another one for the ask side.

Methods

impl OrderBook
[src]

Return an empty OrderBook.

Return best bid price. If the bid side is empty, return 0.

Complexity

O(1).

Return best ask price. If the ask side is empty, return TickUnit::max_value().

Complexity

O(1).

Update the given limit with the given updated size.

Complexity

O(log(n)) where n is the number of limits at the given side.

Retrieve the size at the given limit.

Complexity

O(log(n)) where n is the number of limits at the given side.

Iterator over the limits at bid, sorted by descending key.

Iterator over the limits at ask, sorted by ascending key.

Return an iterator over the set of limit updates to apply to self in order to be equal to other.

Complexity

O(n + m) where n is self's length and m is other's length.

Example

for u in order_book1.diff(&order_book2) {
    order_book1.update(u);
}
assert_eq!(order_book1, order_book2);

Trait Implementations

impl Default for OrderBook
[src]

Returns the "default value" for a type. Read more

impl PartialEq<OrderBook> for OrderBook
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Clone for OrderBook
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for OrderBook
[src]

impl Debug for OrderBook
[src]

Formats the value using the given formatter. Read more

impl Display for OrderBook
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for OrderBook

impl Sync for OrderBook

Blanket Implementations

impl<T> IntoTimestamped for T
[src]

Add the current timestamp to self.

Add the given timestamp to self.

impl<T> IntoWithSymbol for T
[src]

Add the given symbol to a borrowed &self.

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

Performs the conversion.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

Converts the given value to a String. Read more

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

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> From for T
[src]

Performs the conversion.

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

Immutably borrows from an owned value. Read more

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

Mutably borrows from an owned value. Read more

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<Q, K> Equivalent for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

Compare self to key and return true if they are equal.

impl<T> Erased for T

impl<T> Erased for T