hftbacktest::depth

Trait L2MarketDepth

Source
pub trait L2MarketDepth {
    // Required methods
    fn update_bid_depth(
        &mut self,
        price: f64,
        qty: f64,
        timestamp: i64,
    ) -> (i64, i64, i64, f64, f64, i64);
    fn update_ask_depth(
        &mut self,
        price: f64,
        qty: f64,
        timestamp: i64,
    ) -> (i64, i64, i64, f64, f64, i64);
    fn clear_depth(&mut self, side: Side, clear_upto_price: f64);
}
Expand description

Provides Level2-specific market depth functions.

Required Methods§

Source

fn update_bid_depth( &mut self, price: f64, qty: f64, timestamp: i64, ) -> (i64, i64, i64, f64, f64, i64)

Updates the bid-side market depth and returns a tuple containing (the price in ticks, the previous best bid price in ticks, the current best bid price in ticks, the previous quantity at the price, the current quantity at the price, and the timestamp).

If there is no market depth and thus no best bid, INVALID_MIN is assigned to the price in ticks of the tuple returned.

Source

fn update_ask_depth( &mut self, price: f64, qty: f64, timestamp: i64, ) -> (i64, i64, i64, f64, f64, i64)

Updates the ask-side market depth and returns a tuple containing (the price in ticks, the previous best bid price in ticks, the current best bid price in ticks, the previous quantity at the price, the current quantity at the price, and the timestamp).

If there is no market depth and thus no best ask, INVALID_MAX is assigned to the price in ticks of the tuple returned.

Source

fn clear_depth(&mut self, side: Side, clear_upto_price: f64)

Clears the market depth. If the side is Side::None, both sides are cleared. In this case, clear_upto_price is ignored.

Implementors§