OnixS C++ CME Market Data Handler  5.4.0
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 /// Handler's configuration settings.
41  : public SettingGroup
42 {
43  ChannelId channel_;
44 
45  FeedSettings feeds_;
46 
47  AdvancedSessionSettings session_;
48 
49  TradeProcessing::Enum tradeProcessing_;
50  BookManagement bookManagement_;
51 
52  UInt32 recoveryQueueMaxSize_;
53  std::string instrumentCache_;
54 
55  LoggingSettings logging_;
56 
57  HandlerListeners listeners_;
58 
59  void
60  assignNoControl(
61  const HandlerSettings& other)
62  {
63  channel_ =
64  other.channel_;
65 
66  feeds_.
67  assignNoControl(
68  other.feeds_);
69 
70  session_.
71  assignNoControl(
72  other.session_);
73 
74  tradeProcessing_ =
75  other.tradeProcessing_;
76 
77  bookManagement_.
78  assignNoControl(
79  other.bookManagement_);
80 
81  recoveryQueueMaxSize_ =
82  other.recoveryQueueMaxSize_;
83 
84  instrumentCache_ =
85  other.instrumentCache_;
86 
87  logging_.
88  assignNoControl(
89  other.logging_);
90 
91  listeners_.
92  assignNoControl(
93  other.listeners_);
94  }
95 
96 public:
97  /// Initializes parameters with default values.
100  controller = NULL)
101  : SettingGroup(controller)
102  , channel_(0)
103  , feeds_(controller)
104  , session_(controller)
105  , tradeProcessing_(
106  TradeProcessing::SummaryLevel)
107  , bookManagement_(controller)
108  , recoveryQueueMaxSize_(1000000)
109  , instrumentCache_()
110  , logging_(controller)
111  , listeners_(controller)
112  {
113  }
114 
115  /// Initializes the instance
116  /// as a copy of the other one.
118  const HandlerSettings& other)
119  : SettingGroup()
120  , channel_(
121  other.channel_)
122  , feeds_(
123  other.feeds_)
124  , session_(
125  other.session_)
126  , tradeProcessing_(
127  other.tradeProcessing_)
128  , bookManagement_(
129  other.bookManagement_)
130  , recoveryQueueMaxSize_(
131  other.recoveryQueueMaxSize_)
132  , instrumentCache_(
133  other.instrumentCache_)
134  , logging_(
135  other.logging_)
136  , listeners_(
137  other.listeners_)
138  {
139  }
140 
141  /// Cleans everything up.
143  {
144  }
145 
146  /// Identifies CME market data channel.
148  {
149  return channel_;
150  }
151 
152  /// Identifies CME market data channel.
153  void
156  {
157  controlAssignment
158  (
159  "Channel Id",
160  channel_,
161  value
162  );
163  }
164 
165  /// Reference to parameters related with feeds.
166  const
167  FeedSettings&
168  feeds() const
169  {
170  return feeds_;
171  }
172 
173  /// Reference to parameters related with feeds.
174  FeedSettings&
176  {
177  return feeds_;
178  }
179 
180  /// Settings affecting processing session.
183  {
184  return session_;
185  }
186 
187  /// Settings affecting processing session.
188  const
190  session() const
191  {
192  return session_;
193  }
194 
195  /// Listeners associated with the Handler.
198  {
199  return listeners_;
200  }
201 
202  /// Listeners associated with the Handler.
203  const
205  listeners() const
206  {
207  return listeners_;
208  }
209 
210  /// Indicates how trades are processed.
213  {
214  return tradeProcessing_;
215  }
216 
217  /// Defines how trades are processed.
218  void
220  TradeProcessing::Enum strategy)
221  {
222  controlAssignment
223  (
224  "Trade Processing Strategy",
225  tradeProcessing_,
226  strategy
227  );
228  }
229 
230  /// Reference to parameters affecting book management.
231  const
234  {
235  return bookManagement_;
236  }
237 
238  /// Reference to parameters affecting book management.
241  {
242  return bookManagement_;
243  }
244 
245  /// Maximum number of packets transmitted via
246  /// incremental feed to be hold in internal queue
247  /// while market state is recovered from snapshots.
248  ///
249  /// When Handler recovers order books from snapshots,
250  /// the given parameter limits the size of the internal
251  /// queue used by the Handler to keep packets coming from
252  /// incremental feeds. Upon reaching limit, newer packets
253  /// substitute older ones.
254  ///
255  /// @note The default value is 1000000.
256  UInt32
258  {
259  return recoveryQueueMaxSize_;
260  }
261 
262  /// Maximum number of packets to be hold in the internal
263  /// queue used by the Handler while processing incoming data.
264  void
266  UInt32 queueMaxSize)
267  {
268  controlAssignment
269  (
270  "Recovery Queue Max Size",
271  recoveryQueueMaxSize_,
272  queueMaxSize
273  );
274  }
275 
276  /// Path to the file where the Handler
277  /// must store security definitions for
278  /// further use instead of a live instrument
279  /// feed while recovering definitions due
280  /// to late join.
281  ///
282  /// If path is not defined, the Handler
283  /// will not cache instrument definitions.
284  ///
285  /// @note The default value is empty string.
286  ///
287  /// @warning If this option is activated, then
288  /// it is recommended to remove the cache file
289  /// weekly to start the trading week with the
290  /// fresh copy of security definitions.
291  const
292  std::string&
294  {
295  return instrumentCache_;
296  }
297 
298  /// Defines path to a file to be used as instrument definition cache.
299  ///
300  /// Instrument definition cache is used to recover instrument
301  /// definitions at the begining of market data processing session
302  /// without connecting to live instrument recovery feeds. Later,
303  /// the Handler puts the incoming instrument definitions received
304  /// via incremental feeds into the given file.
305  ///
306  /// @note The Handler may recover instrument definitions stored
307  /// in FIX (tag=value) format in a 'secdef.dat' file exposed by
308  /// the CME via public FTP. However, the file won't be updated
309  /// during further market data processing.
310  void
312  const std::string& filename)
313  {
314  controlAssignment
315  (
316  "Instrument Cache Path",
317  instrumentCache_,
318  filename
319  );
320  }
321 
322  /// Settings affecting logging.
325  {
326  return logging_;
327  }
328 
329  /// Settings affecting logging.
330  const
332  logging() const
333  {
334  return logging_;
335  }
336 
337 #if !defined (ONIXS_CMEMDH_NO_DEPRECATED)
338 
339  /// Parameters affecting logging at debug level.
340  ///
341  /// @warning The given member is deprecated.
342  /// Use logging().debug() member to manipulate
343  /// parameters affecting the debug level output.
346  {
347  return logging_.debug();
348  }
349 
350  /// Parameters affecting logging at debug level.
351  ///
352  /// @warning The given member is deprecated.
353  /// Use logging().debug() member to manipulate
354  /// parameters affecting the debug level output.
355  const
357  debugLogging() const
358  {
359  return logging_.debug();
360  }
361 
362 #endif // ONIXS_CMEMDH_NO_DEPRECATED
363 
364  /// Re-initializes as a copy of the other one.
366  operator =(
367  const HandlerSettings& other)
368  {
369  controlAssignment
370  (
371  "Handler Settings",
372  &HandlerSettings::assignNoControl,
373  *this,
374  other
375  );
376 
377  return *this;
378  }
379 };
380 
381 /// Serializes BBA tracking parameters into string.
382 ONIXS_CMEMDH_EXPORTED
383 void
384 toStr(
385  std::string&,
386  const HandlerSettings&);
387 
388 /// Serializes BBA tracking parameters into string.
389 inline
390 std::string
392  const
393  HandlerSettings& settings)
394 {
395  std::string str;
396 
397  toStr(str, settings);
398 
399  return str;
400 }
401 
402 /// Makes filename for instrument cache for the given channel.
403 ONIXS_CMEMDH_EXPORTED
404 std::string
406 
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:94
Handler&#39;s configuration settings.
const std::string & instrumentCache() const
void tradeProcessing(TradeProcessing::Enum strategy)
Defines how trades are processed.
void recoveryQueueMaxSize(UInt32 queueMaxSize)
UInt32 UInt32
uInt32.
Definition: Fields.h:247
UInt32 ChannelId
Identifies CME channel.
Definition: Domain.h:28
~HandlerSettings()
Cleans everything up.
std::string toStr(const HandlerSettings &settings)
Serializes BBA tracking parameters into string.
const BookManagement & bookManagement() const
Reference to parameters affecting book management.
ONIXS_CMEMDH_EXPORTED std::string makeInstrumentCacheFilename(ChannelId)
Makes filename for instrument cache for the given channel.
void channel(ChannelId value)
Identifies CME market data channel.
const DebugLoggingSettings & debug() const
const HandlerListeners & listeners() const
Listeners associated with the Handler.
Parameters affecting what&#39;s logged at a debug level.
bool value(Number &number, const MultiContainer &container, Tag tag)
const AdvancedSessionSettings & session() const
Settings affecting processing session.
BookManagement & bookManagement()
Reference to parameters affecting book management.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:152
Base services for settings grouped by a certain criteria.
Definition: SettingGroup.h:123
void instrumentCache(const std::string &filename)
HandlerListeners & listeners()
Listeners associated with the Handler.
FeedSettings & feeds()
Reference to parameters related with feeds.
const HandlerDebugLoggingSettings & debugLogging() const
HandlerSettings(const HandlerSettings &other)
const FeedSettings & feeds() const
Reference to parameters related with feeds.
LoggingSettings & logging()
Settings affecting logging.
AdvancedSessionSettings & session()
Settings affecting processing session.
HandlerSettings(SettingAssignController *controller=NULL)
Initializes parameters with default values.
Parameters affecting book management machinery.
const LoggingSettings & logging() const
Settings affecting logging.
TradeProcessing::Enum tradeProcessing() const
Indicates how trades are processed.
Defines different ways trades are processed.
ChannelId channel() const
Identifies CME market data channel.
HandlerDebugLoggingSettings & debugLogging()
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:156