Systems · MicroMatch
MicroMatch
An exchange matching engine, from scratch.
An in-process matching engine with strict price-time priority: limit and market orders, cancels, modifies, partial fills across price levels, trade reports, BBO, market depth, and deterministic event replay.
Architecture. A two-sided book (std::map per side, FIFO price levels) with O(1) cancel/modify via a hash map; aggressive orders sweep best-first at the maker price; byte-stable, deterministic replay of the entire event stream.
micromatch — bench --release
$ ./micromatch --bench --orders 10000000
[book] two-sided · FIFO levels · O(1) cancel
[run ] sweeping aggressive @ maker price…
throughput 11,312,884 ops/sec
mean 88.5 ns/op p50 42 ns
[chk ] price-time priority — adversarial
✓ maker ahead of taker at equal price
✓ replay byte-stable across 1e6 events
✓ ASan + UBSan: clean
$
Bids — buy
100.021,400
100.012,100
100.003,250
Asks — sell
100.032,980
100.041,820
100.05990