Building the order book and matching orders
This final section implements the order book functionality. Remember that the order book handles client order requests forwarded from the matching engine. It checks the order request type, updates the order book, generates order responses for the client, and generates market data updates for the public market data feed. All the code for the limit order book in the matching engine is in the me_order_book.h
and me_order_book.cpp
source files, saved in the Chapter6/exchange/matcher/
directory in the GitHub repository for this book.
Building the internal data structures
First, we will declare the data members for the limit order book. We presented a diagram depicting the data structures that make up the limit order book previously, in Figure 6.1. The limit order book contains the following important data members:
- A
matching_engine_
pointer variable to theMatchingEngine
parent for the order book to publish order responses and market...