Skip to main content

FillModel

Trait FillModel 

Source
pub trait FillModel {
    // Required methods
    fn is_limit_filled(&mut self) -> bool;
    fn is_slipped(&mut self) -> bool;
    fn get_orderbook_for_fill_simulation(
        &mut self,
        instrument: &InstrumentAny,
        order: &OrderAny,
        best_bid: Price,
        best_ask: Price,
    ) -> Option<OrderBook>;

    // Provided method
    fn fill_limit_inside_spread(&self) -> bool { ... }
}

Required Methods§

Source

fn is_limit_filled(&mut self) -> bool

Returns true if a limit order should be filled based on the model.

Source

fn is_slipped(&mut self) -> bool

Returns true if an order fill should slip by one tick.

Source

fn get_orderbook_for_fill_simulation( &mut self, instrument: &InstrumentAny, order: &OrderAny, best_bid: Price, best_ask: Price, ) -> Option<OrderBook>

Returns a simulated OrderBook for fill simulation.

Custom fill models provide their own liquidity simulation by returning an OrderBook that represents expected market liquidity. The matching engine uses this to determine fills.

Returns None to use the matching engine’s standard fill logic.

Provided Methods§

Source

fn fill_limit_inside_spread(&self) -> bool

Returns whether limit orders at or inside the spread are fillable.

When true, the matching core treats a limit order as fillable if its price is at or better than the current best quote on its own side (BUY >= bid, SELL <= ask), not just when it crosses the spread.

Implementors§