OnixS C++ CME Market Data Handler  4.8.0.10
API documentation
Pages/GettingStarted.md
Go to the documentation of this file.
1 \addtogroup getting-started
2 
3 \brief Guides through the most significant
4 parts of the Handler's architecture.
5 
6 \details The OnixS::CME::MDH namespace encapsulates the SDK API.
7 The master `OnixS/CME/MDH.h` header file collects all header files
8 for more convenience.
9 
10 Following sections guide through the major steps to be done
11 to succeed with market data processing.
12 
13 \section specifying-license Initializing and Licensing SDK
14 
15 The SDK needs a valid license for successful execution. If
16 the licensing subsystem is not able to find a valid license,
17 it throws an exception at the initialization stage when the
18 OnixS::CME::MDH::initialize is called. Also, a license is
19 verified each time an attempt to start market data processing
20 is done using the OnixS::CME::MDH::Handler::start member.
21 
22 The OnixS::CME::MDH::InitializationSettings class exposes the
23 OnixS::CME::MDH::InitializationSettings::licenseStore member which
24 must be used to instruct the SDK where to look for a valid license.
25 By default, the licensing services look for a license in the current
26 directory of the application. However, by using noted parameter, it
27 is possible to specify another folder anywhere on file system.
28 
29 \note The licensing subsystem looks for a valid license in the
30 specified folder and selects the best one. If multiple licenses
31 are available, it selects the most significant one (for example,
32 a production license is selected instead of a trial one if both
33 are available).
34 
35 The following example demonstrates how to perform one-time SDK initialization:
36 
37 ~~~{.cpp}
38 
39 // Parameters for one-time initialization.
40 InitializationSettings settings;
41 
42 // The folder in which the license is stored.
43 settings.licenseStore("license");
44 
45 // Initializes all Handler services explicitly.
46 OnixS::CME::MDH::initialize(settings);
47 
48 ~~~
49 
50 \section constructing-handler-instance Configuring and Constructing the Handler
51 
52 The OnixS::CME::MDH::Handler class incapsulates a market data processing
53 machinery. A single instance of the OnixS::CME::MDH::Handler processes
54 market data for a single CME channel.
55 
56 The users must define settings affecting market data processing behavior
57 before constructing an instance of the OnixS::CME::MDH::Handler class.
58 
59 The OnixS::CME::MDH::HandlerSettings class contains all parameters
60 controlling various aspects of market data processing including
61 the behavior of the OnixS::CME::MDH::Handler.
62 
63 In the most cases, default values are set for parameters defining
64 the most likely behavior of the OnixS::CME::MDH::Handler instance.
65 However, some parameters must be set explicitly before constructing
66 an instance of the OnixS::CME::MDH::Handler class.
67 
68 ~~~{.cpp}
69 
70 HandlerSettings settings;
71 
72 settings.channel(310);
73 
74 settings.
75  feeds().
76  connectivityConfigurationFile("config.xml");
77 
78 Handler handler(settings);
79 
80 ~~~
81 
82 See [Handler's Settings](\ref handler-settings) for more
83 information on adjusting behavior of the Handler.
84 
85 \section binding-feedengine-to-handler Binding Feed Engine to the Handler
86 
87 The OnixS::CME::MDH::FeedEngine class encapsulates a layer responsible for
88 receiving market data which is transmitted by the CME MDP. Therefore, to have
89 successful processing of market data, it is necessary to construct an instance
90 of the Feed Engine and to bind it to the previously constructed instance of
91 the OnixS::CME::MDH::Handler class:
92 
93 ~~~{.cpp}
94 
95 FeedEngineSettings feSettings;
96 
97 FeedEngine feedEngine(feSettings);
98 
99 handler.bindFeedEngine(feedEngine);
100 
101 ~~~
102 
103 See [Feed Engine](\ref feed-engine) for more details on Feed Engine.
104 
105 \note An instance of the OnixS::CME::MDH::Handler does not manage
106 lifetime of a bound OnixS::CME::MDH::FeedEngine instance. Therefore,
107 user responsibility is to keep an instance of the OnixS::CME::MDH::FeedEngine
108 class valid while it is bound to an instance of OnixS::CME::MDH::Handler class.
109 
110 \section binding-logger-to-handler Logging Market Data and Other Events (Optional)
111 
112 The Handler may log market data it processes for further use by
113 replay feature or analysis as well as other important events which
114 may take place during regular market data processing.
115 
116 The OnixS::CME::MDH::Logger abstract class encapsulates the
117 logging subsystem. The SDK provides various implementations
118 of logging for different purposes. File-based logging is
119 satisfactory choise for the most cases.
120 
121 Below is an example of how file based logging can be established:
122 
123 ~~~{.cpp}
124 
125 FileLoggerSettings loggerSettings;
126 
127 // Sets filename of log as it was used by older Handlers.
128 loggerSettings.filename(makeLogFilename(310));
129 
130 // Varies which events are to be logged.
131 loggerSettings.severityLevel(LogSeverity::Debug);
132 
133 FileLogger logger(loggerSettings);
134 
135 handler.bindLogger(logger);
136 
137 ~~~
138 
139 \note An instance of the OnixS::CME::MDH::Handler does not manage
140 lifetime of a bound OnixS::CME::MDH::Logger instance. Therefore,
141 user responsibility is to keep an instance of the OnixS::CME::MDH::Logger
142 class valid while it is bound to an instance of OnixS::CME::MDH::Handler class.
143 
144 \section registering-listeners-with-handler Subscribing to Market Data Events
145 
146 Once an instance of the OnixS::CME::MDH::Handler is constructed
147 and bound to an instance of the OnixS::CME::MDH::FeedEngine, market
148 data processing can be started. However, it's necessary to subscribe
149 to corresponding events to get the results of market data processing
150 like updated order books.
151 
152 See the [Event Listeners](\ref event-listeners) topic concerning which
153 events are exposed by the Handler and how to subscribe to a particular
154 event.
155 
156 \section spawning-md-processing Spawning Market Data Processing
157 
158 As soon as an instance of the OnixS::CME::MDH::Handler is configured,
159 bound to a valid instance of the OnixS::CME::MDH::FeedEngine and listeners
160 for events are registered, market data processing can be initiated.
161 
162 Market data processing is initiated by invoking the OnixS::CME::MDH::Handler::start
163 member, which accepts an instance of OnixS::CME::MDH::SessionSettings class defining
164 the behavior of the Handler for the session.
165 
166 For the most common processing scenarios, the SDK exposes ready-to-use
167 presets of session settings: OnixS::CME::MDH::AccurateLateJoinSession(),
168 OnixS::CME::MDH::AccuratePreopeningSession, OnixS::CME::MDH::NaturalRefreshSession,
169 etc. See documentation for noted classes for more details.
170 
171 ~~~{.cpp}
172 
173 handler.start(AccurateLateJoinSession());
174 
175 ~~~
176 
177 The OnixS::CME::MDH::Handler::stop member must be
178 called to accomplish live market data processing:
179 
180 ~~~{.cpp}
181 
182 handler.stop();
183 
184 ~~~
185 
186 \note For more and up-to-date information on getting started aspects,
187 see __GettingStarted__ sample from the samples collection available in
188 distributive package.