OnixS C++ CME Market Data Handler  5.3.0
API documentation
Getting Started

Inner Contents

 Adjusting Handler Settings
 
 Setting Up Feed Engine
 
 Handling Issues Like Errors and Warnings
 
 Market Data Processing Session
 
 Listening to Market Data
 
 Manipulating Books
 
 Trade Order Details
 
 Selecting Securities of Interest
 
 Using TCP Recovery Facility
 
 Logging Services
 
 Replaying Logs, PCAPs CME DataMine/Historical Data
 

Detailed Description

The SDK API is enclosed to the OnixS::CME::MDH namespace. The master OnixS/CME/MDH.h header file collects all header files for more convenience.

Following sections guide through the major steps to be done to succeed with market data processing.

Initializing and Licensing SDK

The SDK needs a valid license for successful execution. If the licensing subsystem is not able to find a valid license, it throws an exception at the initialization stage when the OnixS::CME::MDH::initialize is called. Also, a license is verified each time an attempt to start market data processing is done using the OnixS::CME::MDH::Handler::start member.

The OnixS::CME::MDH::InitializationSettings class exposes the OnixS::CME::MDH::InitializationSettings::licenseStore member which must be used to instruct the SDK where to look for a valid license. By default, the licensing services look for a license in the current directory of the application. However, by using the noted parameter, it is possible to specify another folder anywhere on the file system.

Note
The licensing subsystem looks for a valid license in the specified folder and selects the best one. If multiple licenses are available, it selects the most significant one (for example, a production license is selected instead of a trial one if both are available).

The following example demonstrates how to perform one-time initialization of the SDK services:

// Parameters for one-time initialization.
InitializationSettings settings;
// The folder in which the license is stored.
settings.licenseStore("license");
// Initializes all Handler services explicitly.

Constructing and Configuring the Handler

The OnixS::CME::MDH::Handler class encapsulates a market data processing machinery. The class is designed to process market data transmitted by the CME MDP in bounds of a single channel.

The OnixS::CME::MDH::HandlerSettings class contains all parameters controlling various aspects of market data processing. The OnixS::CME::MDH::HandlerSettings class provides access to the settings through the OnixS::CME::MDH::Handler::settings member.

The users can change settings affecting market data processing behavior at any time when the instance of the OnixS::CME::MDH::Handler class is not processing market data.

In most cases, default values are set for parameters defining the most likely behavior of the OnixS::CME::MDH::Handler instance. However, some parameters must be set explicitly before spawning market data processing:

Handler handler;
// The Handler uses the channel to find connectivity
// parameters in the connectivity configuration file.
handler.settings().channel(310);
// Identifies a file in which connectivity parameters stored.
// The Handler reads the file and extracts connection-related
// information for all feeds belonging to the chosen channel.
handler.settings().feeds().connectivityConfigurationFile("config.xml");

See Handler's Settings for more information on adjusting behavior of the Handler.

Binding a Feed Engine to the Handler

The OnixS::CME::MDH::NetFeedEngine class encapsulates machinery responsible for delivering market data from sources like the CME MDP to the Handler. Therefore, to succeed with market data processing, it is necessary to construct an instance of any of the Feed Engine implementations (the SDK provides a few ready-to-use implementations like the OnixS::CME::MDH::SocketFeedEngine one) and to bind it to the instance of the OnixS::CME::MDH::Handler class:

// Using the Feed Engine exposed by the SDK
// to receive market data from live CME MDP.
SocketFeedEngineSettings feSettings;
SocketFeedEngine feedEngine(feSettings);
handler.settings().feeds().engine(&feedEngine);

See Feed Engine for more details on Feed Engine.

Note
An instance of the OnixS::CME::MDH::Handler does not manage lifetime of the assiciated OnixS::CME::MDH::NetFeedEngine instance. Therefore, user's responsibility is to keep an instance of the OnixS::CME::MDH::NetFeedEngine class valid while it is bound to an instance of OnixS::CME::MDH::Handler class.

Logging Market Data and Other Events (Optional)

The Handler can log market data it processes and well as other important events which may take place during regular market data processing.

The OnixS::CME::MDH::Logger abstract class encapsulates the logging subsystem. The SDK provides various implementations of logging for different purposes. File-based logging is a satisfactory choice for the most cases.

Below is an example of how file based logging can be established:

FileLoggerSettings loggerSettings;
// Sets filename of log as it was used by older Handlers.
loggerSettings.filename(makeLogFilename(310));
// Defines which events are to be logged.
loggerSettings.severityLevel(LogSeverity::Debug);
// Initializes instance of the logger.
FileLogger logger(loggerSettings);
// Binds the logger to the Handler.
handler.settings().logging().logger(&logger);
Note
An instance of the OnixS::CME::MDH::Handler does not manage lifetime of the associated OnixS::CME::MDH::Logger instance. Therefore, user's responsibility is to keep an instance of the OnixS::CME::MDH::Logger class valid while it is bound to an instance of OnixS::CME::MDH::Handler class.

Subscribing to Market Data Events

Once an instance of the OnixS::CME::MDH::Handler is constructed and bound to an instance of the OnixS::CME::MDH::NetFeedEngine, market data processing can be started. In order to get the results of market data processing, it's necessary to subscribe to corresponding events to get the results of market data processing like updated order books.

See the Event Listeners topic concerning which events are exposed by the Handler and how to subscribe to a particular event.

Spawning Market Data Processing

As soon as the OnixS::CME::MDH::Handler class instance is configured, bound to a OnixS::CME::MDH::NetFeedEngine class instance and listeners for events are registered, market data processing can be initiated:

handler.start();
Note
The OnixS::CME::MDH::Handler::start member brings the Handler into the state of processing of incoming market data. However, the Feed Engine machinery must be executed to make market data coming into the Handler instance. Previously, most Feed Engine implementations included the execution layer implicitly by running working threads. Thus Feed Engine machinery was in running state since the construction of the Feed Engine implementation instance. Starting from the 5.3 Release, the Feed Engine machinery's implicit running by a pool of working threads was moved out of all implementations of the Feed Engine concept exposed by the SDK. Therefore, it's necessary to explicitly run the Feed Engine machinery either by invoking the OnixS::CME::MDH::NetFeedEngine::process member repeatedly or by using additional services like one offered by the OnixS::CME::MDH::FeedEngineThreads class. Once the Feed Engine machinery gets executed, market data and other related events are pushed to the instances of the OnixS::CME::MDH::Handler class linked to the Feed Engine.

The OnixS::CME::MDH::Handler::stop member must be called to accomplish market data processing by the Handler:

handler.stop();
Note
For more and up-to-date information on getting started aspects, see the GettingStarted sample from the samples collection available in the distribution package of the SDK.