OnixS C++ CME Market Data Handler  4.8.0.10
API documentation
Handler.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <string>
24 #include <memory>
25 
27 
29 
31 ONIXS_CMEMDH_EXPORTED_CLASS_DECL(TcpRecoveryService);
33 
34 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(HandlerListener);
36 
37 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(MarketDataListener);
38 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(SecurityListener);
39 
40 ONIXS_CMEMDH_LTWT_CLASS_DECL(HandlerSettings);
41 
42 ONIXS_CMEMDH_LTWT_CLASS_DECL(SessionSettings);
43 ONIXS_CMEMDH_LTWT_CLASS_DECL(ReplaySettings);
44 
45 ONIXS_CMEMDH_LTWT_CLASS_DECL(InstrumentSelection);
46 
48 
49 /// Encapsulates all the machinery related with market
50 /// data processing from CME Market Data Platform.
52 {
53  // Data processing workhorse.
54  ChannelModel* model_;
55 
56 public:
57  /// Initializes instance according to given settings.
58  explicit Handler(
59  const HandlerSettings&);
60 
61  /// Finalizes instance usage.
62  ~Handler();
63 
64  /// Configuration settings of given instance.
65  const HandlerSettings& settings() const;
66 
67  /// Logger currently used by the Handler.
68  Logger& logger();
69 
70  /// Filters instruments whose market data
71  /// is to be processed and events are to be
72  /// fired by the Handler.
73  ///
74  /// @warning Instrument selection can be updated
75  /// only when market data processing is not performed
76  /// by the Handler or upon successful instrument
77  /// recovery completion.
78  void
79  selectInstruments(
80  const InstrumentSelection&);
81 
82  /// Registers Handler events listener.
83  ///
84  /// Only single instance of listener can be associated with
85  /// the Handler. Registering new listener removes previous one.
86  /// Listener instance lifetime shall be not less than Handler's one.
87  ///
88  /// Listeners are to be associated before starting market data
89  /// processing - Handler must be in stopped state.
90  ///
91  /// @throw std::exception in case when handler is not in configurable state.
92  void
93  registerListener(
94  HandlerListener& listener);
95 
96  /// Registers feed event listener.
97  ///
98  /// Only single instance of listener can be associated with
99  /// the Handler. Registering new listener removes previous one.
100  /// Listener instance lifetime shall be not less than Handler's one.
101  ///
102  /// Listeners are to be associated before starting market data
103  /// processing - Handler must be in stopped state.
104  ///
105  /// @throw std::exception in case when handler is not in configurable state.
106  void
107  registerFeedListener(
108  FeedListener& listener);
109 
110  /// Registers market data processing listener.
111  ///
112  /// Only single instance of listener can be associated with
113  /// the Handler. Registering new listener removes previous one.
114  /// Listener instance lifetime shall be not less than Handler's one.
115  ///
116  /// Listeners are to be associated before starting market data
117  /// processing - Handler must be in stopped state.
118  ///
119  /// @throw std::exception in case when handler is not in configurable state.
120  void
121  registerMarketDataListener(
122  MarketDataListener& listener);
123 
124  /// Registers security events listener.
125  ///
126  /// Only single instance of listener can be associated with
127  /// the Handler. Registering new listener removes previous one.
128  /// Listener instance lifetime shall be not less than Handler's one.
129  ///
130  /// Listeners are to be associated before starting market data
131  /// processing - Handler must be in stopped state.
132  ///
133  /// @throw std::exception in case when handler is not in configurable state.
134  void
135  registerSecurityListener(
136  SecurityListener& listener);
137 
138  /// Binds Feed Engine to the Handler.
139  ///
140  /// Handler must be in stopped state.
141  ///
142  /// @throw std::exception in case when handler is not in configurable state.
143  void
144  bindFeedEngine(
145  FeedEngine& feedEngine);
146 
147  /// Binds TCP Recovery Service to the Handler.
148  ///
149  /// Handler must be in stopped state.
150  ///
151  /// @throw std::exception in case when handler is not in configurable state.
152  void
153  bindTcpRecovery(
154  TcpRecoveryService& tcpRecovery);
155 
156  /// Binds Logging Service to the Handler.
157  ///
158  /// Handler must be in stopped state.
159  ///
160  /// @throw std::exception in case when handler is not in configurable state.
161  void
162  bindLogger(
163  Logger& logger);
164 
165  /// Erases instrument definitions cache if used.
166  /// Handler will produce a new cache at next start.
167  void clearInstrumentCache();
168 
169  /// Starts market data processing according to given parameters.
170  void
171  start(
172  const SessionSettings&);
173 
174  /// Stops the Handler.
175  void stop();
176 
177  /// Processes market data stored in log
178  /// files according to specified settings.
179  void
180  replay(
181  const ReplaySettings&);
182 };
183 
Handler&#39;s configuration settings.
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:54
Listener for feed-related events.
Definition: FeedListener.h:38
Defines parameters which affect logs replay.
Definition: Replay.h:72
Callbacks invoked by Handler to expose market data entities.
#define ONIXS_CMEMDH_EXPORTED_CLASS
Definition: Bootstrap.h:62
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:168
#define ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(typeName)
Definition: Bootstrap.h:58
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:122
Abstraction of logger.
Definition: Logger.h:179
#define ONIXS_CMEMDH_INTERNAL_CLASS_DECL(typeName)
Definition: Bootstrap.h:70
Events raised by Handler while processing market data.
Manages processing machinery for market data received from feeds.
Definition: FeedEngine.h:366
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:172