OnixS C++ LSE GTP Market Data Handler 1.0.6
API documentation
Loading...
Searching...
No Matches
Getting Started

Inner Contents

 Setting Up Feed Engine
 Replaying Log Files

Detailed Description

C++ LSE GTP Market Data Handler is a C++ library that provides an access to the LSE GTP market data services. Handler encapsulates all low level aspects of the market data platform allowing focusing on implementing trading solutions and market data processing algorithms. High-level C++ API allows to quickly build applications to get market data without much involve into raw protocol specifics. C++ LSE GTP Market Data Handler is a C++ library that provides an access to the LSE GTP market data services. Handler encapsulates all low level aspects of the market data platform allowing focusing on implementing trading solutions and market data processing algorithms. High-level C++ API allows to quickly build applications to get market data without much involve into raw protocol specifics.

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

The typical way of using the Handler is as follows:

  • Create an instance of the Handler's settings.
  • Create an instance of the Handler class using the previously initialized instance of settings.
  • Register listener for errors and warnings to be notified about failures occurred while the Handler processes market data.
  • Register listeners for miscellaneous events.
  • Bind a FeedEngine instance.
  • Start market data processing by invoking the Handlers' start method.
  • Process data of the events for which listeners were previously registered.
  • Stop market data processing using the the Handler's stop method.

Configuring and Constructing the Handler

Handler's constructor accepts an instance of settings class which defines values for various parameters for determination the Handler's behavior. Role of the most important parameters that used in regular cases are described below.

Primary Settings

Directory for Log Files

By default, all the important aspects of the Handler's activity are logged. Therefore the Handler must know where this kind of information can be stored on a local file system. OnixS::LSE::MarketData::GTP::HandlerSettings::logDirectory parameter need be defined for pointing the Handlers place where log files to be stored.

Licensing

To run a Handler's instance it is required to have a license file. When the instance is not able to find a valid license it throws an exception at the initialization stage.

OnixS::LSE::MarketData::GTP::HandlerSettings contains OnixS::LSE::MarketData::GTP::HandlerSettings::licenseDirectory member which contains path to directory containing license file(s). If it's value is empty the Handler looks for the license file in current directory.

Note
When there is more than one license file in the license directory the most significant one is used (for example, a production instead of a trial if both are available).

Example

The following example demonstrates how to setup primary settings for OnixS::LSE::MarketData::GTP::Handler:

// Create an instance Handler's settings.
// This option is used to control verbosity of logger.
// This option is used to specify extra logger settings.
// Logs will be stored in 'logs' local sub folder.
settings.logDirectory = "logs";
// This option is used to instruct the Handler where to look for a valid license.
settings.licenseDirectory = "../../license";
// Set up IP addresses and port numbers for multicast feeds.
settings.realtimeMulticastFeed.serviceA.address = "239.255.1.1";
settings.realtimeMulticastFeed.serviceB.address = "239.255.1.2";
settings.useFeedA = true;
settings.useFeedB = true;
LSE GTP Market Data Handler class.
Definition Handler.h:45
std::string logDirectory
Log files are stored in this directory.
LogSettings::Enum logSettings
Combine LogSettings enum values to configure the logger.
FeedDescriptor realtimeMulticastFeed
Realtime feed.
std::string licenseDirectory
Path to the license directory.

Binding Feed Engine to the Handler

Network layer responsible for receiving market data transmitted by the exchange data interfaces is encapsulated into a OnixS::LSE::MarketData::GTP::FeedEngine class. Therefore, to have successful market data processing, it's necessary to construct an instance of the Feed Engine and bind it to the previously constructed instance of the Handler class:

SocketFeedEngine feedEngine;
handler.bindFeedEngine(feedEngine);

See Feed Engine for more details on Feed Engine.

Note
Any market data handler does not manage the lifetime of the bound OnixS::LSE::MarketData::GTP::FeedEngine instance. Therefore, keeping the instance of OnixS::LSE::MarketData::GTP::FeedEngine valid while it's bound to the instance of OnixS::LSE::MarketData::GTP::Handler is fully user responsibility.

Receiving Messages

The Handler exposes market data through the OnixS::LSE::MarketData::GTP::MessageListener interface. To receive messages, implement required callbacks and register the listener before starting the Handler.

class MyMessageListener : public OnixS::LSE::MarketData::GTP::MessageListener
{
public:
void onTrade(
{
// Process trade.
}
};
// ...
MyMessageListener listener;
handler.registerMessageListener(&listener);
handler.bindFeedEngine(feedEngine);
handler.start();
// FeedEngineThreadPool can be used instead of a manual processing loop.
{
}
handler.stop(true);
#define ONIXS_LSE_GTP_OVERRIDE
Definition Compiler.h:123
virtual void onTrade(const TradeMsg &, const DataSource &)
Fires when Trade message is received.
The given class implements feed engine concept using pool of working threads and standard socket API.
Definition FeedEngine.h:140
bool process(FeedEngine &engine)
Definition FeedEngine.h:133
Note
It is forbidden to change the state of an object passed into the user's callback.
For more and up-to-date information on getting started aspects, see GettingStarted sample from the samples collection available in distributive package.