pub trait FillModel {
// Required methods
fn is_limit_filled(&mut self) -> Result<bool>;
fn is_slipped(&mut self) -> Result<bool>;
fn get_orderbook_for_fill_simulation(
&mut self,
instrument: &InstrumentAny,
order: &OrderAny,
best_bid: Price,
best_ask: Price,
) -> Result<Option<OrderBook>>;
// Provided method
fn fill_limit_inside_spread(&self) -> Result<bool> { ... }
}Required Methods§
Sourcefn is_limit_filled(&mut self) -> Result<bool>
fn is_limit_filled(&mut self) -> Result<bool>
Returns true if a limit order should be filled based on the model.
§Errors
Returns an error if the model cannot determine whether the order should fill.
Sourcefn is_slipped(&mut self) -> Result<bool>
fn is_slipped(&mut self) -> Result<bool>
Returns true if an order fill should slip by one tick.
§Errors
Returns an error if the model cannot determine whether the order should slip.
Sourcefn get_orderbook_for_fill_simulation(
&mut self,
instrument: &InstrumentAny,
order: &OrderAny,
best_bid: Price,
best_ask: Price,
) -> Result<Option<OrderBook>>
fn get_orderbook_for_fill_simulation( &mut self, instrument: &InstrumentAny, order: &OrderAny, best_bid: Price, best_ask: Price, ) -> Result<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.
§Errors
Returns an error if the model cannot provide simulated liquidity.
Provided Methods§
Sourcefn fill_limit_inside_spread(&self) -> Result<bool>
fn fill_limit_inside_spread(&self) -> Result<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.
§Errors
Returns an error if the model cannot determine its spread-fill behavior.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".