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

Although the Handler constructs and updates order books internally exposing already ready-to-use instances of books through callbacks, SDK provides the ability to construct and manipulate order books by users.

Constructing Book Instances

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

Constructing MBP (Market By Price) Books

MBP books are limited in size (depth). CME MDP provides information on book depth in instrument definitions. Therefore, the Handler knowns the book depth as soon as it receives a definition for a security.

To make book operations efficient, SDK optimizes memory allocation and data layout for MBP books. Therefore, construction of MBP books and further lifetime management are performed through the use of special factory classes. The Table below maps factory-classes to corresponding book types.

Book Class Factory Class
DirectBook DirectBookFactory
ImpliedBook ImpliedBookFactory
ConsolidatedBook ConsolidatedBookFactory

Each of factory classes, in fact, 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 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 in an ordinary way.

Coping Book Content

The SDK offers the OnixS::CME::MDH::copy routine to copy a book content across instances.

A template version of given routine copies a price level and other data for MBP books. Also, the routine has an optional parameter which allows limiting a 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.