OnixS C++ Eurex T7 Market and Reference Data (EMDI, MDI, RDI, EOBI) Handlers  16.0.1
API documentation
EmdiHandler.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 
26 
27 namespace OnixS
28 {
29  namespace Eurex
30  {
31  namespace MarketData
32  {
33  ONIXS_EUREX_EMDI_API_DECL(class, FeedEngine);
34 
35  struct ReplayOptions;
36  struct EmdiHandlerSettings;
37 
38  class CrossRequestListener;
39  class FlexibleInstrumentUpdateListener;
40  class HandlerStateListener;
41  class InstrumentStateChangeListener;
42  class InterfaceDescriptorProvider;
43  class MassInstrumentStateChangeListener;
44  class OrderBookListener;
45  class TopOfBookImpliedListener;
46  class ProductStateChangeListener;
47  class QuoteRequestListener;
48  class TradeListener;
49  class WarningListener;
50  class DepthListener;
51  class ComplexInstrumentUpdateListener;
52  class ErrorListener;
53  class CachedDepthIncrementalListener;
54  class BeaconListener;
55  class FeedActivityListener;
56  class ScaledSimpleInstrumentUpdateListener;
57 
58  /// Eurex Enhanced Market Data Interface Handler.
59  class ONIXS_EUREX_EMDI_API EmdiHandler
60  {
61  public:
62  /// Performs instance initialization.
63  /// @param settings defines values for various options
64  /// which affect handler behavior like enabling logging
65  /// during execution of the handler.
66  explicit EmdiHandler (const EmdiHandlerSettings& settings,
67  const std::string& = ONIXS_EUREX_EMDI_COMPILER_INFO);
68 
69  /// Finalizes the Handler.
70  virtual ~EmdiHandler();
71 
72  /// Assigns listener for errors occurred while executing handler.
73  /// It's permissible to change the listener multiple times during
74  /// handler's life-time, but only when handler is in disconnected state.
75  /// @throw OperationException if handler not disconnected
76  EmdiHandler& registerErrorListener (ErrorListener* listener);
77 
78  /// Assigns listener for warnings occurred while executing handler.
79  /// It's permissible to change the listener multiple times during
80  /// handler's life-time, but only when handler is in disconnected state.
81  /// @throw OperationException if handler not disconnected
82  EmdiHandler& registerWarningListener (WarningListener* listener);
83 
84  /// Assigns listener for state change events occurred while executing handler.
85  /// It's permissible to change the listener multiple times during
86  /// handler's life-time, but only when handler is in disconnected state.
87  /// @throw OperationException if handler not disconnected.
88  EmdiHandler& registerHandlerStateListener (HandlerStateListener* listener);
89 
90  /// Assigns listener for depth messages received while executing handler.
91  /// It's permissible to change the listener multiple times during
92  /// handler's life-time, but only when handler is in disconnected state.
93  /// @throw OperationException if handler not disconnected.
94  EmdiHandler& registerDepthListener (DepthListener* listener);
95 
96  /// Assigns listener for depth incremental messages received during recovery process.
97  /// It's permissible to change the listener multiple times during
98  /// handler's life-time, but only when handler is in disconnected state.
99  /// @throw OperationException if handler not disconnected.
100  EmdiHandler& registerCachedDepthIncrementalListener (CachedDepthIncrementalListener* listener);
101 
102  /// Assigns listener for Top Of Book Implied message received while executing handler.
103  /// It's permissible to change the listener multiple times during
104  /// handler's life-time, but only when handler is in disconnected state.
105  /// @throw OperationException if handler not disconnected.
106  EmdiHandler& registerTopOfBookImpliedListener (TopOfBookImpliedListener* listener);
107 
108  /// Assigns listener for Product State Change message received while executing handler.
109  /// It's permissible to change the listener multiple times during
110  /// handler's life-time, but only when handler is in disconnected state.
111  /// @throw OperationException if handler not disconnected.
112  EmdiHandler& registerProductStateChangeListener (ProductStateChangeListener* listener);
113 
114  /// Assigns listener for Mass Instrument State Change message received while executing handler.
115  /// It's permissible to change the listener multiple times during
116  /// handler's life-time, but only when handler is in disconnected state.
117  /// @throw OperationException if handler not disconnected.
118  EmdiHandler& registerMassInstrumentStateChangeListener (MassInstrumentStateChangeListener* listener);
119 
120  /// Assigns listener for Instrument State Change message received while executing handler.
121  /// It's permissible to change the listener multiple times during
122  /// handler's life-time, but only when handler is in disconnected state.
123  /// @throw OperationException if handler not disconnected.
124  EmdiHandler& registerInstrumentStateChangeListener (InstrumentStateChangeListener* listener);
125 
126  /// Assigns listener for Quote Request message received while executing handler.
127  /// It's permissible to change the listener multiple times during
128  /// handler's life-time, but only when handler is in disconnected state.
129  /// @throw OperationException if handler not disconnected.
130  EmdiHandler& registerQuoteRequestListener (QuoteRequestListener* listener);
131 
132  /// Assigns listener for Cross Request message received while executing handler.
133  /// It's permissible to change the listener multiple times during
134  /// handler's life-time, but only when handler is in disconnected state.
135  /// @throw OperationException if handler not disconnected.
136  EmdiHandler& registerCrossRequestListener (CrossRequestListener* listener);
137 
138  /// Assigns listener for Complex Instrument Update message received while executing handler.
139  /// It's permissible to change the listener multiple times during
140  /// handler's life-time, but only when handler is in disconnected state.
141  /// @throw OperationException if handler not disconnected.
142  EmdiHandler& registerComplexInstrumentUpdateListener (ComplexInstrumentUpdateListener* listener);
143 
144  /// Assigns listener for Flexible Instrument Update message received while executing handler.
145  /// It's permissible to change the listener multiple times during
146  /// handler's life-time, but only when handler is in disconnected state.
147  /// @throw OperationException if handler not disconnected.
148  EmdiHandler& registerFlexibleInstrumentUpdateListener (FlexibleInstrumentUpdateListener* listener);
149 
150  /// Assigns listener for Scaled Simple Instrument Update message received while executing handler.
151  /// It's permissible to change the listener multiple times during
152  /// handler's life-time, but only when handler is in disconnected state.
153  /// @throw OperationException if handler not disconnected.
154  EmdiHandler& registerScaledSimpleInstrumentUpdateListener (ScaledSimpleInstrumentUpdateListener* listener);
155 
156  /// Assigns listener for Order Book updates received while executing handler.
157  /// It's permissible to change the listener multiple times during
158  /// handler's life-time, but only when handler is in disconnected state.
159  /// @throw OperationException if handler not disconnected.
160  EmdiHandler& registerOrderBookListener (OrderBookListener* listener);
161 
162  /// Assigns listener for trades received while executing handler.
163  /// It's permissible to change the listener multiple times during
164  /// handler's life-time, but only when handler is in disconnected state.
165  /// @throw OperationException if handler not disconnected.
166  EmdiHandler& registerTradeListener (TradeListener* listener);
167 
168  /// Assigns listener for beacon messages received while executing handler.
169  /// It's permissible to change the listener multiple times during
170  /// handler's life-time, but only when handler is in disconnected state.
171  /// @throw OperationException if handler not disconnected.
172  EmdiHandler& registerBeaconListener (BeaconListener* listener);
173 
174  /// Assigns listener for feed activity events.
175  /// It's permissible to change the listener multiple times during
176  /// handler's life-time, but only when handler is in disconnected state.
177  /// @throw OperationException if handler not disconnected.
178  EmdiHandler& registerFeedActivityListener (FeedActivityListener* listener);
179 
180  /// Set market segment to maximum number of price levels for the product map
181  ///
182  /// @note Should be provided if EmdiHandlerSettings::buildInternalOrderBooks is true.
183  EmdiHandler& setMarketSegmentId2Depth(const MarketSegmentId2Depth& map);
184 
185  /// Set the Partition Id filtering values.
186  ///
187  /// @note The filter is inclusive.
188  EmdiHandler& setPartitionIdFilters (const PartitionIdFilters& filters);
189 
190  /// Remove all filters.
191  EmdiHandler& removeAllPartitionIdFilters();
192 
193  /// Set the Market Segment Id filtering values.
194  ///
195  /// @note The filter is inclusive.
196  EmdiHandler& setMarketSegmentIdFilters (const MarketSegmentIdFilters& filters);
197 
198  /// Remove all filters.
199  EmdiHandler& removeAllMarketSegmentIdFilters();
200 
201  /// Set the Security Id filtering values.
202  ///
203  /// @note The filter is inclusive.
204  EmdiHandler& setSecurityIdFilters (const SecurityIdFilters& filters);
205 
206  /// Remove all filters.
207  EmdiHandler& removeAllSecurityIdFilters();
208 
209  /// Binds Feed Engine to the Handler.
210  ///
211  /// Handler must be in stopped state.
212  ///
213  /// @throw OperationException in case when handler is not in configurable state.
214  EmdiHandler& bindFeedEngine(FeedEngine& feedEngine);
215 
216  /// Start handler.
217  ///
218  /// @note This action is asynchronous.
219  /// @throw std::exception in case of unable to start.
220  void start ();
221 
222  /// Starts replaying previously logged data.
223  void start (const ReplayOptions& options);
224 
225  /// Stop handler.
226  void stop ();
227 
228  /// Replay pcap files.
229  void replayPcap (const ReplayOptions& options);
230 
231  /// Returns handler state.
232  HandlerState::Enum state () const;
233 
234  /// Logs the given user-level message to the handler log.
235  EmdiHandler& log (LogLevel::Enum logLevel, const char* logMessage, size_t length);
236 
237  /// Logs the given user-level message to the handler log
238  EmdiHandler& log (LogLevel::Enum logLevel, const char* logMessage);
239 
240  /// Logs the given user-level message to the handler log.
241  EmdiHandler& log (LogLevel::Enum logLevel, const std::string& str);
242 
243  /// Returns the license expiration date.
244  const char* licenseExpirationDate () const;
245 
246  /// Returns Handler's version.
247  static const char* version ();
248 
249  private:
250  EmdiHandler (const EmdiHandler&); //no implementation
251  EmdiHandler& operator = (const EmdiHandler&); //no implementation
252 
253  private:
254  friend struct Implementation::PcapPeplayHelper;
255  struct Impl;
256  Impl* impl_;
257  };
258 
259  /// Replay pcap files.
260  ONIXS_EUREX_EMDI_API
261  void replayPcap (const std::vector<EmdiHandler*>& handlers, const ReplayOptions& options);
262  }
263  }
264 }
The Feed Engine machinery.
Definition: FeedEngine.h:103
MarketDepthTraits::MarketSegmentId2Depth MarketSegmentId2Depth
FilteringTraits::PartitionIdFilters PartitionIdFilters
Definition: Defines.h:30
FilteringTraits::MarketSegmentIdFilters MarketSegmentIdFilters
Defines params which affect replay.
Definition: Replay.h:82
EMDI handler configuration settings.
ONIXS_EUREX_EMDI_API_DECL(class, Message)
Eurex Enhanced Market Data Interface Handler.
Definition: EmdiHandler.h:59
FilteringTraits::SecurityIdFilters SecurityIdFilters
Enum
Defines the state that the handler is in.
void replayPcap(const std::vector< EmdiHandler * > &handlers, const ReplayOptions &options)
Replay pcap files.
Provides notifications about feed activity events.
#define ONIXS_EUREX_EMDI_COMPILER_INFO
Definition: Compiler.h:35