Building the matching engine and exchanging external data
In this section, we will build various parts of the matching engine class. A lot of the heavy lifting of handling client requests, building and updating the limit order book, and generating order responses and market updates will be offloaded to the order book class, which we will discuss in the next section. Please reread the Designing the C++ matching engine in a trading exchange section in the previous chapter, Designing Our Trading Ecosystem, for a refresher on the components we will build in this section and the design principles behind them. We present the diagram from that chapter here for easy reference, showing the design of the matching engine.
Figure 6.2 – The design of our matching engine component
The matching engine is an independent thread of execution that consumes order requests from ClientRequestLFQueue
, publishes order responses to ClientResponseLFQueue
, and publishes market...