OnixS BME SENAF Handler C++ library  2.2.0
API documentation
Getting Started

Inner Contents

 Adjusting Handler Settings
 
 Listening to Market Data
 
 Replaying Log Files
 

Detailed Description

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

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

Configuring and Constructing the Handler

Market data processing machinery is incapsulated in the OnixS::Senaf::MarketData::Handler class. Single instance of the OnixS::Senaf::MarketData::Handler processes market data for multiple SENAF subscriptions.

Before an instance of the OnixS::Senaf::MarketData::Handler class can be constructed, settings affecting its behavior are to be defined.

All parameters controlling the varios aspects of market data processing and behavior of the OnixS::Senaf::MarketData::Handler are gathered into the OnixS::Senaf::MarketData::HandlerSettings class.

For most cases default parameter values are set defining the most likeable behavior of the OnixS::Senaf::MarketData::Handler instance. However, some parameters are to be set before moving to the OnixS::Senaf::MarketData::Handler instance construction.

Initializing and Licensing SDK

The SDK needs a valid license for successful execution. If an SDK licensing services are not be able to find a valid license, an exception will be thrown at the initialization stage when the OnixS::Senaf::MarketData::Handler constructor is called.

The OnixS::Senaf::MarketData::HandlerSettings class exposes the OnixS::Senaf::MarketData::HandlerSettings::licenseDirectory for instruction to 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 a multiple license is available, it will select the most significant one (for example, production instead of trial if both are available).

The following example demonstrates how initialization works:

// Parameters for initialization.
HandlerSettings settings;
// The folder in which the license is stored.
settings.licenseDirectory = "license";
// Create an instance of Handler.
Handler handler(settings);

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

Logging Market Data and Other Events (Optional)

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

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:

HandlerSettings handlerSettings;
// Sets filename of log as it was used by older Handlers.
handlerSettings.logFileNamePrefix = "log";
// Varies which events are to be logged.
handlerSettings.logLevel = LogLevel::Debug;
// Varies which events are to be logged.
handlerSettings.advancedLogOptions = AdvancedLogOptions::TraceToFile | AdvancedLogOptions::Async;

Subscribing to Market Data Events

Once instance of OnixS::Senaf::MarketData::Handler is constructed, market data processing can be spawned. However, to get the results of market data processing like received messages, it's necessary to subscribe to the 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::Senaf::MarketData::Handler is configured and listeners to events of interest are registered, market data processing can be initiated.

Market data processing is initiated by invoking the OnixS::Senaf::MarketData::Handler::start method.

handler.start();

To accomplish live market data processing, OnixS::Senaf::MarketData::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.