The Handler manages order books internally and exposes ready-to-use instances of books through the callbacks. However, the SDK provides the ability to construct and manipulate order books by users.
There're one typesof books exposed by the MDP: MBP (Market By Price).
MBP books are limited in size (depth). The MDP provides information on book depth in instrument definitions. Therefore, the Handler knows the book depth as soon as it receives a definition for an instrument.
To make book operations efficient, the SDK optimizes memory allocation and data layout for MBP books. 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::ConflatedUDP::DirectBookFactory |
Each factory class represents an instantiation of the OnixS::CME::ConflatedUDP::MbpBookFactory template class, which provides the following key members:
Member | Description |
---|---|
OnixS::CME::ConflatedUDP::MbpBookFactory::construct | Constructs an instance of the book of a particular type. |
OnixS::CME::ConflatedUDP::MbpBookFactory::destruct | Destroys an instance of the book of a particular type and disposes all allocated resources. |
OnixS::CME::ConflatedUDP::MbpBookFactory::calcSize | Calculates the size of memory block required to store an instance of the book of a given depth. |
OnixS::CME::ConflatedUDP::MbpBookFactory::inplaceConstruct | Constructs an instance of book in place of a given memory block. |
The SDK offers the OnixS::CME::ConflatedUDP::copy routine to copy a book content across instances.
A template version of the given routine copies price levels and other data of MBP books. Also, the routine has an optional parameter limiting the number of price levels to copy.