A primary purpose of the OnixS::CME::MDH::Handler class is to process market data transmitted by MDP and to deliver the results to the user for further analysis and processing.
The Handler processes market data asynchronously and uses a concept of events and event listeners to notify a client code about a particular occasion like reception of security definition or direct book update.
For a better experience the SDK groups events and provides C++ classes with virtual members for each of those groups. Client code may override any or all members of each listener to implement its reaction for a particular event. For each listener the Handler exposes a special member like OnixS::CME::MDH::Handler::registerSecurityListener which allows associating an instance of the event listener with an appropriate group of events in bounds of a particular instance of the OnixS::CME::MDH::Handler class.
Starting with this major release, the SDK does not use pure virtual functions. Instead, each callback referring to a particular event has an empty body thus providing default (empty) behavior. That lets users override events they need thus making a code more clear and readable.
Associating event listener with an instance of the OnixS::CME::MDH::Handler class is also called subscribing to an event.
The table below describes primary groups of events exposed by the Handler as well as depicts correspondence between the events, interfaces for listeners and the OnixS::CME::MDH::Handler members to subscribe to an event group:
| Listener | Member to register listener | Description |
|---|---|---|
| OnixS::CME::MDH::HandlerListener | OnixS::CME::MDH::Handler::registerListener | Events triggered by the Handler during market data processing. Events reflect different stages of processing session like entering or leaving recovery cycle, recovery completion status and resuming real-time data processing. Previously, the Handler used a concept of state to inform subscribers about similar events. However, new events allow the subscribers to handle transitions better. For example, in case of recovery failure, previous generations of the Handler signaled on the end of recovery with the subsequent start of a new recovery loop. However, at the end of recovery, there was no possibility to determine whether recovery succeeded or restarted due to updates in a recovery loop or failed at all. In the new events recovery status is exposed via the new parameter of the OnixS::CME::MDH::RecoveryCompletionArgs type. |
| OnixS::CME::MDH::MarketDataListener | OnixS::CME::MDH::Handler::registerMarketDataListener | The Handler invokes members of the given listener when it begins or ends processing of various market data entities like a packet or a message. An important aspect, related with the given listener, is the fact that events are triggered only for market data accepted by the Handler and according to the rules defined by CME. THe Handler does not invoke members of the listener for any duplicated or out-of-order packets. The given listener provides additional flexibility for the users while implementing their trading strategies without requiring new groups of events.
|
| OnixS::CME::MDH::SecurityListener | OnixS::CME::MDH::Handler::registerSecurityListener | Members of the given listener are invoked to reflect security-related events like reception of trade, security status and order book update. Each member exposed by the given listener provides read-only access to security base attributes like its id, group, symbol and a security-level sequence number allowing to track correctness of processing market data referring to given security.
By default, members of given listener are invoked for each security available on a channel. However, it is possible to restrict callback invocation for a set of securities using OnixS::CME::MDH::Handler::selectInstruments member. See Selecting Securities of Interest for more information. |
| OnixS::CME::MDH::FeedListener | OnixS::CME::MDH::Handler::registerFeedListener | The OnixS::CME::MDH::FeedListener members are invoked by the Handler each time feed-related event occurs. Feeds are used by the Handler while processing market data transmitted by CME MDP. |