OnixS CBOE CSM Handler for C++
Listening to Market Data
Getting Started

Events in the Handler

Once the handler is started, it listens to a market data from the network, processes it (validates packet order, decodes messages, updates order books) and invokes client code for further processing.

The handler processes market data asynchronously and uses concept of events and event listeners to notify client code about a particular occasion like reception of security definition or market data update.

Listening for a particular Event

For each event like Error Occurred the handler provides an interface (C++ class with pure virtual members) like OnixS::CBOE::MarketData::CSM::ErrorListener. Client code must implement this interface (C++ class) to be able to handle events of a particular type. THe handler also exposes a member like OnixS::CBOE::MarketData::CSM::Handler::registerErrorListener which allows to associate an instance of the event handler with a appropriate event in bounds of a particular instance of the OnixS::CBOE::MarketData::CSM::Handler class.

Associating listener for a particular event with an instance of the OnixS::CBOE::MarketData::CSM::Handler class must be performed while the handler is in stopped stated. Once the handler is started, changing listener-event associations is not allowed and may lead to unpredictable behavior as well as may cause unexpected errors.

Associating event listener with an instance of the OnixS::CBOE::MarketData::CSM::Handler class is also called subscribing to an event.

Primary High-level Events

There are multiple events exposed by the handler. All events can be logically divided onto high- and low- level event sub-set. High-level events reflect various results of market data processing done by the handler like Security Definition Received, Order Book Updated and Current Market Update Received. Low-level events are designed for more control over data processing as well for more flexibility and described in different section of this documentation including advanced-programming section.

Below table describes primary high-level events exposed by the handler as well as depicts correspondence between events, interfaces for listeners and the handler's members to subscribe to an event:

Event Listener (C++ class) to be implemented Handler's member to register listener
Security Definition Received OnixS::CBOE::MarketData::CSM::SecurityDefinitionListener OnixS::CBOE::MarketData::CSM::Handler::registerSecurityDefinitionListener
Market Data Update Received (Streaming Market Mode) OnixS::CBOE::MarketData::CSM::CurrentMarketListener OnixS::CBOE::MarketData::CSM::Handler::registerCurrentMarketListener
Market Data Update Received (Streaming Market Level 2 Mode) OnixS::CBOE::MarketData::CSM::Level2Listener OnixS::CBOE::MarketData::CSM::Handler::registerLevel2Listener


Following sample demonstrates how to listen to notifications about security definition reception:

class MyListener : SecurityDefinitionListener
    MyListener(Handler& handler)

    virtual void onSecurityDefinitionCycleStart()

    virtual void onSecurityDefinition(const SecurityDefinition& definition, const DataSource& dataSource)

    virtual void onSecurityDefinitionCycleEnd() 


HandlerSettings handlerSettings;

// HandlerSettings initialization goes here.

Handler handler((Handler::Csm, handlerSettings);

MyListener listener(handler);


More information can be found in GettingStarted sample