Project · C++20

Exchange

A small order-matching engine in C++, written to learn how an exchange pairs buyers and sellers.

I wanted to see what happens underneath, and to measure where the time really goes instead of guessing.

  • C++
How an order travels through ExchangeClients send buy and sell orders over the network. A network thread receives them and passes them through a queue to the matching engine, which keeps the order book and pairs buyers with sellers: the best price first, and at the same price, the oldest order first. The results come back the same way.Clientsbuy · sellordersNetworkreceives ordersordersresultsMatchingthe order book1031021011009998sellbuyBest price first; at the same price, the oldest order first.How an order travels through ExchangeClients send buy and sell orders over the network. A network thread receives them and passes them through a queue to the matching engine, which keeps the order book and pairs buyers with sellers: the best price first, and at the same price, the oldest order first. The results come back the same way.Clientsbuy · sellordersNetworkreceives ordersordersresultsMatchingthe order book1031021011009998sellbuyBest price first; at the sameprice, the oldest order first.