OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
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

The OnixS::CME::MDH::MboBook::state and OnixS::CME::MDH::MbpBook::state members expose the book's construction and refresh state. OnixS::CME::MDH::BookState::NaturallyRefreshed marks a book initialized for Natural Refresh, where levels or orders may be missing. OnixS::CME::MDH::BookState::Latest is also assigned during initialization or reset, including before recovery completes. Use the recovery and processing events described in Interpreting a book update to assess completeness and currency with the live stream.

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();