Skip to main content

Module fill_simulator

Module fill_simulator 

Source
Expand description

Fill simulator: Shared logic for simulating order fills.

Used by both MockExchange (for test assertions) and PaperExchange (for paper trading).

§Performance Optimization

Uses sorted VecDeques (by price) for O(1) front removal when filling orders. This reduces complexity from O(quotes × orders) to O(quotes × fillable_orders). For grid strategies with 100 levels, this provides ~10-15x speedup.

Structs§

FillSimulator
Simulates order fills based on quote price crossing.
PendingOrder
A pending order waiting to be filled
SimulatedFill
Result of a simulated fill