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