OnixS C++ CME MDP Conflated UDP Handler  1.1.2
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::ConflatedUDP::SecurityListener::onBookAtomicUpdate members. The listener instance can be registered using the OnixS::CME::ConflatedUDP::HandlerListeners::security member.

Note
Atomic updates may come in real-time via incremental feed or from snapshots while the market state is recovered. Therefore, OnixS::CME::ConflatedUDP::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.

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

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

When the Handler delivers an order book via the OnixS::CME::ConflatedUDP::SecurityListener::onBookUpdate callback, that book is always in a valid and up-to-date state. In contrast, the OnixS::CME::ConflatedUDP::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::ConflatedUDP::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::ConflatedUDP::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.