OnixS C++ CME Market Data Handler  4.8.0.10
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 
28 
31 
33 
35 
37 
38 /// Handler's configuration settings.
40 {
41  ChannelId channel_;
42 
43  FeedSettings feeds_;
44 
45  TradeProcessing::Enum tradeProcessing_;
46  BookManagement bookManagement_;
47 
48  UInt32 recoveryQueueMaxSize_;
49  std::string instrumentCache_;
50 
51  HandlerDebugLoggingSettings debugLogging_;
52 
53  MemoryPoolSettings memoryPool_;
54 
55 public:
56  /// Initializes parameters with default values.
58  : channel_(0)
59  , tradeProcessing_(
60  TradeProcessing::SummaryLevel)
61  , recoveryQueueMaxSize_(1000000)
62  {
63  }
64 
65  /// Cleans everything up.
67  {
68  }
69 
70  /// Identifies CME market data channel.
72  {
73  return channel_;
74  }
75 
76  /// Identifies CME market data channel.
77  void channel(ChannelId value)
78  {
79  channel_ = value;
80  }
81 
82  /// Reference to parameters related with feeds.
83  const
84  FeedSettings&
85  feeds() const
86  {
87  return feeds_;
88  }
89 
90  /// Reference to parameters related with feeds.
91  FeedSettings&
93  {
94  return feeds_;
95  }
96 
97  /// Indicates how trades are processed.
100  {
101  return tradeProcessing_;
102  }
103 
104  /// Defines how trades are processed.
105  void
107  TradeProcessing::Enum strategy)
108  {
109  tradeProcessing_ = strategy;
110  }
111 
112  /// Reference to parameters affecting book management.
113  const
116  {
117  return bookManagement_;
118  }
119 
120  /// Reference to parameters affecting book management.
123  {
124  return bookManagement_;
125  }
126 
127  /// Maximum number of packets transmitted via
128  /// incremental feed to be hold in internal queue
129  /// while market state is recovered from snapshots.
130  ///
131  /// When Handler recovers order books from snapshots,
132  /// the given parameter limits the size of the internal
133  /// queue used by the Handler to keep packets coming from
134  /// incremental feeds. Upon reaching limit, newer packets
135  /// substitute older ones.
136  ///
137  /// @note The default value is 1000000.
138  UInt32
140  {
141  return recoveryQueueMaxSize_;
142  }
143 
144  /// Maximum number of packets to be hold in the internal
145  /// queue used by the Handler while processing incoming data.
146  void
148  UInt32 queueMaxSize)
149  {
150  recoveryQueueMaxSize_ = queueMaxSize;
151  }
152 
153  /// Path to the file where the Handler
154  /// must store security definitions for
155  /// further use instead of a live instrument
156  /// feed while recovering definitions due
157  /// to late join.
158  ///
159  /// If path is not defined, the Handler
160  /// will not cache instrument definitions.
161  ///
162  /// @note The default value is empty string.
163  ///
164  /// @warning If this option is activated, then
165  /// it is recommended to remove the cache file
166  /// weekly to start the trading week with the
167  /// fresh copy of security definitions.
168  const
169  std::string&
171  {
172  return instrumentCache_;
173  }
174 
175  /// Updates option to use file-based
176  /// caching of the security definitions.
177  void
179  const std::string& filename)
180  {
181  instrumentCache_ = filename;
182  }
183 
184  /// Parameters affecting logging at debug level.
187  {
188  return debugLogging_;
189  }
190 
191  /// Parameters affecting logging at debug level.
192  const
194  debugLogging() const
195  {
196  return debugLogging_;
197  }
198 
199  /// Parameters affecting behavior of memory pool
200  /// used by Handler while processing market data.
203  {
204  return memoryPool_;
205  }
206 
207  /// Parameters affecting behavior of memory pool
208  /// used by Handler while processing market data.
209  const
211  memoryPool() const
212  {
213  return memoryPool_;
214  }
215 };
216 
217 /// Serializes BBA tracking parameters into string.
218 ONIXS_CMEMDH_EXPORTED
219 void
220 toStr(
221  std::string&,
222  const HandlerSettings&);
223 
224 /// Serializes BBA tracking parameters into string.
225 inline
226 std::string
228  const HandlerSettings& settings)
229 {
230  std::string str;
231 
232  toStr(str, settings);
233 
234  return str;
235 }
236 
237 /// Makes filename for instrument cache for the given channel.
238 ONIXS_CMEMDH_EXPORTED
239 std::string
241 
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:110
MemoryPoolSettings & memoryPool()
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:189
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.
const MemoryPoolSettings & memoryPool() const
void channel(ChannelId value)
Identifies CME market data channel.
BookManagement & bookManagement()
Reference to parameters affecting book management.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:168
void instrumentCache(const std::string &filename)
FeedSettings & feeds()
Reference to parameters related with feeds.
const HandlerDebugLoggingSettings & debugLogging() const
Parameters affecting logging at debug level.
const FeedSettings & feeds() const
Reference to parameters related with feeds.
Parameters affecting book management machinery.
HandlerSettings()
Initializes parameters with default values.
TradeProcessing::Enum tradeProcessing() const
Indicates how trades are processed.
Parameters affecting what&#39;s logged at a debug level.
Defines different ways trades are processed.
ChannelId channel() const
Identifies CME market data channel.
HandlerDebugLoggingSettings & debugLogging()
Parameters affecting logging at debug level.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:172