OnixS C++ CME Market Data Handler  4.8.0.10
API documentation
SessionSettings.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <string>
24 
25 #include <OnixS/CME/MDH/Integral.h>
26 
28 
29 /// Defines type of recovery to be done
30 /// by Handler at the time it joins market.
33 {
34  /// Integral type serving as
35  /// basement for given enumeration.
36  typedef UInt32 Base;
37 
38  /// Defines type of recovery to be done
39  /// by Handler while it joins market.
40  enum Enum
41  {
42  /// No recovery is to be done at join time.
43  /// Handler will switch to real-time data
44  /// processing immediately.
46 
47  /// Instructs Handler to recover instruments before
48  /// switching to real-time (incremental data) processing.
50 
51  /// Instructs Handler to perform full recovery (both instruments
52  /// and market state (books, last trades, statistics, etc))
53  /// before switching to real-time (incremental) data processing.
54  InstrumentsAndMarketState
55  };
56 };
57 
58 /// Serializes join recovery option.
59 ONIXS_CMEMDH_EXPORTED
60 void
61 toStr(
62  std::string&,
64 
65 /// Serializes join recovery option.
66 inline
67 std::string
70 {
71  std::string str;
72 
73  toStr(str, recovery);
74 
75  return str;
76 }
77 
78 /// Defines the way Handler has to handle
79 /// gap in real-time (incremental) data.
82 {
83  /// Integral type serving as
84  /// basement for given enumeration.
85  typedef UInt32 Base;
86 
87  /// Defines the way Handler has to handle
88  /// gap in real-time (incremental) data.
89  enum Enum
90  {
91  /// Handler recovers market state from snapshots.
93 
94  /// Handler recovers instruments and market state afterwards.
96 
97  /// Handler continues processing of real-time market data.
98  ContinueProcessing
99  };
100 };
101 
102 /// Serializes gap and error handling option.
103 ONIXS_CMEMDH_EXPORTED
104 void
105 toStr(
106  std::string&,
108 
109 /// Serializes gap and error handling option.
110 inline
111 std::string
114 {
115  std::string str;
116 
117  toStr(str, handling);
118 
119  return str;
120 }
121 
122 /// Defines market state recovery options.
125 {
126  /// Integral type serving as
127  /// basement for given enumeration.
128  typedef UInt32 Base;
129 
130  enum Enum
131  {
132  /// Only market by price books will be
133  /// recovered during market state recovery.
135 
136  /// Only market by order books will be
137  /// recovered during market state recovery.
139 
140  /// Both market by price and market by order
141  /// books will be recovered during market
142  /// state recovery.
143  BothMboAndMbp
144  };
145 };
146 
147 /// Serializes market recovery option.
148 ONIXS_CMEMDH_EXPORTED
149 void
150 toStr(
151  std::string&,
153 
154 /// Serializes market recovery option.
155 inline
156 std::string
159 {
160  std::string str;
161 
162  toStr(str, option);
163 
164  return str;
165 }
166 
167 /// Set of parameters affecting Handler's behavior
168 /// when market data processing session is spawned.
170 {
171  JoinRecoveryOptions::Enum joinRecovery_;
172  GapAndErrorHandlingOptions::Enum gapAndErrorHandling_;
173  MarketRecoveryOptions::Enum marketRecovery_;
174 
175 public:
176  /// Initializes parameters with default values.
178  : joinRecovery_(
180  InstrumentsAndMarketState)
181  , gapAndErrorHandling_(
183  RecoverMarketState)
184  , marketRecovery_(
185  MarketRecoveryOptions::BothMboAndMbp)
186  {
187  }
188 
189  /// Cleans everything up.
191  {
192  }
193 
194  /// Defines aspects of recovery to be done at market join stage.
195  ///
196  /// @note Default value is JoinRecovery::InstrumentsAndMarket.
198  joinRecovery() const
199  {
200  return joinRecovery_;
201  }
202 
203  /// Defines aspects of recovery to be done at market join stage.
204  void
206  JoinRecoveryOptions::Enum recovery)
207  {
208  joinRecovery_ = recovery;
209  }
210 
211  /// Defines what Handler should do in case
212  /// of gap in real-time (incremental) data.
213  ///
214  /// @note Default value is GapAndErrorHandling::RecoverMarketState.
217  {
218  return gapAndErrorHandling_;
219  }
220 
221  /// Defines what Handler should do in case
222  /// of gap in real-time (incremental) data.
223  void
226  {
227  gapAndErrorHandling_ = handling;
228  }
229 
230  /// Defines selected market recovery options.
231  ///
232  /// @note Default value is MarketRecovery::BothMboAndMbp.
235  {
236  return marketRecovery_;
237  }
238 
239  /// Defines market recovery options.
240  void
243  {
244  marketRecovery_ = recovery;
245  }
246 };
247 
248 /// Serializes market data processing session settings.
249 ONIXS_CMEMDH_EXPORTED
250 void
251 toStr(
252  std::string&,
253  const SessionSettings&);
254 
255 /// Serializes market data processing session settings.
256 inline
257 std::string
259  const SessionSettings& settings)
260 {
261  std::string str;
262 
263  toStr(str, settings);
264 
265  return str;
266 }
267 
268 //
269 
270 /// Settings for session with accurate book
271 /// maintenance and considering market data
272 /// processing is started from the beginning
273 /// of weekly session.
276 : public SessionSettings
277 {
278  using
279  SessionSettings::
280  joinRecovery;
281 
282  using
283  SessionSettings::
284  gapAndErrorHandling;
285 
286 public:
287  /// Configures session settings
288  /// according to specialization.
290  {
291  joinRecovery(
293  Disabled);
294 
295  gapAndErrorHandling(
297  RecoverMarketState);
298  }
299 };
300 
301 /// Settings for session with accurate book maintenance
302 /// and considering market data processing is started
303 /// from the beginning of weekly session. Market recovery
304 /// is limited to recovery market by order books only.
308 {
309  /// Configures session settings
310  /// according to specialization.
312  {
313  marketRecovery(
315  MboOnly);
316  }
317 };
318 
319 /// Settings for session with accurate book maintenance
320 /// and considering market data processing is started
321 /// from the beginning of weekly session. Market recovery
322 /// is limited to recovery market by price books only.
326 {
327  /// Configures session settings
328  /// according to specialization.
330  {
331  marketRecovery(
333  MbpOnly);
334  }
335 };
336 
337 /// Settings for session with accurate book
338 /// maintenance and considering market data
339 /// processing is started at the middle of
340 /// weekly session (late join).
343 : public SessionSettings
344 {
345  using
346  SessionSettings::
347  joinRecovery;
348 
349  using
350  SessionSettings::
351  gapAndErrorHandling;
352 
353 public:
354  /// Configures session settings
355  /// according to specialization.
357  : SessionSettings()
358  {
359  joinRecovery(
361  InstrumentsAndMarketState);
362 
363  gapAndErrorHandling(
365  RecoverMarketState);
366  }
367 };
368 
369 /// Settings for session with accurate book maintenance
370 /// and considering market data processing is started at
371 /// the middle of weekly session (late join). Market recovery
372 /// is limited to recover market by order books only.
376 {
377  /// Configures session settings
378  /// according to specialization.
380  {
381  marketRecovery(
383  MboOnly);
384  }
385 };
386 
387 /// Settings for session with accurate book maintenance
388 /// and considering market data processing is started at
389 /// the middle of weekly session (late join). Market recovery
390 /// is limited to recover market by price books only.
394 {
395  /// Configures session settings
396  /// according to specialization.
398  {
399  marketRecovery(
401  MbpOnly);
402  }
403 };
404 
405 /// Configures session settings to maintain
406 /// order books using natural refresh. Startup
407 /// recovery is not performed and thus only
408 /// real-time processing takes place.
411 : public SessionSettings
412 {
413  using
414  SessionSettings::
415  joinRecovery;
416 
417  using
418  SessionSettings::
419  gapAndErrorHandling;
420 
421 public:
422  /// Configures session settings
423  /// according to specialization.
425  : SessionSettings()
426  {
427  joinRecovery(
428  JoinRecoveryOptions::Disabled);
429 
430  gapAndErrorHandling(
432  ContinueProcessing);
433  }
434 };
435 
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:110
void joinRecovery(JoinRecoveryOptions::Enum recovery)
Defines aspects of recovery to be done at market join stage.
void marketRecovery(MarketRecoveryOptions::Enum recovery)
Defines market recovery options.
UInt32 UInt32
uInt32.
Definition: Fields.h:189
Handler recovers market state from snapshots.
~SessionSettings()
Cleans everything up.
SessionSettings()
Initializes parameters with default values.
#define ONIXS_CMEMDH_LTWT_STRUCT
Definition: Bootstrap.h:114
Handler recovers instruments and market state afterwards.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:168
GapAndErrorHandlingOptions::Enum gapAndErrorHandling() const
void gapAndErrorHandling(GapAndErrorHandlingOptions::Enum handling)
std::string toStr(const SessionSettings &settings)
Serializes market data processing session settings.
MarketRecoveryOptions::Enum marketRecovery() const
Defines market state recovery options.
JoinRecoveryOptions::Enum joinRecovery() const
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:172