OnixS C++ CME MDP Premium Market Data Handler  5.8.9
API Documentation
Natural Refresh

By default, the handler checks incoming packets for gaps and uses recovery services like TCP Recovery and Market Recovery Feeds to keep order books up to date. When market data loss occurs, the handler uses the corresponding recovery feed to start market recovery. While recovering the market, incremental market data updates are cached, so the real-time processing is suspended.

The Natural Refresh approach to maintaining order books allows the processing of real-time (incremental) market data without involving market recovery feeds. In this mode, the handler always processes real-time market data as soon as it is received from Incremental Feeds. As a drawback, order books may not be fully recovered so some price levels may be absent.

Identifying the book state and missed price levels

Order books are always fully reconstructed and updated when the recovery services are used. When books are naturally refreshed, some price-level information may be absent.

To indicate whether the order book is reconstructed entirely 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).

Some price levels may be absent when an order book is naturally refreshed. 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 data is available for a particular bid or offer.

Note
Data availability for a particular bid or offer does not apply to the market-by-order (MBO) book. The OnixS::CME::MDH::Order class does not provide any member similar to the OnixS::CME::MDH::DirectPriceLevel::exist() one. Missing orders are unavailable in a book, and no space is reserved.

Example

The following code shows how to run the handler in the Natural Refresh mode:

Handler handler;
setSessionToNaturalRefresh(handler.settings().session());
handler.start();

The handler provides the ability to combine Natural Refresh with other market data recovery strategies (e.g., perform the initial instrument and market recovery and use TCP Recovery to request lost data).

The following example shows how the handler and its processing session can be configured to combine Natural Refresh with an initial Late Join recovery.

Handler handler;
SessionSettings& sessionSettings = handler.settings().session();
// This will force the handler to perform the initial recovery in the same way as
// it is done during the late join: instruments will be recovered first, and the market state afterwards.
sessionSettings.joinRecovery(JoinRecoveryOptions::InstrumentsAndMarketState);
// Forbids the market state recovery in case of data loss or processing error.
// Books will be naturally refreshed in case of gaps.
sessionSettings.gapAndErrorHandling(GapAndErrorHandlingOptions::ContinueProcessing);
handler.start();