1 \addtogroup book-natural-refresh
3 \brief Uncovers the way the SDK implements the book natural refresh.
5 In the regular case, the Handler keeps checking incoming packets transmitted
6 by MDP for gaps and uses recovery facilities like TCP Recovery and snapshot
7 feeds to keep order books in the up-to-date state. When market data loss occurs,
8 the Handler spawns market recovery using the market recovery feed. While
9 recovering market, the real-time market data is cached, and thus,
10 market data processing looks like suspended.
12 Natural refresh of order books supposes processing of real-time
13 (incremental) market data without involving market recovery. As
14 a result, the Handler processes the real-time market data as soon
15 as it is received from the feeds. As a drawback, order books may
16 not be fully recovered, and thus, some price levels may be absent.
18 \section detecting-book-and-price-levels-state Identifying Book State and Missed Price Levels
20 When recovery facilities are used, order books exposed by the Handler
21 are always fully reconstructed and in τς up-to-date state. When books
22 are naturally refreshed, a part of price level information may be absent.
24 To differ whether order book is fully recovered or just partly
25 reconstructed, OnixS::CME::MDH::MboBook and OnixS::CME::MDH::MbpBook
26 classes expose OnixS::CME::MDH::MboBook::state and OnixS::CME::MDH::MbpBook::state
27 members correspondently. Returned value identifies whether book is fully reconstructed
28 (OnixS::CME::MDH::BookStates::Latest) or naturally refreshed
29 (OnixS::CME::MDH::BookStates::NaturallyRefreshed).
31 When an order book is naturally refreshed, some price levels may
32 be absent. Price level data types (OnixS::CME::MDH::DirectPriceLevel,
33 OnixS::CME::MDH::ImpliedPriceLevel) expose members
34 (OnixS::CME::MDH::DirectPriceLevel::exist(),
35 OnixS::CME::MDH::ImpliedPriceLevel::exist()) to check
36 whether actual data is available for particular bid or ask.
38 \note Data availability for particular bid or ask is not applicable for
39 MBO book. OnixS::CME::MDH::Order as the entry of MBO book does not provide
40 any member similar to OnixS::CME::MDH::DirectPriceLevel::exist(). Missing
41 orders just aren't available in a book without any space reservation.
43 \section book-natural-refresh-example Example
45 The following code depicts how to run the Handler in natural refresh mode:
49 // 1. Establishing primary settings.
50 HandlerSettings settings;
52 settings.channel(310);
56 connectivityConfigurationFile("config.xml");
58 // 2. Constructing handler instance.
59 Handler handler(settings);
61 // 3. Spawning natural refresh session.
62 handler.start(NaturalRefreshSession());
66 In other words, natural refresh defines the behavior of the Handler
67 in case of data loss and other issues while processing real-time data.
68 Since this major release, the Handler provides the ability to combine
69 natural refresh with other facilities like performing initial instrument
70 and market recovery as well as TCP recovery to request lost data.
72 The following example depicts how the Handler and its processing
73 session can be configured to combine natural refresh with an
74 initial late join recovery.
78 // Establishing primary settings.
79 HandlerSettings settings;
81 settings.channel(310);
85 connectivityConfigurationFile("config.xml");
87 // Constructing handler instance.
88 Handler handler(settings);
90 // Configuring session.
91 SessionSettings sessionSettings;
93 // This will force Handler to perform initial recovery
94 // as it's done during late join - instruments will be
95 // recovered and market state afterwards.
99 InstrumentsAndMarketState);
101 // Forbids market state recovery in case of data
102 // loss or processing error. Books will be naturally
103 // refreshed in case of issue.
107 GapAndErrorHandling::ContinueProcessing);
110 // Spawns market data processing
111 // according to chosen session settings.
112 handler.start(sessionSettings);