Engine

StockMarketABM.Engine exposes a compact façade over the limit order book for consumers such as the matching engine or market simulation layers. Detailed discussion of the underlying data structures lives in docs/src/lob/orderbook.md; this article focuses on the thin wrapper that reuses that implementation. Rather than reimplementing logic, the module:

  • Delegates submit! and cancel! to OrderBookMod.add_order! and OrderBookMod.cancel_order!, so the same validation path is used everywhere.
  • Re-exports convenience queries (best_bid, best_ask, is_crossed, get_depth, available_qty, consume!) by attaching documentation to the underlying order book functions. This keeps a single implementation while presenting an intuitive API surface to callers.
  • Ensures upstream modules can using StockMarketABM.Engine (or rely on the top-level reexport) without knowing about the lower level modules.

Thanks to this façade, higher level code manipulates the order book through a stable interface, while the actual data-structure decisions remain encapsulated inside OrderBookMod and PriceLevelMod.

StockMarketABM.OrderBookMod.available_qtyFunction
available_qty(ob, side, price_limit; stop_at=zero(Qty)) -> Qty

Return executable quantity on the opposite side up to price_limit. The optional stop_at keyword lets callers short-circuit once the desired quantity is reached.

source
StockMarketABM.OrderBookMod.consume!Function
consume!(ob, side, qty; price_limit=nothing)

Consume liquidity from the opposite side while respecting an optional price limit, forwarding to OrderBookMod.consume!.

source