Apex
A limit order book and matching engine with price-time priority for limit, market, stop and stop-limit orders. A gateway thread and a matching thread talk through a lock-free ring buffer, and nothing allocates memory while matching.
- Throughput
- 10M msgs/s
- 2-thread pipeline
- 6.5M msgs/s
- Median latency
- 550 ns
Correctness is checked by replaying 400,000 random orders through Apex and a simple reference book and requiring identical trades.
github.com/Harish-613/Apex →Market orders sweep levels best price first; trades print at the resting order's price, as in Apex.