OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.4.2
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  : licenseDirectory("")
123  , logDirectory("logs")
124  , logFileNamePrefix("log")
125  , logSettings(LogSettings::Default)
126  , logLevel(LogLevel::Info)
127  , useFeedA(true)
128  , useFeedB(true)
129  , maxPacketSize(1450)
130  , heartbeatInterval(20)
131  , lostPacketWaitTime(500)
132  , outOfOrderPacketMaxInterval(3)
133  , messagePoolSize(512000)
134  {
135  }
136 
137  /// Path to the license directory.
138  std::string licenseDirectory;
139 
140  /// Log files are stored in this directory.
141  std::string logDirectory;
142 
143  /// Template of log file name without extension.
144  std::string logFileNamePrefix ;
145 
146  /// Combine LogSettings enum values to configure the logger.
148 
149  /// Log verbosity.
150  ///
151  /// @note The default value is LogLevel::Info
153 
154  /// Specifies one or more network interfaces to use while joining the multicast group;
155  /// use semi-colon delimited list if more than one.
156  ///
157  /// On Linux the network interfaces is specified by its name, on Windows - by IP address.
158  ///
159  /// @note If the value is empty or absent then the default networking interface is used.
160  std::string networkInterface;
161 
162  /// Specifies one or more network interfaces to use while joining the multicast group A;
163  /// use semi-colon delimited list if more than one.
164  ///
165  /// On Linux the network interfaces is specified by its name, on Windows - by IP address.
166  ///
167  /// @note If the value is empty or absent then the networkInterface_ filled value is used.
168  std::string networkInterfaceA;
169 
170  /// Specifies one or more network interfaces to use while joining the multicast group B;
171  /// use semi-colon delimited list if more than one.
172  ///
173  /// On Linux the network interfaces is specified by its name, on Windows - by IP address.
174  ///
175  /// @note If the value is empty or absent then the networkInterface_ filled value is used.
176  std::string networkInterfaceB;
177 
178  /// Option to use feed A.
179  ///
180  /// @note The default value is 'true'.
181  bool useFeedA;
182 
183  /// Option to use feed B.
184  ///
185  /// @note The default value is 'true'.
186  bool useFeedB;
187 
188  /// Max size for network packet transmitted by Eurex.
189  ///
190  /// @note The default value is '1450'.
191  unsigned short maxPacketSize;
192 
193  /// Specifies maximal time interval between two
194  /// network packets. If no data is received during
195  /// specified time frame, corresponding warning is raised.
196  ///
197  /// Interval is measured in seconds.
198  ///
199  /// @note The default value is '20'.
200  unsigned int heartbeatInterval;
201 
202  /// Indicates for how long Handler should wait for
203  /// the packet before it's considered as totally lost.
204  ///
205  /// Due to unreliable nature of multicast, data transmitted by the Eurex T7
206  /// may come in order other than original or be completely lost. When
207  /// Handler receives packet with sequence number greater than expected,
208  /// it considers received data as out-of-order. If for a certain time
209  /// interval Handler receives missing data, Handler resumes normal data
210  /// processing. However, if no data is received for predefined time frame,
211  /// Handler considers missing data as lost and raises packet gap event.
212  /// Given parameter defines size of time interval Handler waits for missing
213  /// data.
214  /// @see 'outOfOrderPacketMaxInterval' parameter for more information.
215  ///
216  /// Time interval is measured in milliseconds.
217  ///
218  /// @note The default value is 500 milliseconds.
219  unsigned int lostPacketWaitTime;
220 
221  /// Defines value of threshold used by Handler to differ
222  /// out-of-order packets from gaps.
223  ///
224  /// Due to unreliable nature of multicast, packets transmitted by exchange
225  /// may be received in the order different to original. To differ the
226  /// case when Handler received out-of-order packets from the case when
227  /// some of packets were completely lost, Handler uses given parameter.
228  /// It defines size of interval for incoming packets starting from the
229  /// last received. Packet is considered as out-of-order if its sequence
230  /// number fits into interval [seqNumberOfLastReceivedPacket,
231  /// seqNumberOfLastReceivedPacket + outOfOrderPacketsMaxInterval].
232  /// In that case Handler waits for other packets to fulfill the incoming
233  /// sequence. If received packet has greater sequence number than
234  /// 'seqNumberOfLastReceivedPacket + outOfOrderPacketsMaxInterval',
235  /// then Handler makes a decision on packets lost and gap is reported.
236  ///
237  /// @note When out-of-order packet is received, Handler makes a decision
238  /// on data loss if either waiting time is over or if newly received packet
239  /// has sequence number greater than 'seqNumberOfLastReceivedPacket +
240  /// outOfOrderPacketMaxInterval'.
241  ///
242  /// @see 'lostPacketWaitTime' parameter for more information.
243  ///
244  /// @note The default value is '3'.
246 
247  /// Defines size of buffer in bytes for message caching.
248  ///
249  /// @note Default value is 512000 bytes.
250  unsigned int messagePoolSize;
251  };
252 
253  struct RdiHandlerSettings;
254  struct EmdiHandlerSettings;
255  struct MdiHandlerSettings;
256  struct EmdsHandlerSettings;
257 
258  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const RdiHandlerSettings& settings);
259  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const EmdiHandlerSettings& settings);
260  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const MdiHandlerSettings& settings);
261  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const EmdsHandlerSettings& settings);
262 
263  namespace EOBI
264  {
265  struct EobiHandlerSettings;
266  ONIXS_EUREX_EMDI_API std::ostream& operator << (std::ostream& stream, const EobiHandlerSettings& settings);
267  }
268 
269  /// RDI handler configuration settings.
271  {
272  /// Constructor.
274  : fastTemplatesFile("RDDFastTemplates-1.1.xml")
275  , startRecoveryOnPacketGap(false)
276  , useFullSnapshotCycle(true)
277  {
278  logFileNamePrefix = "OnixS.EurexRdiHandlerCpp";
279  }
280 
281  /// Path to EUREX FAST templates Xml file.
282  ///
283  /// @note The default value is "RDDFastTemplates-1.1.xml".
284  std::string fastTemplatesFile;
285 
286  /// Sets data interface technical configuration.
288 
289  /// Sets flag to start snasphot recovery on packet gap.
290  ///
291  /// @note Implementation of Pessimistic approach. Recovery is triggered immediately when observing
292  /// a missing PacketSeqNum without
293  /// decoding the entire message.
295 
296  /// Use full snapshot cycle.
297  ///
298  /// @note The default value is 'true'.
300 
301  /// Returns the string representation.
302  std::string toString() const
303  {
304  std::ostringstream out;
305  out << *this;
306  return out.str();
307  }
308  };
309 
310  /// EMDI handler configuration settings.
312  {
313  /// Constructor.
315  : fastTemplatesFile("EMDIFastTemplates-1.1.xml")
316  , buildInternalOrderBooks(true)
317  , startRecoveryOnPacketGap(false)
318  {
319  logFileNamePrefix = "OnixS.EurexEmdiHandlerCpp";
320  }
321 
322  /// Path to EUREX FAST templates Xml file.
323  ///
324  /// @note The default value is "EMDIFastTemplates-1.1.xml".
325  std::string fastTemplatesFile;
326 
327  /// Sets data interface technical configuration.
329 
330  /// Build internal books
332 
333  /// Sets flag to start snasphot recovery on packet gap.
334  ///
335  /// @note Implementation of Pessimistic approach. Recovery is triggered immediately when observing
336  /// a missing PacketSeqNum without
337  /// decoding the entire message.
339 
340  /// Returns the string representation.
341  std::string toString() const
342  {
343  std::ostringstream out;
344  out << *this;
345  return out.str();
346  }
347  };
348 
349  /// MDI handler configuration settings.
351  {
352  /// Constructor.
354  : fastTemplatesFile("MDIFastTemplates-1.1.xml")
355  , buildInternalOrderBooks(true)
356  , startRecoveryOnPacketGap(false)
357  {
358  logFileNamePrefix = "OnixS.EurexMdiHandlerCpp";
359  }
360 
361  /// Path to EUREX FAST templates Xml file.
362  ///
363  /// @note The default value is "MDIFastTemplates-1.1.xml".
364  std::string fastTemplatesFile;
365 
366  /// Sets data interface technical configuration.
367  ///
368  /// @note Snapshot feed is not used for MDI inteface, parameters will be ingnored.
370 
371  /// Build internal books
373 
374  /// Sets flag to start snasphot recovery on packet gap.
375  ///
376  /// @note Implementation of Pessimistic approach. Recovery is triggered immediately when observing
377  /// a missing PacketSeqNum without
378  /// decoding the entire message.
380 
381  /// Returns the string representation.
382  std::string toString() const
383  {
384  std::ostringstream out;
385  out << *this;
386  return out.str();
387  }
388  };
389 
390  /// EMDI handler configuration settings.
392  {
393  /// Constructor.
395  : fastTemplatesFile("emds71-1.1.xml ")
396  {
397  logFileNamePrefix = "OnixS.EurexEmdsHandlerCpp";
398  }
399 
400  /// Path to EUREX FAST templates Xml file.
401  ///
402  /// @note The default value is "emds71-1.1.xml".
403  std::string fastTemplatesFile;
404 
405  /// Sets Settlement prices feed technical configuration.
407 
408  /// Sets Open Interest prices feed technical configuration.
410 
411  /// Sets On-exchange trade prices feed technical configuration.
413 
414  /// Returns the string representation.
415  std::string toString() const
416  {
417  std::ostringstream out;
418  out << *this;
419  return out.str();
420  }
421  };
422 
423  namespace EOBI
424  {
425  /// EOBI handler configuration settings.
427  {
428  /// Constructor.
430  : HandlerSettings()
431  , buildInternalOrderBooks(true)
432  , startRecoveryOnPacketGap(false)
433  , maxBooksObjectAmount(100)
434  , bookDepth(10)
435  {
436  logFileNamePrefix = "OnixS.EurexEobiHandlerCpp";
437  }
438 
439  /// Sets data interface technical configuration.
441 
442  /// Build internal books
444 
445  /// Sets flag to start snasphot recovery on packet gap.
446  ///
447  /// @note Implementation of Pessimistic approach. Recovery is triggered immediately when observing
448  /// a missing PacketSeqNum without
449  /// decoding the entire message.
451 
452  /// Defines size of preallocated memory for Order Book. Default value is 100
454 
455  /// Sets max book depth for order books. Default value is 10.
456  unsigned bookDepth;
457 
458  /// Returns the string representation.
459  std::string toString() const
460  {
461  std::ostringstream out;
462  out << *this;
463  return out.str();
464  }
465  };
466  }
467  }
468  }
469 }
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.
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.
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.
ONIXS_EUREX_EMDI_API std::ostream & operator<<(std::ostream &stream, const FeedEngineSettings &settings)
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.