OnixS C++ eSpeed ITCH Market Data Handler  1.7.3
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 
22 #include <sstream>
23 #include <string>
24 #include <set>
25 #include <vector>
26 
30 
31 
33 
34 /// Service endpoint description
36 {
38  : port (0)
39  {}
40 
41  ServiceDescriptor (const std::string& a, unsigned p)
42  : address (a), port (p)
43  {}
44 
45  /// Ip address
46  std::string address;
47 
48  /// Port number
49  unsigned port;
50 
51  /// Compares with another instance.
52  bool operator == (const ServiceDescriptor& other) const
53  {
54  return address == other.address && port == other.port;
55  }
56 
57  /// Compares with another instance.
58  bool operator != (const ServiceDescriptor& other) const
59  {
60  return address != other.address || port != other.port;
61  }
62 
63  /// Returns true if the descriptor points to valid ip address
64  bool valid() const
65  {
66  return !address.empty() && port > 0;
67  }
68 };
69 
70 ONIXS_ESPEED_ITCH_API std::ostream& operator << (std::ostream& stream, const ServiceDescriptor& descriptor);
71 
72 /// Feed descriptor
74 {
75  /// Service A
77 
78  /// Service B
80 
81  /// Compares with another instance.
82  bool operator == (const FeedDescriptor& other) const
83  {
84  return serviceA == other.serviceA && serviceB == other.serviceB;
85  }
86 
87  /// Compares with another instance.
88  bool operator != (const FeedDescriptor& other) const
89  {
90  return serviceA != other.serviceA || serviceB != other.serviceB;
91  }
92 };
93 
94 ONIXS_ESPEED_ITCH_API std::ostream& operator << (std::ostream& stream, const FeedDescriptor& descriptor);
95 
96 /// Alias for symbol list
97 typedef std::set<std::string> Symbols;
98 
99 struct HandlerSettings;
100 
101 ONIXS_ESPEED_ITCH_API std::ostream& operator << (std::ostream& stream, const HandlerSettings& settings);
102 
103 /// Handler configuration settings.
105 {
106  /// Constructor.
108  : licenseString()
109  , licenseDirectory()
110  , logDirectory("logs")
111  , logFileNamePrefix("eSpeedItch")
112  , logSettings(LogSettings::Default)
113  , logLevel(LogLevel::Info)
114  , logFilePermissions(LogFilePermission::Default)
115  , heartbeatInterval(1)
116  , outOfOrderPacketMaxInterval(3)
117  , lostPacketWaitTime(100000)
118  , useFeedA(true)
119  , useFeedB(true)
120  , maxRetransmissionResponseTime(30)
121  , maxBooksObjectAmount(1000)
122  , buildInternalOrderBooks(false)
123  , maxPacketSize(1500)
124  , maxConnectingAttempts(3)
125  , minReconnectingTimeout(3)
126  , retransmissionMaxPacketNumber(10000)
127  {}
128 
129  /// License string.
130  std::string licenseString;
131 
132  /// Path to the license directory.
133  std::string licenseDirectory;
134 
135  /// Log files are stored in this directory.
136  std::string logDirectory;
137 
138  /// Template of log file name without extension.
139  std::string logFileNamePrefix ;
140 
141  /// Combine LogSettings enum values to configure the logger.
143 
144  /// Log verbosity.
145  ///
146  /// @note The default value is LogLevel::Info
148 
149  /// Log file permissions.
150  ///
151  /// @note The default value is ReadAll | WriteOwnerOnly
153 
154  /**
155  * Specifies one or more network interfaces to use while joining the multicast group; 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  */
161  std::string networkInterface;
162 
163  /**
164  * Specifies one or more network interfaces to use while joining the multicast group A; use semi-colon delimited list if more than one.
165  *
166  * On Linux the network interfaces is specified by its name, on Windows - by IP address.
167  *
168  * @note If the value is empty or absent then the networkInterface_ filled value is used.
169  */
170  std::string networkInterfaceA;
171 
172  /**
173  * Specifies one or more network interfaces to use while joining the multicast group B; use semi-colon delimited list if more than one.
174  *
175  * On Linux the network interfaces is specified by its name, on Windows - by IP address.
176  *
177  * @note If the value is empty or absent then the networkInterface_ filled value is used.
178  */
179  std::string networkInterfaceB;
180 
181  /// Specifies maximal time interval between two
182  /// network packets. If no data is received during
183  /// specified time frame, corresponding warning is raised.
184  ///
185  /// Interval is measured in seconds.
186  ///
187  /// @note The default value is '1'.
189 
190  /// Defines value of threshold used by Handler to differ
191  /// out-of-order packets from gaps.
192  ///
193  /// Due to unreliable nature of multicast, packets transmitted by exchange
194  /// may be received in the order different to original. To differ the
195  /// case when Handler received out-of-order packets from the case when
196  /// some of packets were completely lost, Handler uses given parameter.
197  /// It defines size of interval for incoming packets starting from the
198  /// last received. Packet is considered as out-of-order if its sequence
199  /// number fits into interval [seqNumberOfLastReceivedPacket,
200  /// seqNumberOfLastReceivedPacket + outOfOrderPacketsMaxInterval].
201  /// In that case Handler waits for other packets to fulfill the incoming
202  /// sequence. If received packet has greater sequence number than
203  /// 'seqNumberOfLastReceivedPacket + outOfOrderPacketsMaxInterval',
204  /// then Handler makes a decision on packets lost and gap is reported.
205  ///
206  /// @note When out-of-order packet is received, Handler makes a decision
207  /// on data loss if either waiting time is over or if newly received packet
208  /// has sequence number greater than 'seqNumberOfLastReceivedPacket +
209  /// outOfOrderPacketMaxInterval'.
210  ///
211  /// @see 'lostPacketWaitTime' parameter for more information.
212  ///
213  /// @note The default value is '3'.
215 
216  /// Indicates for how long Handler should wait for
217  /// the packet before it's considered as totally lost.
218  ///
219  /// Due to unreliable nature of multicast, data transmitted by MDP
220  /// may come in order other than original or be completely lost. When
221  /// Handler receives packet with sequence number greater than expected,
222  /// it considers received data as out-of-order. If for a certain time
223  /// interval Handler receives missing data, Handler resumes normal data
224  /// processing. However, if no data is received for predefined time frame,
225  /// Handler considers missing data as lost and raises packet gap event.
226  /// Given parameter defines size of time interval Handler waits for missing
227  /// data.
228  ///
229  /// @note When out-of-order packet is received, Handler makes a decision
230  /// on data loss if either waiting time is over or if newly received packet
231  /// has sequence number greater than 'seqNumberOfLastReceivedPacket +
232  /// outOfOrderPacketMaxInterval'.
233  ///
234  /// @see 'outOfOrderPacketMaxInterval' parameter for more information.
235  ///
236  /// Time interval is measured in microseconds (usec).
237  ///
238  /// @note The default value is '100000' (100 milliseconds).
240 
241  /// Option to use feed A.
242  ///
243  /// @note The default value is 'true'.
244  bool useFeedA;
245 
246  /// Option to use feed B.
247  ///
248  /// @note The default value is 'true'.
249  bool useFeedB;
250 
251  /// ITCH Live feed
253 
254  ///Retransmission feed
256 
257  /// Maximum timeout to wait retransmission responses (sec), default value is 30 sec.
259 
260  /// Defines size of prea-llocated memory for Order Book. Default value is 1000
261  unsigned int maxBooksObjectAmount;
262 
263  /// Build internal books
265 
266  /// Max size for network packet transmitted.
267  unsigned short maxPacketSize;
268 
269  /// GLIMPSE feed
271 
272  /// Specifies network interfaces to use while establishing tcp connection.
273  ///
274  /// On Linux the network interfaces is specified by its name, on Windows - by IP address.
275  ///
276  /// @note If the value is empty or absent then the default networking interface is used.
277  ///
279 
280  /// Username assigned for GLIMPSE
281  std::string glimpseUsername;
282 
283  /// Password assigned for GLIMPSE
284  std::string glimpsePassword;
285 
286  /// Max number of attempts to connect replay and recovery services, default value is 3
287  unsigned int maxConnectingAttempts;
288 
289  /// Minimum timeout value between attempts to connect replay and recovery services (sec), default value is 3 sec.
291 
292  /// Lost packets threshold when the Handler prefers retransmission
294 
295  /// Returns the string representation.
296  std::string toString() const
297  {
298  std::ostringstream out;
299  out << *this;
300  return out.str();
301  }
302 };
303 
#define ONIXS_ESPEED_ITCH_NAMESPACE_END
Definition: Bootstrap.h:31
#define ONIXS_ESPEED_ITCH_NAMESPACE_BEGIN
Definition: Bootstrap.h:27
LogSettings::Enum logSettings
Combine LogSettings enum values to configure the logger.
Service endpoint description.
std::string networkInterfaceA
bool operator==(const ServiceDescriptor &other) const
Compares with another instance.
unsigned int retransmissionMaxPacketNumber
Lost packets threshold when the Handler prefers retransmission.
HandlerSettings()
Constructor.
FeedDescriptor glimpseFeed
GLIMPSE feed.
unsigned int maxConnectingAttempts
Max number of attempts to connect replay and recovery services, default value is 3.
unsigned port
Port number.
unsigned short maxPacketSize
Max size for network packet transmitted.
Log level.
Definition: LogSettings.h:30
ONIXS_ESPEED_ITCH_API std::ostream & operator<<(std::ostream &stream, const ServiceDescriptor &descriptor)
ServiceDescriptor(const std::string &a, unsigned p)
std::string address
Ip address.
std::string logDirectory
Log files are stored in this directory.
ServiceDescriptor serviceB
Service B.
Handler configuration settings.
ServiceDescriptor serviceA
Service A.
std::string licenseString
License string.
std::set< std::string > Symbols
Alias for symbol list.
unsigned int maxRetransmissionResponseTime
Maximum timeout to wait retransmission responses (sec), default value is 30 sec.
unsigned int maxBooksObjectAmount
Defines size of prea-llocated memory for Order Book. Default value is 1000.
std::string glimpsePassword
Password assigned for GLIMPSE.
std::string toString() const
Returns the string representation.
unsigned int minReconnectingTimeout
Minimum timeout value between attempts to connect replay and recovery services (sec), default value is 3 sec.
std::string networkInterface
bool valid() const
Returns true if the descriptor points to valid ip address.
bool operator!=(const ServiceDescriptor &other) const
Compares with another instance.
std::string logFileNamePrefix
Template of log file name without extension.
UInt32 outOfOrderPacketMaxInterval
std::string networkInterfaceB
Log file read permissions.
Definition: LogSettings.h:96
bool buildInternalOrderBooks
Build internal books.
Feed descriptor.
FeedDescriptor retransmissionFeed
Retransmission feed.
std::string licenseDirectory
Path to the license directory.
FeedDescriptor itchFeed
ITCH Live feed.
std::string networkInterfaceForTcpServices
std::string glimpseUsername
Username assigned for GLIMPSE.
Logging options.
Definition: LogSettings.h:47
LogFilePermission::Enum logFilePermissions
LogLevel::Enum logLevel