OnixS C++ CME Market Data Handler  4.8.0.10
API documentation
Pages/TrackingBestBidOffer.md
Go to the documentation of this file.
1 \addtogroup best-bid-offer
2 
3 \brief Uncovers how to track changes in best bid/offer only.
4 
5 By default, the Handler invokes the OnixS::CME::MDH::SecurityListener::onBookUpdate
6 callback each time it receives book-related data via real-time or recovery feeds.
7 Received and processed updates may refer to any level and side in a book. Sometimes,
8 there's no interest in having updates for any price level in a book except top one.
9 For this reason, the Handler allows getting notified only about updates of the best
10 bid or offer.
11 
12 To take advantage of such facility the Handler exposes best bid/offer tracking
13 parameters which may be defined through the OnixS::CME::MDH::HandlerSettings
14 class interface. Its OnixS::CME::MDH::HandlerSettings::bookManagement section
15 exposes three members: OnixS::CME::MDH::BookManagement::directBooks,
16 OnixS::CME::MDH::BookManagement::impliedBooks and
17 OnixS::CME::MDH::BookManagement::consolidatedBooks each of which returns a
18 mutable instantiation of the OnixS::CME::MDH::BookManagementAndTracking template
19 class. Returned instance of OnixS::CME::MDH::BookManagementAndTracking in own
20 turn provides access to BBO tracking parameters specialized for a particular
21 book type via OnixS::CME::MDH::BookManagementAndTracking::bboTracking member.
22 
23 OnixS::CME::MDH::DirectBBOTracking structure for direct books
24 (OnixS::CME::MDH::ImpliedBBOTracking structure for implied and
25 consolidated books respectively) exposes members for each price level
26 attribute like price (OnixS::CME::MDH::DirectBBOTracking::price) and
27 quantity (OnixS::CME::MDH::DirectBBOTracking::quantity) allowing to
28 define tracking.
29 
30 OnixS::CME::MDH::BBOThreshold::enabled member defines whether the particular
31 attribute must be tracked for changes. The Handler raises a book update
32 only if the best bid/offer exceeds threshold bounds.
33 
34 OnixS::CME::MDH::BBOThreshold::threshold member allows to control the sensitivity
35 of Handler to the updates. The value specified via given member allows defining
36 sensitivity threshold for the best bid/offer. If price level attribute (price,
37 quantity) of the best bid or offer changes for more than the specified value,
38 the Handler raises an appropriate event. Otherwise - not.
39 
40 \section bbo-tracking-example Example
41 
42 The following example demonstrates how to configure the Handler to
43 get book updates only when the price of the best bid or offer changes
44 for more than 10% or quantity changes for more than 50%.
45 
46 ~~~{.cpp}
47 
48 using namespace OnixS::CME::MDH;
49 
50 HandlerSettings settings;
51 
52 DirectBBOTracking&
53 bboTracking =
54  settings.
55  bookManagement().
56  directBooks().
57  bboTracking();
58 
59 
60 bboTracking.price().enabled(true);
61 bboTracking.price().threshold(FLOAT(100000));
62 
63 bboTracking.quantity().enabled(true);
64 bboTracking.quantity().threshold(FLOAT(500000));
65 
66 ~~~