OnixS Xetra MDI Market Data Handler for C++  1.0.0.0
Listening to Market Data

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::Xetra::MarketData::MDI::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::Xetra::MarketData::MDI::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::Xetra::MarketData::MDI::Handler class.

Note
Associating listener for a particular event with an instance of the OnixS::Xetra::MarketData::MDI::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::Xetra::MarketData::MDI::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::Xetra::MarketData::MDI::SecurityDefinitionListener OnixS::Xetra::MarketData::MDI::Handler::registerSecurityDefinitionListener
Market Data Update Received (Streaming Market Mode) OnixS::Xetra::MarketData::MDI::CurrentMarketListener OnixS::Xetra::MarketData::MDI::Handler::registerCurrentMarketListener
Market Data Update Received (Streaming Market Level 2 Mode) OnixS::Xetra::MarketData::MDI::Level2Listener OnixS::Xetra::MarketData::MDI::Handler::registerLevel2Listener

Example

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

class MyListener : SecurityDefinitionListener
{
public:
    MyListener(Handler& handler)
    {
        handler.registerSecurityDefinitionListener(this);
    }

private:
    virtual void onSecurityDefinitionCycleStart()
    {
    }

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

    virtual void onSecurityDefinitionCycleEnd() 
    {
    }
};

...

HandlerSettings handlerSettings;

// HandlerSettings initialization goes here.
...

Handler handler(handlerSettings);

MyListener listener(handler);

handler.start();

...
Note
More information can be found in GettingStarted sample