Order Book
The order_book module in market_model provides infrastructure for
generating synthetic limit order book data.
Current status
The module exists with traits and placeholder implementations, but full L1/L2/L3 generation is not yet implemented. The planned architecture is described below.
Planned architecture
Three composable layers:
graph LR
P[PriceProcess] --> OBS[OrderBookSimulator]
OF[OrderFlowProcess] --> OBS
OB[OrderBook depth] --> OBS
OBS --> Runner[SimulationRunner]
OrderBookSimulator implements Simulatable with Output = BookSnapshot,
which contains the full book state at each simulation step.
PriceProcess
The true mid-price driver. Any existing Simulatable process (GBM,
Heston, etc.) serves as the price process.
OrderFlowProcess
Generates limit orders, market orders, and cancellations each step. Planned implementations:
- Poisson: constant arrival rates.
- Bilateral Hawkes: self-exciting intensities for bid and ask sides.
- NoFlow: no arrivals, just BBO at mid +/- half-spread.
OrderBook depth
Controls the fidelity of the generated book:
| Level | State | Matching |
|---|---|---|
| L1 | Best bid, best ask, size | Instant fill at BBO |
| L2 | Aggregate volume per tick | Market orders sweep levels |
| L3 | FIFO queue per tick | Price-time priority |
What is currently available
OrderFlowProcesstrait andNoFlowimplementation.OrderBookstruct stub.- The module structure is in place for future implementation.