Skip to main content

Orderbook

Trait Orderbook 

Source
pub trait Orderbook {
    // Required methods
    fn insert_order(&mut self, order_id: u128, order: Order);
    fn remove_order(&mut self, order_id: u128);
    fn reduce_order_size(&mut self, order_id: u128, size_to_sub: u64);
}
Expand description

General interface to help apply orderbook-related events to a database.

The methods here don’t have to be used as an interface for other applications, they’re only defined for conveniently calling event.apply(&mut database) on whatever the database type is.

Required Methods§

Source

fn insert_order(&mut self, order_id: u128, order: Order)

To use with OrderbookPostReceipt event.

Source

fn remove_order(&mut self, order_id: u128)

To use with CanceledOrder or FilledMakerOrder in which maker order was fully filled.

Source

fn reduce_order_size(&mut self, order_id: u128, size_to_sub: u64)

To use with FilledMakerOrder in which maker order was not fully filled.

Implementors§