OnixS C++ CME MDP Conflated UDP Handler  1.1.2
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, OnixS::CME::ConflatedUDP::MbpBook class exposes the OnixS::CME::ConflatedUDP::MbpBook::state member correspondently. The returned value identifies whether the book is fully reconstructed (OnixS::CME::ConflatedUDP::BookState::Latest) or naturally refreshed (OnixS::CME::ConflatedUDP::BookState::NaturallyRefreshed).

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

Example

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.
setSessionToNaturalRefresh(handler.settings().session());
// Spawning MD processing.
handler.start();

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.
AdvancedSessionSettings&
sessionSettings =
handler.settings().session();
// This will force Handler to perform initial recovery
// as it's done during late join - instruments will be
// recovered and market state afterwards.
sessionSettings.
joinRecovery(
JoinRecovery::
InstrumentsAndMarketState);
// Forbids market state recovery in case of data
// loss or processing error. Books will be naturally
// refreshed in case of issue.
sessionSettings.
gapAndErrorHandling(
GapAndErrorHandling::
ContinueProcessing);
// Spawns market data processing
// according to chosen session settings.
handler.start();