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