OnixS C++ CME Market Data Handler  4.4.1
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 Log Files
 

Detailed Description

All Handler classes are encapsulated into the OnixS::CME::MDH namespace. Header files are collected in the master OnixS/CME/MDH.h header file for more convenience.

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

Initializing and Licensing SDK

SDK needs a valid license for successful execution. If SDK licensing services are not able to find a valid license exception will be thrown at the initialization stage when OnixS::CME::MDH::initialize is called and each time attempt to start live market data processing using OnixS::CME::MDH::Handler::start member.

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

Note
SDK looks for a valid license in the specified folder and selects the best one. If multiple license available, it will select most significant one (for example, production instead of trial if both are available).

Following example demonstrates how perform one-time SDK initialization:

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

Configuring and Constructing the Handler

Market data processing machinery is incapsulated in the OnixS::CME::MDH::Handler class. Single instance of the OnixS::CME::MDH::Handler processes market data for a CME channel.

Before instance of the OnixS::CME::MDH::Handler class can be construct, settings affecting its behavior are to be defined.

All parameters controling varios aspects of market data processing and behavior of the OnixS::CME::MDH::Handler are gathered into OnixS::CME::MDH::HandlerSettings class.

For the most cases default parameter values are set defining most likeble behavior of the OnixS::CME::MDH::Handler instance. However, some parameters are to set before moving to OnixS::CME::MDH::Handler instance construction.

HandlerSettings settings;
settings.channel(310);
settings.
feeds().
connectivityConfigurationFile("config.xml");
Handler handler(settings);

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

Binding Feed Engine to the Handler

Network layer responsible for receiving market data trasmitted by MDP is encapsulated into a OnixS::CME::MDH::FeedEngine class. Therefore, to have successfull market data processing from live MDP environment, it's necessary to construct instance of the Feed Engine and bind it to the previously constructed instance of OnixS::CME::MDH::Handler class:

FeedEngineSettings feSettings;
FeedEngine feedEngine(feSettings);
handler.bindFeedEngine(feedEngine);

See Feed Engine for more details on Feed Engine.

Note
OnixS::CME::MDH::Handler does not manage life-time of binded OnixS::CME::MDH::FeedEngine instance. Therefore, keeping instance of OnixS::CME::MDH::FeedEngine valid while it's binded to the instance of OnixS::CME::MDH::Handler is fully user responsibility.

Logging Market Data and Other Events (Optional)

Handler may log market data it processes for further use by replay feature or analysis as well as other important events which may take place during regular market data processing.

Logging service is encapsulated into OnixS::CME::MDH::Logger abstraction. SDK provides various implementations of logging for different purposes. File-based logging is satisfactory choise 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));
// Varies which events are to be logged.
loggerSettings.severityLevel(LogSeverity::Debug);
FileLogger logger(loggerSettings);
handler.bindLogger(logger);
Note
OnixS::CME::MDH::Handler does not manage life-time of binded OnixS::CME::MDH::Logger instance. Therefore, keeping instance of OnixS::CME::MDH::Logger valid while it's binded to the instance of OnixS::CME::MDH::Handler is fully user responsibility.

Subscribing to Market Data Events

Once instance of OnixS::CME::MDH::Handler is constructed and binded to the instance of OnixS::CME::MDH::FeedEngine, market data processing can be spawned. However, to get results of market data processing like updated order books, it's necessary to subscribe to corresponding events.

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

Spawning Market Data Processing

As soon as instance of OnixS::CME::MDH::Handler is configured, binded to a valid instance of OnixS::CME::MDH::FeedEngine and listeners to events of interest are registered, market data processing can be initiated.

Market data processing by initiated by invoking OnixS::CME::MDH::Handler::start member, which accepts instance of OnixS::CME::MDH::SessionSettings class defining behavior of the Handler for the session.

For the most common processing scenarios, SDK exposes ready-to-use presets of session settings: OnixS::CME::MDH::AccurateLateJoinSession(), OnixS::CME::MDH::AccuratePreopeningSession, OnixS::CME::MDH::NaturalRefreshSession, etc. See documentation for noted classes for more details.

handler.start(AccurateLateJoinSession());

To accomplish live market data processing, OnixS::CME::MDH::Handler::stop member is to be called:

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