OnixS C++ CME MDP Premium Market Data Handler  5.8.3
API Documentation
Custom order book building

The order book maintenance is configurable.

Sometimes there is a need to build and maintain order books independently (e.g., an application uses a custom order book structure).

Book atomic updates

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 via the OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate members. The listener instance can be registered using the OnixS::CME::MDH::HandlerListeners::security member. The corresponding event describes elementary operations on bids or offers.

Atomic updates may come in real-time via Incremental Feeds or via Market Recovery Feeds while the market state is being recovered. Therefore, OnixS::CME::MDH::SecurityListener has a few overloads, each exposing data based on its source.
There's no ability to listen to atomic updates for a consolidated order book because this type of book is produced by combining direct and implied order books.

'Book Atomic Update' vs 'Book Update' events

An atomic order book update is reported to client code via the OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate member and represents an elementary operation over an order book. Therefore, the OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate may be invoked more frequently than 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 reports an order book via the OnixS::CME::MDH::SecurityListener::onBookUpdate callback, that book is always valid and up-to-date. In contrast, the OnixS::CME::MDH::SecurityListener::onBookAtomicUpdate is a notification on an elementary action over a book. Usually, there are multiple atomic updates inside a single Snapshot or Incremental Refresh message. 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, an order book reaches a valid state. The OnixS::CME::MDH::SecurityListener::onBookUpdate callbacks are called only when the handler processes all atomic updates, so the books are valid and up-to-date.

Listening to the handler events is necessary to build an order book correctly. The handler may start the market state recovery when an error or data loss occurs. Therefore, if the handler invokes the OnixS::CME::MDH::HandlerListener::onMarketRecovery member, all books for all securities belonging to the channel must be empty. Afterwards, the handler will provide atomic updates received via Snapshot messages.