Summary
We started the C++ implementation of our electronic trading ecosystem in this chapter. The first component we built was the exchange matching engine in charge of accepting and answering order requests from the order server component in the exchange infrastructure. This component is also responsible for generating and publishing market data updates to the market data publisher component in the exchange’s infrastructure.
First, we declared some assumptions in our matching engine and limit order books. We also defined a couple of basic Plain Old Data (POD)-style structures to encapsulate information for a single order in the limit order book, a single order request sent from the order server, an order response sent back to the order server, and a single market data update. We showed how to use the lock-free queue to facilitate communication between the matching engine and order server and market data publisher for order requests, order responses, and market data updates...