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.
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.
The following code depicts how to run the Handler in natural refresh mode:
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.