[][src]Struct lobster::OrderBook

pub struct OrderBook { /* fields omitted */ }

An order book that executes orders serially through the execute method.

Implementations

impl OrderBook[src]

pub fn new(
    arena_capacity: usize,
    queue_capacity: usize,
    track_stats: bool
) -> Self
[src]

Create an instance representing a single order book.

The arena_capacity parameter represents the number of orders that will be pre-allocated.

The queue_capacity parameter represents the capacity of each vector storing orders at the same price point.

The track_stats parameter indicates whether to enable volume and trades tracking (see last_trade and traded_volume).

pub fn min_ask(&self) -> Option<u64>[src]

Return the lowest ask price, if present.

pub fn max_bid(&self) -> Option<u64>[src]

Return the highest bid price, if present.

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

Return the difference of the lowest ask and highest bid, if both are present.

pub fn last_trade(&self) -> Option<Trade>[src]

Return the last trade recorded while stats tracking was active as a Trade object, if present.

pub fn traded_volume(&self) -> u64[src]

Return the total traded volume for all the trades that occurred while the stats tracking was active.

pub fn depth(&self, levels: usize) -> BookDepth[src]

Return the order book depth as a BookDepth struct, up to the specified level. Bids and offers at the same price level are merged in a single BookLevel struct.

pub fn track_stats(&mut self, track: bool)[src]

Toggle the stats tracking on or off, depending on the track parameter.

pub fn execute(&mut self, event: OrderType) -> OrderEvent[src]

Execute an order, returning immediately an event indicating the result.

Trait Implementations

impl Debug for OrderBook[src]

impl Default for OrderBook[src]

fn default() -> Self[src]

Create an instance representing a single order book, with stats tracking disabled, a default arena capacity of 10,000 and a default queue capacity of 10.

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> From<T> for T[src]

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

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.