A matching engine
Deterministic price-time priority, in Java 21 and C++17.
PAUSED/matching engine, in this tab
- ·
- ·
- ·
- ·
- ·
- ·
- ·
- ·
- ·
- ·
- ·
- ·
- ·
- ·
orders
–
trades
–
resting
–
seed 2027, replayable
The same data structure, ported to TypeScript and running in this page. The benchmark button times one million orders on your machine.
One writer per instrument
A single thread owns each book, LMAX-style. The hot path takes no locks and the order of events is deterministic.
Journal first, then match
Every accepted order goes to a write-ahead journal before it is matched. After a crash, replaying the journal rebuilds the exact same book.
Orders in the way a venue takes them
FIX 4.4 order entry through QuickFIX/J, plus a REST API.
Correctness checked by machines
Property-based tests (jqwik), mutation testing (PIT), ArchUnit rules and JaCoCo coverage, all enforced in CI.
The path an order takes
FIX 4.4 and REST
order entry
Sequencer
write-ahead journal, replay on restart
Matching
single writer per instrument
Executions and market data
reports and L2 depth
163 ns
Median latency of the C++17 version, at 3.46 million operations a second. A pool allocator and intrusive lists keep every order in memory allocated up front, so cancel is O(1) and the hot path never allocates.
How long 163 ns is
- L1 cache reference~1 ns
- Mutex lock / unlock~25 ns
- Main memory reference~100 ns
- Match one order (C++17 engine, median)163 ns
- Round trip within a datacenter~500 µs
- Round trip Paris ↔ New York~70 ms