OnixS C++ CME Market Data Handler  5.7.0
API documentation
Maintaining Books by Natural Refresh

In the typical case, the Handler keeps checking incoming packets transmitted by the MDP for gaps and uses recovery facilities like the TCP Recovery and snapshot feeds to keep order books in the up-to-date state. When market data loss occurs, the Handler spawns market recovery using the corresponding recovery feed. While recovering the market, the incremental updates are cached, and thus, real-time processing looks suspended.

Natural refresh of order books supposes processing of real-time (incremental) market data without involving market recovery. As a result, the Handler processes the real-time market data as soon as it is received from the feeds. As a drawback, order books may not be fully recovered, and thus, some price levels may be absent.

Identifying Book State and Missed Price Levels

When recovery facilities are used, order books exposed by the Handler are always fully reconstructed and in an up-to-date state. When books are naturally refreshed, a part of price level information may be absent.

To differ whether the order book is reconstructed wholly or partly, the OnixS::CME::MDH::MboBook and OnixS::CME::MDH::MbpBook classes expose the OnixS::CME::MDH::MboBook::state and OnixS::CME::MDH::MbpBook::state members correspondently. The returned value identifies whether the book is fully reconstructed (OnixS::CME::MDH::BookState::Latest) or naturally refreshed (OnixS::CME::MDH::BookState::NaturallyRefreshed).

When an order book is naturally refreshed, some price levels may be absent. Price level data types (OnixS::CME::MDH::DirectPriceLevel, OnixS::CME::MDH::ImpliedPriceLevel) expose members (OnixS::CME::MDH::DirectPriceLevel::exist(), OnixS::CME::MDH::ImpliedPriceLevel::exist()) to check whether actual data is available for a particular bid or offer.

Data availability for a particular bid or offer does not apply to the MBO book. The OnixS::CME::MDH::Order class encapsulating the MBO book's entry does not provide any member similar to the OnixS::CME::MDH::DirectPriceLevel::exist() one. Missing orders aren't available in a book without any space reservation.


The following code depicts how to run the Handler in natural refresh mode:

// An instance to be configured.
Handler handler;
// Quick way to update settings in the desired way.
// Spawning MD processing.

In other words, natural refresh defines the behavior of the Handler in case of data loss and other issues while processing real-time data. Since this major release, the Handler provides the ability to combine natural refresh with other facilities like performing initial instrument and market recovery and TCP recovery to request lost data.

The following example depicts how the Handler and its processing session can be configured to combine natural refresh with an initial late join recovery.

// An instance to be configured.
Handler handler;
// For quicker access to required section.
sessionSettings =
// This will force Handler to perform initial recovery
// as it's done during late join - instruments will be
// recovered and market state afterwards.
// Forbids market state recovery in case of data
// loss or processing error. Books will be naturally
// refreshed in case of issue.
// Spawns market data processing
// according to chosen session settings.