Package com.quantfinlib.orderbook
package com.quantfinlib.orderbook
Limit order book modeling, in two deliberate lanes:
OrderBook is the research-grade model
(price-time-priority matching with cancels, partial fills, queue-position
queries and order-to-trade counters — readable TreeMap/object internals);
HftOrderBook is the venue-grade core
(dense integer-tick price ladder with occupancy bitmaps, pooled intrusive
order nodes, primitive open-addressing id map, zero allocation —
~204 ns/op, 10M+ fills/sec measured by HftBookBenchmark).
BookAnalytics adds spread, microprice,
depth imbalance and non-destructive sweep simulation. Correctness is
enforced by a 100k-operation model-based fuzz test on the reference book,
and by an equivalence test that drives BOTH books with identical random
operation streams — the readable book is the executable specification of
the fast one.-
ClassDescriptionSpread, depth and liquidity analytics over an
OrderBook: quoted spread, size-weighted microprice, depth imbalance, depth-within-bps, and non-destructive book sweep simulation (VWAP-to-fill and impact of a large marketable order).Result of simulating a sweep: what a marketable order of that size would pay.The zero-allocation building blocks shared by the hot-lane books (HftOrderBookvenue-side,marketdata.L3BookBuilderparticipant-side): occupancy-bitmap scans and a primitive open-addressing long→int map with backward-shift deletion.Venue-grade price-time-priority matching engine: the zero-allocation sibling ofOrderBook, built the way exchange cores are actually built.Primitive fill callback: maker is the resting order, taker the incoming one.A resting limit order.Price-time-priority limit order book with continuous matching.Fill callback: maker is the resting order, taker the incoming one.Order side.