OnixS C++ Eurex T7 Market and Reference Data (EMDI, MDI, RDI, EOBI) Handlers  16.1.0
API documentation
HandlerSettings.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
24 
25 #include <string>
26 #include <set>
27 #include <sstream>
28 
29 namespace OnixS
30 {
31  namespace Eurex
32  {
33  namespace MarketData
34  {
35  /// Service endpoint description
37  {
39  : port(0)
40  {}
41 
42  /// Ip address
43  std::string address;
44 
45  /// Port number
46  unsigned port;
47 
48 
49  /// clear config
50  void clear()
51  {
52  address.clear();
53  port = 0;
54  }
55 
56  /// checks whether descriptor is empty
57  bool empty() const
58  {
59  return address.empty() || (port == 0);
60  }
61 
62  /// Compares with another instance.
63  bool operator == (const ServiceDescriptor& other) const
64  {
65  return address == other.address && port == other.port;
66  }
67 
68  /// Compares with another instance.
69  bool operator != (const ServiceDescriptor& other) const
70  {
71  return address != other.address || port != other.port;
72  }
73  };
74 
75  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const ServiceDescriptor& descriptor);
76 
77  /// Feed descriptor
79  {
80  /// Service A
82 
83  /// Service B
85 
86  /// clear config
87  void clear()
88  {
89  serviceA.clear();
90  serviceB.clear();
91  }
92 
93  /// Compares with another instance.
94  bool operator == (const FeedDescriptor& other) const
95  {
96  return serviceA == other.serviceA && serviceB == other.serviceB;
97  }
98 
99  /// Compares with another instance.
100  bool operator != (const FeedDescriptor& other) const
101  {
102  return serviceA != other.serviceA || serviceB != other.serviceB;
103  }
104  };
105 
106  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const FeedDescriptor& descriptor);
107 
108  /// Interface descriptor
110  {
113  };
114 
115  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const InterfaceDescriptor& descriptor);
116 
117  /// Handler base configuration settings.
119  {
120  /// Constructor.
122  : licenseString("")
123  , licenseDirectory("")
124  , logDirectory("logs")
125  , logFileNamePrefix("log")
126  , logSettings(LogSettings::Default)
127  , logLevel(LogLevel::Info)
128  , useFeedA(true)
129  , useFeedB(true)
130  , maxPacketSize(1450)
131  , heartbeatInterval(20)
132  , lostPacketWaitTime(500)
133  , outOfOrderPacketMaxInterval(3)
134  , messagePoolSize(512000)
135  {
136  }
137 
138  /// License string.
139  std::string licenseString;
140 
141  /// Path to the license directory.
142  std::string licenseDirectory;
143 
144  /// Log files are stored in this directory.
145  std::string logDirectory;
146 
147  /// Template of log file name without extension.
148  std::string logFileNamePrefix ;
149 
150  /// Combine LogSettings enum values to configure the logger.
152 
153  /// Log verbosity.
154  ///
155  /// @note The default value is LogLevel::Info
157 
158  /// Specifies one or more network interfaces to use while joining the multicast group;
159  /// use semi-colon delimited list if more than one.
160  ///
161  /// On Linux the network interfaces is specified by its name, on Windows - by IP address.
162  ///
163  /// @note If the value is empty or absent then the default networking interface is used.
164  std::string networkInterface;
165 
166  /// Specifies one or more network interfaces to use while joining the multicast group A;
167  /// use semi-colon delimited list if more than one.
168  ///
169  /// On Linux the network interfaces is specified by its name, on Windows - by IP address.
170  ///
171  /// @note If the value is empty or absent then the networkInterface_ filled value is used.
172  std::string networkInterfaceA;
173 
174  /// Specifies one or more network interfaces to use while joining the multicast group B;
175  /// use semi-colon delimited list if more than one.
176  ///
177  /// On Linux the network interfaces is specified by its name, on Windows - by IP address.
178  ///
179  /// @note If the value is empty or absent then the networkInterface_ filled value is used.
180  std::string networkInterfaceB;
181 
182  /// Option to use feed A.
183  ///
184  /// @note The default value is 'true'.
185  bool useFeedA;
186 
187  /// Option to use feed B.
188  ///
189  /// @note The default value is 'true'.
190  bool useFeedB;
191 
192  /// Max size for network packet transmitted by Eurex.
193  ///
194  /// @note The default value is '1450'.
195  unsigned short maxPacketSize;
196 
197  /// Specifies maximal time interval between two
198  /// network packets. If no data is received during
199  /// specified time frame, corresponding warning is raised.
200  ///
201  /// Interval is measured in seconds.
202  ///
203  /// @note The default value is '20'.
204  unsigned int heartbeatInterval;
205 
206  /// Indicates for how long Handler should wait for
207  /// the packet before it's considered as totally lost.
208  ///
209  /// Due to unreliable nature of multicast, data transmitted by the Eurex T7
210  /// may come in order other than original or be completely lost. When
211  /// Handler receives packet with sequence number greater than expected,
212  /// it considers received data as out-of-order. If for a certain time
213  /// interval Handler receives missing data, Handler resumes normal data
214  /// processing. However, if no data is received for predefined time frame,
215  /// Handler considers missing data as lost and raises packet gap event.
216  /// Given parameter defines size of time interval Handler waits for missing
217  /// data.
218  /// @see 'outOfOrderPacketMaxInterval' parameter for more information.
219  ///
220  /// Time interval is measured in milliseconds.
221  ///
222  /// @note The default value is 500 milliseconds.
223  unsigned int lostPacketWaitTime;
224 
225  /// Defines value of threshold used by Handler to differ
226  /// out-of-order packets from gaps.
227  ///
228  /// Due to unreliable nature of multicast, packets transmitted by exchange
229  /// may be received in the order different to original. To differ the
230  /// case when Handler received out-of-order packets from the case when
231  /// some of packets were completely lost, Handler uses given parameter.
232  /// It defines size of interval for incoming packets starting from the
233  /// last received. Packet is considered as out-of-order if its sequence
234  /// number fits into interval [seqNumberOfLastReceivedPacket,
235  /// seqNumberOfLastReceivedPacket + outOfOrderPacketsMaxInterval].
236  /// In that case Handler waits for other packets to fulfill the incoming
237  /// sequence. If received packet has greater sequence number than
238  /// 'seqNumberOfLastReceivedPacket + outOfOrderPacketsMaxInterval',
239  /// then Handler makes a decision on packets lost and gap is reported.
240  ///
241  /// @note When out-of-order packet is received, Handler makes a decision
242  /// on data loss if either waiting time is over or if newly received packet
243  /// has sequence number greater than 'seqNumberOfLastReceivedPacket +
244  /// outOfOrderPacketMaxInterval'.
245  ///
246  /// @see 'lostPacketWaitTime' parameter for more information.
247  ///
248  /// @note The default value is '3'.
250 
251  /// Defines size of buffer in bytes for message caching.
252  ///
253  /// @note Default value is 512000 bytes.
254  unsigned int messagePoolSize;
255  };
256 
257  struct RdiHandlerSettings;
258  struct EmdiHandlerSettings;
259  struct MdiHandlerSettings;
260  struct EmdsHandlerSettings;
261 
262  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const RdiHandlerSettings& settings);
263  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const EmdiHandlerSettings& settings);
264  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const MdiHandlerSettings& settings);
265  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const EmdsHandlerSettings& settings);
266 
267  namespace EOBI
268  {
269  struct EobiHandlerSettings;
270  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const EobiHandlerSettings& settings);
271  }
272 
273  /// RDI handler configuration settings.
275  {
276  /// Constructor.
278  : startRecoveryOnPacketGap(false)
279  , useFullSnapshotCycle(true)
280  {
281  logFileNamePrefix = "OnixS.EurexRdiHandlerCpp";
282  }
283 
284  /// Sets data interface technical configuration.
286 
287  /// Sets flag to start snasphot recovery on packet gap.
288  ///
289  /// @note Implementation of Pessimistic approach. Recovery is triggered immediately when observing
290  /// a missing PacketSeqNum without
291  /// decoding the entire message.
293 
294  /// Use full snapshot cycle.
295  ///
296  /// @note The default value is 'true'.
298 
299  /// Returns the string representation.
300  std::string toString() const
301  {
302  std::ostringstream out;
303  out << *this;
304  return out.str();
305  }
306  };
307 
308  /// EMDI handler configuration settings.
310  {
311  /// Constructor.
313  : buildInternalOrderBooks(true)
314  , startRecoveryOnPacketGap(false)
315  {
316  logFileNamePrefix = "OnixS.EurexEmdiHandlerCpp";
317  }
318 
319  /// Sets data interface technical configuration.
321 
322  /// Build internal books
324 
325  /// Sets flag to start snasphot recovery on packet gap.
326  ///
327  /// @note Implementation of Pessimistic approach. Recovery is triggered immediately when observing
328  /// a missing PacketSeqNum without
329  /// decoding the entire message.
331 
332  /// Returns the string representation.
333  std::string toString() const
334  {
335  std::ostringstream out;
336  out << *this;
337  return out.str();
338  }
339  };
340 
341  /// MDI handler configuration settings.
343  {
344  /// Constructor.
346  : buildInternalOrderBooks(true)
347  , startRecoveryOnPacketGap(false)
348  {
349  logFileNamePrefix = "OnixS.EurexMdiHandlerCpp";
350  }
351 
352  /// Sets data interface technical configuration.
353  ///
354  /// @note Snapshot feed is not used for MDI interface, parameters will be ignored.
356 
357  /// Build internal books
359 
360  /// Sets flag to start snasphot recovery on packet gap.
361  ///
362  /// @note Implementation of Pessimistic approach. Recovery is triggered immediately when observing
363  /// a missing PacketSeqNum without
364  /// decoding the entire message.
366 
367  /// Returns the string representation.
368  std::string toString() const
369  {
370  std::ostringstream out;
371  out << *this;
372  return out.str();
373  }
374  };
375 
376  /// EMDI handler configuration settings.
378  {
379  /// Constructor.
381  {
382  logFileNamePrefix = "OnixS.EurexEmdsHandlerCpp";
383  }
384 
385  /// Sets Settlement prices feed technical configuration.
387 
388  /// Sets Open Interest prices feed technical configuration.
390 
391  /// Sets On-exchange trade prices feed technical configuration.
393 
394  /// Returns the string representation.
395  std::string toString() const
396  {
397  std::ostringstream out;
398  out << *this;
399  return out.str();
400  }
401  };
402 
403  namespace EOBI
404  {
405  /// EOBI handler configuration settings.
407  {
408  /// Constructor.
410  : HandlerSettings()
411  , buildInternalOrderBooks(true)
412  , startRecoveryOnPacketGap(false)
413  , maxBooksObjectAmount(100)
414  , bookDepth(10)
415  {
416  logFileNamePrefix = "OnixS.EurexEobiHandlerCpp";
417  }
418 
419  /// Sets data interface technical configuration.
421 
422  /// Build internal books
424 
425  /// Sets flag to start snasphot recovery on packet gap.
426  ///
427  /// @note Implementation of Pessimistic approach. Recovery is triggered immediately when observing
428  /// a missing PacketSeqNum without
429  /// decoding the entire message.
431 
432  /// Defines size of preallocated memory for Order Book. Default value is 100
434 
435  /// Sets max book depth for order books. Default value is 10.
436  unsigned bookDepth;
437 
438  /// Returns the string representation.
439  std::string toString() const
440  {
441  std::ostringstream out;
442  out << *this;
443  return out.str();
444  }
445  };
446  }
447  }
448  }
449 }
FeedDescriptor settlementFeedDescriptor
Sets Settlement prices feed technical configuration.
InterfaceDescriptor interfaceDescriptor
Sets data interface technical configuration.
FeedDescriptor openInterestFeedDescriptor
Sets Open Interest prices feed technical configuration.
MDI handler configuration settings.
InterfaceDescriptor interfaceDescriptor
Sets data interface technical configuration.
bool empty() const
checks whether descriptor is empty
ServiceDescriptor serviceA
Service A.
EMDI handler configuration settings.
ServiceDescriptor serviceB
Service B.
std::ostream & operator<<(std::ostream &os, const Message &message)
Handler base configuration settings.
Definition: Defines.h:30
unsigned bookDepth
Sets max book depth for order books. Default value is 10.
EMDI handler configuration settings.
std::string toString() const
Returns the string representation.
std::string logFileNamePrefix
Template of log file name without extension.
bool operator==(const ServiceDescriptor &other) const
Compares with another instance.
LogSettings::Enum logSettings
Combine LogSettings enum values to configure the logger.
bool operator!=(const ServiceDescriptor &other) const
Compares with another instance.
FeedDescriptor exchangeTradeFeedDescriptor
Sets On-exchange trade prices feed technical configuration.
RDI handler configuration settings.
EOBI handler configuration settings.
std::string licenseString
License string.
bool buildInternalOrderBooks
Build internal books.
std::string licenseDirectory
Path to the license directory.
std::string logDirectory
Log files are stored in this directory.
bool buildInternalOrderBooks
Build internal books.
Service endpoint description.
unsigned maxBooksObjectAmount
Defines size of preallocated memory for Order Book. Default value is 100.
std::string toString() const
Returns the string representation.
std::string toString() const
Returns the string representation.
std::string toString() const
Returns the string representation.
std::string toString() const
Returns the string representation.
InterfaceDescriptor interfaceDescriptor
Sets data interface technical configuration.