OnixS C++ Eurex T7 Market and Reference Data (EMDI, MDI, RDI, EOBI) Handlers  16.1.1
API documentation
MdiHandler.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 MdiHandlerSettings;
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 ScaledSimpleInstrumentUpdateListener;
55 
56 
57  /// Eurex Market Data Interface Handler.
58  class ONIXS_EUREX_EMDI_API MdiHandler
59  {
60  public:
61  /// Performs instance initialization.
62  /// @param settings defines values for various options
63  /// which affect handler behavior like enabling logging
64  /// during execution of the handler.
65  explicit
66  MdiHandler (const MdiHandlerSettings& settings,
67  const std::string& = ONIXS_EUREX_EMDI_COMPILER_INFO);
68 
69  /// Finalizes the Handler.
70  virtual ~MdiHandler();
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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& 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  MdiHandler& registerScaledSimpleInstrumentUpdateListener (ScaledSimpleInstrumentUpdateListener* listener);
155 
156 
157  /// Assigns listener for Order Book updates received while executing handler.
158  /// It's permissible to change the listener multiple times during
159  /// handler's life-time, but only when handler is in disconnected state.
160  /// @throw OperationException if handler not disconnected.
161  MdiHandler& registerOrderBookListener (OrderBookListener* listener);
162 
163  /// Assigns listener for trades received while executing handler.
164  /// It's permissible to change the listener multiple times during
165  /// handler's life-time, but only when handler is in disconnected state.
166  /// @throw OperationException if handler not disconnected.
167  MdiHandler& registerTradeListener (TradeListener* listener);
168 
169  /// Set market segment to maximum number of price levels for the product map
170  ///
171  /// @note Should be provided if EmdiHandlerSettings::buildInternalOrderBooks is true.
172  MdiHandler& setMarketSegmentId2Depth(const MarketSegmentId2Depth& map);
173 
174  /// Set the Market Segment Id filtering values.
175  ///
176  /// @note The filter is inclusive.
177  MdiHandler& setMarketSegmentIdFilters (const MarketSegmentIdFilters& filters);
178 
179  /// Remove all filters.
180  MdiHandler& removeAllMarketSegmentIdFilters();
181 
182  /// Set the Security Id filtering values.
183  ///
184  /// @note The filter is inclusive.
185  MdiHandler& setSecurityIdFilters (const SecurityIdFilters& filters);
186 
187  /// Remove all filters.
188  MdiHandler& removeAllSecurityIdFilters();
189 
190  /// Binds Feed Engine to the Handler.
191  ///
192  /// Handler must be in stopped state.
193  ///
194  /// @throw OperationException in case when handler is not in configurable state.
195  MdiHandler& bindFeedEngine(FeedEngine& feedEngine);
196 
197  /// Start handler.
198  ///
199  /// @note This action is asynchronous.
200  /// @throw std::exception in case of unable to start.
201  void start ();
202 
203  /// Starts replaying previously logged data.
204  void start (const ReplayOptions& options);
205 
206  /// Stop handler.
207  void stop ();
208 
209  /// Replay pcap files.
210  void replayPcap (const ReplayOptions& options);
211 
212  /// Returns handler state.
213  HandlerState::Enum state () const;
214 
215  /// Logs the given user-level message to the handler log.
216  MdiHandler& log (LogLevel::Enum logLevel, const char* logMessage, size_t length);
217 
218  /// Logs the given user-level message to the handler log
219  MdiHandler& log (LogLevel::Enum logLevel, const char* logMessage);
220 
221  /// Logs the given user-level message to the handler log.
222  MdiHandler& log (LogLevel::Enum logLevel, const std::string& str);
223 
224  /// Returns the license expiration date.
225  const char* licenseExpirationDate () const;
226 
227  /// Returns Handler's version.
228  static const char* version ();
229 
230  private:
231  MdiHandler (const MdiHandler&); //no implementation
232  MdiHandler& operator = (const MdiHandler&); //no implementation
233 
234  private:
235  friend struct Implementation::PcapPeplayHelper;
236  struct Impl;
237  Impl* impl_;
238  };
239 
240  /// Replay pcap files.
241  ONIXS_EUREX_EMDI_API
242  void replayPcap (const std::vector<MdiHandler*>& handlers, const ReplayOptions& options);
243 
244  }
245  }
246 }
The Feed Engine machinery.
Definition: FeedEngine.h:103
MarketDepthTraits::MarketSegmentId2Depth MarketSegmentId2Depth
MDI handler configuration settings.
Eurex Market Data Interface Handler.
Definition: MdiHandler.h:58
Definition: Defines.h:30
FilteringTraits::MarketSegmentIdFilters MarketSegmentIdFilters
Defines params which affect replay.
Definition: Replay.h:82
ONIXS_EUREX_EMDI_API_DECL(class, Message)
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.
#define ONIXS_EUREX_EMDI_COMPILER_INFO
Definition: Compiler.h:35