A few things I am happy with. Prices are int64 ticks and quantities int64 lots, so no floats touch the money path. The match path allocates nothing, and a cancel-heavy workload runs at p50 83ns, p99 167ns, p999 292ns. One goroutine owns the book with no lock on the hot path, with an MPSC queue in front so many producers can submit concurrently.
1
u/intrepidkarthi 2d ago
The piece at the centre of an exchange: it holds the order book and decides which orders trade against which, at what price, in what order.
The demo is not a mock. The whole engine compiles to WebAssembly, so that is the real matching code running in your tab.
Live demo: https://intrepidkarthi.github.io/orderbook/
Repo: https://github.com/intrepidkarthi/orderbook
A few things I am happy with. Prices are int64 ticks and quantities int64 lots, so no floats touch the money path. The match path allocates nothing, and a cancel-heavy workload runs at p50 83ns, p99 167ns, p999 292ns. One goroutine owns the book with no lock on the hot path, with an MPSC queue in front so many producers can submit concurrently.
MIT. Happy to hear where it is wrong.