OnixS C++ eSpeed ITCH Market Data Handler  1.7.3
API documentation
Handler.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 #include <set>
28 
30 
31 class ErrorListener;
32 class FeedEngine;
33 class WarningListener;
34 class MessageListener;
37 class OrderListener;
38 class TradeListener;
41 class OrderBookListener;
42 struct HandlerSettings;
43 struct ReplayOptions;
44 
45 /// eSpeed ITCH Market Data Handler class.
46 class ONIXS_ESPEED_ITCH_API Handler
47 {
48  public:
49  /// Performs instance initialization.
50  /// @param settings defines values for various options
51  /// which affect handler behavior like enabling logging
52  /// during execution of the handler.
53  Handler (const HandlerSettings& settings);
54 
55  /// Finalizes the Handler.
56  virtual ~Handler();
57 
58  /// Assigns listener for errors occurred while executing handler.
59  /// It's permissible to change the listener multiple times during
60  /// handler's life-time, but only when handler is in disconnected state.
61  /// @throw OperationException if handler not disconnected
62  void registerErrorListener (ErrorListener* listener);
63 
64  /// Assigns listener for warnings occurred while executing handler.
65  /// It's permissible to change the listener multiple times during
66  /// handler's life-time, but only when handler is in disconnected state.
67  /// @throw OperationException if handler not disconnected
68  void registerWarningListener (WarningListener* listener);
69 
70  /// Assigns listener for state change events occurred while executing handler.
71  /// It's permissible to change the listener multiple times during
72  /// handler's life-time, but only when handler is in disconnected state.
73  /// @throw OperationException if handler not disconnected.
74  void registerHandlerStateListener (HandlerStateListener* listener);
75 
76  /// Assigns listener for reference data events occurred while executing handler.
77  /// It's permissible to change the listener multiple times during
78  /// handler's life-time, but only when handler is in disconnected state.
79  /// @throw OperationException if handler not disconnected.
80  void registerReferenceDataListener(ReferenceDataListener* listener);
81 
82  /// Assigns listener for state change events occurred while executing handler.
83  /// It's permissible to change the listener multiple times during
84  /// handler's life-time, but only when handler is in disconnected state.
85  /// @throw OperationException if handler not disconnected.
86  void registerEventAndStateListener(EventAndStateListener* listener);
87 
88  /// Assigns listener for order events occurred while executing handler.
89  /// It's permissible to change the listener multiple times during
90  /// handler's life-time, but only when handler is in disconnected state.
91  /// @throw OperationException if handler not disconnected.
92  void registerOrderListener(OrderListener* listener);
93 
94  /// Assigns listener for trade events occurred while executing handler.
95  /// It's permissible to change the listener multiple times during
96  /// handler's life-time, but only when handler is in disconnected state.
97  /// @throw OperationException if handler not disconnected.
98  void registerTradeListener(TradeListener* listener);
99 
100  /// Assigns listener for indicative pricing events occurred while executing handler.
101  /// It's permissible to change the listener multiple times during
102  /// handler's life-time, but only when handler is in disconnected state.
103  /// @throw OperationException if handler not disconnected.
104  void registerInformationListener(InformationListener* listener);
105 
106  /// Assigns listener for broken trade events occurred while executing handler.
107  /// It's permissible to change the listener multiple times during
108  /// handler's life-time, but only when handler is in disconnected state.
109  /// @throw OperationException if handler not disconnected.
110  void registerBrokenTradeListener(BrokenTradeListener* listener);
111 
112  /// Assigns listener for state change events occurred while executing handler.
113  /// It's permissible to change the listener multiple times during
114  /// handler's life-time, but only when handler is in disconnected state.
115  /// @throw OperationException if handler not disconnected.
116  void registerMessageListener(MessageListener* listener);
117 
118  /// Assigns listener for state change events occurred while executing handler.
119  /// It's permissible to change the listener multiple times during
120  /// handler's life-time, but only when handler is in disconnected state.
121  /// @throw OperationException if handler not disconnected.
122  void registerOrderBookListener(OrderBookListener* listener);
123 
124  /// Set up Order BookId Filter
125  void setOrderBookIdFilter(const std::set<OrderBookId>& orderBookIdFilter);
126 
127  /// Binds Feed Engine to the Handler.
128  ///
129  /// Handler must be in stopped state.
130  ///
131  /// @throw OperationException in case when handler is not in configurable state.
132  void bindFeedEngine(FeedEngine& feedEngine);
133 
134  /// Start handler.
135  ///
136  /// @note This action is asynchronous.
137  /// @throw std::exception in case of unable to start.
138  void start ();
139 
140  /// Starts replaying previously logged data.
141  void start (const ReplayOptions& options);
142 
143  /// Stop handler.
144  void stop (bool wait);
145 
146  /// Returns handler state.
147  HandlerState::Enum state () const;
148 
149  /// Logs the given user-level message to the handler log.
150  void log (LogLevel::Enum logLevel, const char* logMessage, size_t length);
151 
152  /// Logs the given user-level message to the handler log
153  void log (LogLevel::Enum logLevel, const char* logMessage);
154 
155  /// Logs the given user-level message to the handler log.
156  void log (LogLevel::Enum logLevel, const std::string& str);
157 
158  /// Returns the license expiration date.
159  std::string licenseExpirationDate () const;
160 
161  /// Returns Handler's version.
162  static const char* version ();
163 
164  private:
165  Handler (const Handler&); //no implementation
166  Handler& operator = (const Handler&); //no implementation
167 
168  private:
169  struct Impl;
170  Impl* impl_;
171 };
172 
#define ONIXS_ESPEED_ITCH_NAMESPACE_END
Definition: Bootstrap.h:31
#define ONIXS_ESPEED_ITCH_NAMESPACE_BEGIN
Definition: Bootstrap.h:27
System Event Message Listener.
Enum
Defines the state that the handler is in.
Handler configuration settings.
Order Message Listener.
Definition: OrderListener.h:28
Indicative Pricing Message Listener.
eSpeed ITCH Market Data Handler class.
Definition: Handler.h:46
Broken Trade Message Listener.
Order Book listener.
Auxilary message listener.
Trade Message Listener.
Definition: TradeListener.h:28
Defines options which affect logs replay.
Definition: Replay.h:55
Reference Data Message Listener.
Manages processing machinery for market data received from feeds.
Definition: FeedEngine.h:254