OnixS C++ CME MDP Premium Market Data Handler  5.8.7
API Documentation
Event listeners

The handler uses a concept of events and event listeners to notify the client code about various aspects of market data processing and deliver data to the user (e.g., receiving a security definition or a direct book update).

The SDK groups events and provides classes with virtual members (event listeners) for each group. Client code may override any or all listener members to implement the processing of a particular event.

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

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

Events groups

The table below describes events groups and shows the correspondence between the events, listeners and handler settings methods that are used to subscribe to events:

Listener Method Description


For example:

The handler invokes the event listener members during market data processing. Events reflect processing session stages like entering or leaving the recovery cycle, recovery completion status (OnixS::CME::MDH::RecoveryCompletionArgs), and resuming real-time data processing.


For example:


The handler invokes the event listener members when it begins or ends processing various market data entities (e.g., a packet or a message).

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.



For example:


Members of the given listener are invoked to reflect security-related events like the receiving of trade, security status, and order book updates.

By default, members of this 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.



For example:


The OnixS::CME::MDH::ChannelFeedListener members are invoked each time a feed-related event occurs.

The sample below demonstrates listening to Handler's events:

: public HandlerListener
, public MarketDataListener
, public SecurityListener
, public ChannelFeedListener
void onStarted(Handler&) override
std::cout << "Handler started." << std::endl;
void onStopped(Handler&) override
std::cout << "Handler stopped." << std::endl;
void onPacket(Handler&, const PacketArgs& args) override
std::cout << "A packet with sequence number " << args.seqNumber() << " is received." << std::endl;
void onBookUpdate(Handler&, const Security&, const ConsolidatedBook& book) override
std::cout << "A book is updated: " << brief(book) << std::endl;
void onFeedConnected(Handler&, const NetFeed& feed) override
std::cout << "Feed " << feed.id() << " is connected." << std::endl;
void onFeedDisconnected(Handler&, const NetFeed& feed) override
std::cout << "Feed " << feed.id() << " is disconnected." << std::endl;