OnixS C++ CME Market Data Handler  5.7.0
API documentation
Listening to Market Data

The Handler class's primary purpose is to process market data transmitted by the MDP and deliver the results to the user for further analysis and processing.

The Handler uses a concept of events and event listeners to notify a client code about a particular occasion like the reception of security definition or direct book update.

Listening to Events

For a better experience, the SDK groups all events and provides C++ classes with virtual members for each of those groups. Client code may override any or all listener members to implement its reaction for a particular event. For each listener, the Handler exposes a particular parameter like the OnixS::CME::MDH::HandlerListeners::security which allows associating an event listener with an appropriate group of events for a particular instance of the OnixS::CME::MDH::Handler class.

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 code more clear and readable.

Associating listener for a particular event group with an instance of the OnixS::CME::MDH::Handler class must be performed while the Handler is in the stopped state. Once the market data processing is started, assigning event listeners associations is not allowed and leads to throwing an exception.

Associating event listener with an instance of the OnixS::CME::MDH::Handler class is also called subscribing to events.

Primary High-level Events

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 settings path to subscribe to the chosen event group:

Listener Listener Parameter Description


Path in the Handler's settings: handler.settings().listeners().handler(&listener)

The Handler triggers the given events during market data processing. Events reflect different processing session stages like entering or leaving the recovery cycle, recovery completion status (OnixS::CME::MDH::RecoveryCompletionArgs), and resuming real-time data processing.


Path in the Handler's settings: handler.settings().listeners().marketData(&listener)

The Handler invokes the given listener members when it begins or ends processing various market data entities like a packet or a message.

An important aspect related to the given listener is that events are triggered only for market data accepted by the Handler and according to CME's rules. 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 events.



Path in the Handler's settings: handler.settings().listeners().security(&listener)

Members of the given listener are invoked to reflect security-related events like the 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 for tracking correctness of processing market data referring to the given security.

By default, members of the given listener are invoked for each security available on the channel. However, it is possible to restrict callback invocation for a set of securities using the OnixS::CME::MDH::Handler::selectInstruments member. See Selecting Securities of Interest for more information.



Path in the Handler's settings: handler.settings().listeners().feeds(&listener)

The OnixS::CME::MDH::ChannelFeedListener members are invoked by the Handler each time a feed-related event occurs. Feeds are used by the Handler while processing market data transmitted by CME MDP.