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.
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.
The following code shows how to run the handler in the Natural Refresh mode:
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.