OnixS C++ CME Market Data Handler  5.7.0
API documentation
Constructing And Copying Books

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.

Constructing Book Instances

There're two types of books exposed by the MDP: MBO (Market By Order) and MBP (Market By Price). The last one in its turn consists of three types: Direct, Implied, Consolidated. The Handler provides instance constructing patterns for each book type.

Constructing MBP (Market By Price) Books

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::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 the book of a particular type.
OnixS::CME::MDH::MbpBookFactory::destruct Destroys an instance of the book of a particular type and disposes all allocated resources.
OnixS::CME::MDH::MbpBookFactory::calcSize Calculates the size of memory block required to store an instance of the book of a given depth.
OnixS::CME::MDH::MbpBookFactory::inplaceConstruct Constructs an instance of book in place of a given memory block.

Constructing MBO (Market By Order) Books

MBO books, in contrast to MBP ones, are not limited by depth and may contain an arbitrary number of bids and offers. Therefore, an instance of the book cannot be placed in a flat memory block of fixed size. For this reason, there's no factory class constructing MBO book instances using special memory layout. Instead, the instances of the OnixS::CME::MDH::MboBook class are constructed ordinarily.

Coping Book Content

The SDK offers the OnixS::CME::MDH::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.

Overload of the OnixS::CME::MDH::copy routine for MBO books represents a wrapper over the OnixS::CME::MDH::MboBook assignment operator.