Every time you click Buy on a stock, crypto, or futures exchange, a tiny algorithm decides whether your order fills immediately, waits in a queue, or goes unfilled. That algorithm is called a matching engine, and its data structure is the limit order book.
The book is a sorted list of resting orders split into two sides. The bid side collects buyers willing to pay up to some price; the ask side collects sellers demanding at least some price. The highest bid and the lowest ask sit face to face — and the gap between them is the spread, the cost of trading.
When a new order arrives, the matching engine scans the opposite side of the book in price-time priority: best price first, and among equal prices, whoever arrived earliest wins. It is a deterministic, sub-microsecond arbitrator that never argues and never sleeps — the closest thing finance has to a physical law.
Comments
Loading comments...