The handler can manage order books internally and exposes book instances through the callbacks. The SDK also provides the ability to construct and manipulate order books explicitly.
MBP books are limited in size (depth). The CME MDP platform provides information on book depth via "Instrument Definitions" messages. Therefore, Handler knows the book's depth as soon as it receives a definition for an instrument.
The SDK optimises memory allocation and data layout for MBP books to make book operations efficient. Therefore, the construction of MBP books and further lifetime management are performed through special factory classes. The table below maps factory classes to corresponding book types.
Book Class | Factory Class |
---|---|
Direct | OnixS::CME::MDH::DirectBookFactory |
Implied | OnixS::CME::MDH::ImpliedBookFactory |
Consolidated | OnixS::CME::MDH::ConsolidatedBookFactory |
Each factory class represents an instantiation of the OnixS::CME::MDH::MbpBookFactory template class, which provides the following key members:
Member | Description |
---|---|
OnixS::CME::MDH::MbpBookFactory::construct | Constructs an instance of an order book of a particular type. |
OnixS::CME::MDH::MbpBookFactory::destruct | Destroys an instance of an order book of a particular type and disposes of allocated resources. |
OnixS::CME::MDH::MbpBookFactory::calcSize | Calculates the memory block size required to store an instance of the order book of a given depth. |
OnixS::CME::MDH::MbpBookFactory::inplaceConstruct | Constructs an instance of an order book in place of a given memory block. |
MBO books, in contrast to MBP ones, are not limited by depth and may contain an arbitrary number of bids and offers. Therefore, an order book instance data layout cannot be optimised. For this reason, there are no factory classes for constructing MBO book instances. Instead, OnixS::CME::MDH::MboBook instances are ordinarily built.
The SDK offers the OnixS::CME::MDH::copy routine to copy book content across instances.
A template version of the given routine copies price levels and other MBP book data. Also, the routine has an optional parameter limiting the number of price levels to copy:
Overload of the OnixS::CME::MDH::copy routine for MBO books represents a wrapper over the OnixS::CME::MDH::MboBook assignment operator.