OnixS C++ CME Market Data Handler  5.4.0
API documentation
Building and Maintaining Books by Yourself

Books Building Bricks

The Handler maintains books for each security by itself and exposes the results through callbacks if the user requested order book maintenance by modifying the Handler settings.

Sometimes there's a need to build and maintain books by own if, for example, a custom book structure is used by an application.

Book atomic updates represent the same elementary quants of market data as trades and statistics do.

The Handler notifies on atomic updates into a book through the OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate members. The listener instance can be registered using the OnixS::CME::MDH::HandlerListeners::security member.

Atomic updates may come in real-time via incremental feed or from snapshots while the market state is recovered. Therefore, OnixS::CME::MDH::SecurityListener has a few overloads, each of which exposes data based on its source.

An event exposes detailed information of elementary operations on bids or offers.

There's no ability to listen to atomic updates for the consolidated book because this type of book is produced by combining the direct and implied books.

Book Atomic Update Machinery and Relation with 'Book Update' Event

A book atomic update is delivered to client code via the OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate member and represents an elementary operation over a book. Therefore, the OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate may be invoked more frequently compared to the OnixS::CME::MDH::SecurityListener::onBookUpdate member. The OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate member usually is invoked several times before a single invoke of the OnixS::CME::MDH::SecurityListener::onBookUpdate is done.

When the Handler delivers an order book via the OnixS::CME::MDH::SecurityListener::onBookUpdate callback, that book is always in a valid and up-to-date state. In contrast, the OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate is a notification on an elementary action over a book. Usually, there're multiple atomic updates inside a single snapshot or incremental refresh transmitted by the MDP. As a result, a book may not be in a valid state between two atomic updates.

When the Handler processes all atomic updates belonging to a single market event, a book becomes in a valid state. The OnixS::CME::MDH::SecurityListener::onBookUpdate callbacks are called precisely when the Handler processes all atomic updates, and all books appear to be valid and up-to-date.

To build an order book properly, it is necessary also to listen to the Hander events. When an error or data loss occurs, the Handler may spawn market state recovery. Therefore, if the Handler invokes the OnixS::CME::MDH::HandlerListener::onMarketRecovery member, all books for all securities belonging to the channel must be empty. Afterward, the Handler will provide atomic updates recovered from snapshot messages.