OnixS C++ CME MDP Premium Market Data Handler  5.8.3
API Documentation
HandlerSettings.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/Domain.h>
26 
33 
35 
37 
38 /// License configuration settings.
40 {
41 public:
42  /// Folders that contain license file(s).
43  typedef std::vector<std::string> LicenseStores;
44 
45  /// Initializes listeners with default values.
47  : SettingGroup(controller)
48  {
49  }
50 
51  /// Re-initializes settings as copies of
52  /// the other ones omitting group belonging.
54  : SettingGroup()
55  , stores_(other.stores_)
56  , licenseString_(other.licenseString_)
57  {
58  }
59 
60  /// Adds the path to the folder that contains license file(s).
61  LicenseSettings& addLicenseStore(const std::string& value)
62  {
63  LicenseStores stores = stores_;
64  stores.push_back(value);
65 
66  controlAssignment("License Store", stores_, stores);
67  return *this;
68  }
69 
70  /// Assigns the path to the folder that contains license file(s).
71  LicenseSettings& licenseStore(const std::string& value)
72  {
73  LicenseStores stores;
74  stores.push_back(value);
75 
76  controlAssignment("License Store", stores_, stores);
77  return *this;
78  }
79 
80  /// Assigns the license string.
81  LicenseSettings& licenseString(const std::string& value)
82  {
83  controlAssignment("License String", licenseString_, value);
84  return *this;
85  }
86 
87  /// Returns the folders that contain license file(s).
88  const LicenseStores& licenseStores() const
89  {
90  return stores_;
91  }
92 
93  /// Returns the license string.
94  const std::string& licenseString() const
95  {
96  return licenseString_;
97  }
98 
99  /// Re-initializes as a copy of the other one.
101  {
102  controlChange("Handler Settings", &LicenseSettings::assignNoControl, *this, other);
103 
104  return *this;
105  }
106 
107 private:
108  void assignNoControl(const LicenseSettings& other)
109  {
110  stores_ = other.stores_;
111  licenseString_ = other.licenseString_;
112  }
113 
114  LicenseStores stores_;
115  std::string licenseString_;
116 
118 };
119 
120 /// Handler's configuration settings.
122 {
123 public:
124  /// Initializes parameters with default values.
126  : SettingGroup(controller)
127  , channel_(0)
128  , feeds_(controller)
129  , session_(controller)
130  , tradeProcessing_(TradeProcessing::SummaryLevel)
131  , bookManagement_(controller)
132  , recoveryQueueMaxSize_(1000000)
133  , instrumentCache_()
134  , logging_(controller)
135  , listeners_(controller)
136  , licenseSettings_(controller)
137  , dataCenter_(DataCenter::Primary)
138 
139  {
140  }
141 
142  /// Initializes the instance
143  /// as a copy of the other one.
145  : SettingGroup()
146  , channel_(other.channel_)
147  , feeds_(other.feeds_)
148  , session_(other.session_)
149  , tradeProcessing_(other.tradeProcessing_)
150  , bookManagement_(other.bookManagement_)
151  , recoveryQueueMaxSize_(other.recoveryQueueMaxSize_)
152  , instrumentCache_(other.instrumentCache_)
153  , logging_(other.logging_)
154  , listeners_(other.listeners_)
155  , licenseSettings_(other.licenseSettings_)
156  , configurationFile_(other.configurationFile_)
157  , dataCenter_(other.dataCenter_)
158  {
159  }
160 
161  /// Cleans everything up.
163 
164  /// Identifies CME market data channel.
166  {
167  return channel_;
168  }
169 
170  /// Identifies CME market data channel.
172  {
173  controlAssignment("Channel Id", channel_, value);
174 
175  return *this;
176  }
177 
178 
179  /// Path to the connectivity configuration file.
180  const std::string& connectivityConfigurationFile() const
181  {
182  return configurationFile_;
183  }
184 
185  /// Identifies the data center whose parameters are to
186  /// be extracted from the connectivity configuration file.
187  ///
188  /// The connectivity configuration file may not include
189  /// attributes for all kinds of data centers.
191  {
192  return dataCenter_;
193  }
194 
195  /// Path to the connectivity configuration file from which
196  /// to load feed connection settings.
197  ///
198  /// The given parameter allows retrieving connectivity settings
199  /// from the connectivity configuration file published by CME
200  /// instead of manual setup.
201  ///
202  /// \warning The given parameter has lower priority comparing
203  /// to feed connection settings. E.g., if connection parameters
204  /// are manually set up for any of feeds, the Handler will use
205  /// those parameters to connect to or join multicast groups.
206  /// The given parameter value is ignored in such a case and thus
207  /// connectivity configuration is not loaded from the specified
208  /// file.
209  ///
210  /// For certain environments CME provides additional data
211  /// centers to be used in case of a disaster. The additional
212  /// parameter allows specifying whether to load connection
213  /// settings for either the primary or a disaster recovery
214  /// data center.
216  const std::string& configurationFile,
217  DataCenter::Enum dataCenter = DataCenter::Primary
218  )
219  {
221  "Connectivity Configuration File",
222  &HandlerSettings::assignConnectivityConfiguration,
223  *this,
224  configurationFile,
225  dataCenter
226  );
227 
228  return *this;
229  }
230 
231  /// Reference to parameters related with feeds.
232  const FeedSettings& feeds() const
233  {
234  return feeds_;
235  }
236 
237  /// Reference to parameters related with feeds.
239  {
240  return feeds_;
241  }
242 
243  /// Settings affecting processing session.
245  {
246  return session_;
247  }
248 
249  /// Settings affecting processing session.
250  const SessionSettings& session() const
251  {
252  return session_;
253  }
254 
255  /// Listeners associated with the Handler.
257  {
258  return listeners_;
259  }
260 
261  /// Listeners associated with the Handler.
263  {
264  return listeners_;
265  }
266 
267  /// Indicates how trades are processed.
269  {
270  return tradeProcessing_;
271  }
272 
273  /// Defines how trades are processed.
275  {
276  controlAssignment("Trade Processing Strategy", tradeProcessing_, strategy);
277 
278  return *this;
279  }
280 
281  /// Reference to parameters affecting book management.
283  {
284  return bookManagement_;
285  }
286 
287  /// Reference to parameters affecting book management.
289  {
290  return bookManagement_;
291  }
292 
293  /// Maximum number of packets transmitted via
294  /// incremental feed to be hold in internal queue
295  /// while market state is recovered from snapshots.
296  ///
297  /// When Handler recovers order books from snapshots,
298  /// the given parameter limits the size of the internal
299  /// queue used by the Handler to keep packets coming from
300  /// incremental feeds. Upon reaching limit, newer packets
301  /// substitute older ones.
302  ///
303  /// @note The default value is 1000000.
305  {
306  return recoveryQueueMaxSize_;
307  }
308 
309  /// Maximum number of packets to be hold in the internal
310  /// queue used by the Handler while processing incoming data.
312  {
313  controlAssignment("Recovery Queue Max Size", recoveryQueueMaxSize_, queueMaxSize);
314 
315  return *this;
316  }
317 
318  /// Path to the file where the Handler
319  /// must store security definitions for
320  /// further use instead of a live instrument
321  /// feed while recovering definitions due
322  /// to late join.
323  ///
324  /// If path is not defined, the Handler
325  /// will not cache instrument definitions.
326  ///
327  /// @note The default value is empty string.
328  ///
329  /// @warning If this option is activated, then
330  /// it is recommended to remove the cache file
331  /// weekly to start the trading week with the
332  /// fresh copy of security definitions.
333  const std::string& instrumentCache() const
334  {
335  return instrumentCache_;
336  }
337 
338  /// Defines path to a file to be used as instrument definition cache.
339  ///
340  /// Instrument definition cache is used to recover instrument
341  /// definitions at the beginning of market data processing session
342  /// without connecting to live instrument recovery feeds. Later,
343  /// the Handler puts the incoming instrument definitions received
344  /// via incremental feeds into the given file.
345  ///
346  /// @note The Handler may recover instrument definitions stored
347  /// in FIX (tag=value) format in a 'secdef.dat' file exposed by
348  /// the CME via public FTP. However, the file won't be updated
349  /// during further market data processing.
350  HandlerSettings& instrumentCache(const std::string& filename)
351  {
352  controlAssignment("Instrument Cache Path", instrumentCache_, filename);
353 
354  return *this;
355  }
356 
357  /// Settings affecting logging.
359  {
360  return logging_;
361  }
362 
363  /// Settings affecting logging.
364  const LoggingSettings& logging() const
365  {
366  return logging_;
367  }
368 
369  /// Settings affecting licensing.
371  {
372  return licenseSettings_;
373  }
374 
375  /// Settings affecting licensing.
377  {
378  return licenseSettings_;
379  }
380 
381 #if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
382 
383  /// Parameters affecting logging at debug level.
384  ///
385  /// @warning The given member is deprecated.
386  /// Use logging().debug() member to manipulate
387  /// parameters affecting the debug level output.
389  {
390  return logging_.debug();
391  }
392 
393  /// Parameters affecting logging at debug level.
394  ///
395  /// @warning The given member is deprecated.
396  /// Use logging().debug() member to manipulate
397  /// parameters affecting the debug level output.
399  {
400  return logging_.debug();
401  }
402 
403 #endif // ONIXS_CMEMDH_NO_DEPRECATED
404 
405  /// Re-initializes as a copy of the other one.
407  {
408  controlChange("Handler Settings", &HandlerSettings::assignNoControl, *this, other);
409 
410  return *this;
411  }
412 
413 private:
414  ChannelId channel_;
415 
416  FeedSettings feeds_;
417 
418  SessionSettings session_;
419 
420  TradeProcessing::Enum tradeProcessing_;
421  BookManagement bookManagement_;
422 
423  UInt32 recoveryQueueMaxSize_;
424  std::string instrumentCache_;
425 
426  LoggingSettings logging_;
427 
428  HandlerListeners listeners_;
429 
430  LicenseSettings licenseSettings_;
431 
432  std::string configurationFile_;
433 
434  DataCenter::Enum dataCenter_;
435 
436  void assignNoControl(const HandlerSettings& other)
437  {
438  channel_ = other.channel_;
439 
440  feeds_.assignNoControl(other.feeds_);
441 
442  session_.assignNoControl(other.session_);
443 
444  tradeProcessing_ = other.tradeProcessing_;
445 
446  bookManagement_.assignNoControl(other.bookManagement_);
447 
448  recoveryQueueMaxSize_ = other.recoveryQueueMaxSize_;
449 
450  instrumentCache_ = other.instrumentCache_;
451 
452  logging_.assignNoControl(other.logging_);
453 
454  listeners_.assignNoControl(other.listeners_);
455 
456  licenseSettings_.assignNoControl(other.licenseSettings_);
457 
458  configurationFile_ = other.configurationFile_;
459 
460  dataCenter_ = other.dataCenter_;
461  }
462 
463  /// Loads connectivity parameters from the given configuration file.
464  void assignConnectivityConfiguration(const std::string& configurationFile, DataCenter::Enum dataCenter)
465  {
466  configurationFile_ = configurationFile;
467 
468  dataCenter_ = dataCenter;
469  }
470 };
471 
472 /// Serializes BBA tracking parameters into string.
474 void toStr(std::string&, const HandlerSettings&);
475 
476 /// Serializes BBA tracking parameters into string.
477 inline std::string toStr(const HandlerSettings& settings)
478 {
479  std::string str;
480 
481  toStr(str, settings);
482 
483  return str;
484 }
485 
486 /// Makes filename for instrument cache for the given channel.
489 
SessionSettings & session()
Settings affecting processing session.
Handler&#39;s configuration settings.
const LicenseSettings & licenseSettings() const
Settings affecting licensing.
HandlerSettings(SettingChangeController *controller=nullptr)
Initializes parameters with default values.
const std::string & instrumentCache() const
Path to the file where the Handler must store security definitions for further use instead of a live ...
const std::string & connectivityConfigurationFile() const
Path to the connectivity configuration file.
const SessionSettings & session() const
Settings affecting processing session.
To optimally service customers and meet regulatory requirements for out-of-region recovery capabiliti...
Definition: FeedSettings.h:859
HandlerSettings & recoveryQueueMaxSize(UInt32 queueMaxSize)
Maximum number of packets to be hold in the internal queue used by the Handler while processing incom...
UInt32 UInt32
uInt32.
Definition: Fields.h:192
#define ONIXS_CMEMDH_NULLPTR
Definition: Compiler.h:145
UInt32 ChannelId
Identifies CME channel.
Definition: Domain.h:28
LicenseSettings & licenseString(const std::string &value)
Assigns the license string.
~HandlerSettings()
Cleans everything up.
void assignNoControl(const SessionSettings &other)
Re-initializes the instance as a copy of the other one and bypassing assignment control.
const BookManagement & bookManagement() const
Reference to parameters affecting book management.
HandlerSettings & instrumentCache(const std::string &filename)
Defines path to a file to be used as instrument definition cache.
HandlerSettings & channel(ChannelId value)
Identifies CME market data channel.
The collection of settings affecting use of logging subsystem by the Handler.
HandlerSettings & tradeProcessing(TradeProcessing::Enum strategy)
Defines how trades are processed.
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
LicenseSettings(SettingChangeController *controller=nullptr)
Initializes listeners with default values.
const HandlerListeners & listeners() const
Listeners associated with the Handler.
void controlAssignment(const Char *description, Assignee &assignee, Value value) const
Guarded assignment of the given value to the given variable.
Definition: SettingGroup.h:107
Parameters affecting what&#39;s logged at a debug level.
const std::string & licenseString() const
Returns the license string.
bool value(Number &number, const MultiContainer &container, Tag tag)
Finds a tag-value entry in the given collection by the given tag and returns its value component tran...
LicenseSettings & operator=(const LicenseSettings &other)
Re-initializes as a copy of the other one.
HandlerSettings & operator=(const HandlerSettings &other)
Re-initializes as a copy of the other one.
LicenseSettings(const LicenseSettings &other)
Re-initializes settings as copies of the other ones omitting group belonging.
Enum
To optimally service customers and meet regulatory requirements for out-of-region recovery capabiliti...
Definition: FeedSettings.h:869
std::string makeInstrumentCacheFilename(ChannelId)
Makes filename for instrument cache for the given channel.
LicenseSettings & licenseSettings()
Settings affecting licensing.
const LicenseStores & licenseStores() const
Returns the folders that contain license file(s).
std::vector< std::string > LicenseStores
Folders that contain license file(s).
BookManagement & bookManagement()
Reference to parameters affecting book management.
UInt32 recoveryQueueMaxSize() const
Maximum number of packets transmitted via incremental feed to be hold in internal queue while market ...
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
HandlerSettings & connectivityConfigurationFile(const std::string &configurationFile, DataCenter::Enum dataCenter=DataCenter::Primary)
Path to the connectivity configuration file from which to load feed connection settings.
DataCenter::Enum dataCenter() const
Identifies the data center whose parameters are to be extracted from the connectivity configuration f...
Base services for settings grouped by a certain criteria.
Definition: SettingGroup.h:91
Basic set of parameters affecting behavior of the Handler when the market data processing is performe...
HandlerListeners & listeners()
Listeners associated with the Handler.
FeedSettings & feeds()
Reference to parameters related with feeds.
const HandlerDebugLoggingSettings & debugLogging() const
Parameters affecting logging at debug level.
HandlerSettings(const HandlerSettings &other)
Initializes the instance as a copy of the other one.
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:135
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:48
Set of listeners to be used by the Handler to reflect various aspects of market data processing...
const FeedSettings & feeds() const
Reference to parameters related with feeds.
LoggingSettings & logging()
Settings affecting logging.
The parameters affecting all feeds involved into market data processing.
Definition: FeedSettings.h:896
Represents a service controlling change/update operations for the collections of settings.
Definition: SettingGroup.h:33
LicenseSettings & licenseStore(const std::string &value)
Assigns the path to the folder that contains license file(s).
Parameters affecting book management machinery.
const LoggingSettings & logging() const
Settings affecting logging.
TradeProcessing::Enum tradeProcessing() const
Indicates how trades are processed.
License configuration settings.
void controlChange(const Char *description, void(Changeable::*change)(), Changeable &changeable) const
Guarded invoke of the given routine which assumes complex change or update for the given object...
Definition: SettingGroup.h:118
Defines different ways trades are processed.
ChannelId channel() const
Identifies CME market data channel.
HandlerDebugLoggingSettings & debugLogging()
Parameters affecting logging at debug level.
LicenseSettings & addLicenseStore(const std::string &value)
Adds the path to the folder that contains license file(s).
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68