The Handle API is enclosed in the OnixS::CME::MDH namespace. The master OnixS/CME/MDH.h header file collects all header files.
Constructing and configuring the handler
The OnixS::CME::MDH::Handler class encapsulates the market data processing logic in the bounds of a CME MDP 3.0 channel. The OnixS::CME::MDH::HandlerSettings class contains parameters controlling various aspects of market data processing.
Default values configure the likely behaviour of the handler instance. However, some parameters must be set explicitly before starting market data processing:
Handler handler;
handler.settings().channel(310).connectivityConfigurationFile("config.xml");
#if !defined(_WIN32)
handler.settings().feeds().feedANetworkInterfaces(NETWORK_INTERFACE_FOR_FEEDS_A)
.feedBNetworkInterfaces(NETWORK_INTERFACE_FOR_FEEDS_B);
#endif
- See also
- Adjusting Handler's settings
Licensing
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 when the OnixS::CME::MDH::Handler::start is called.
By default, the handler looks for a license in the application’s current directory. To instruct the handler where to look for a valid license, use the OnixS::CME::MDH::LicenseSettings::licenseStore method.
- 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 shows how to specify the license location:
handler.settings().licenseSettings().licenseStore("license");
Binding a Feed Engine
The Feed Engine abstractions encapsulate market data sources. It is necessary to construct a Feed Engine implementation instance and bind it to the OnixS::CME::MDH::Handler instance:
SocketFeedEngine feedEngine;
handler.settings().feeds().engine(&feedEngine);
- Note
- An OnixS::CME::MDH::Handler instance does not manage the lifetime of the associated OnixS::CME::MDH::NetFeedEngine instance. The user is responsible for keeping an OnixS::CME::MDH::NetFeedEngine instance alive while bound to an OnixS::CME::MDH::Handler instance.
- See also
- Setting up Feed Engine
Subscribing to market data events
Once an OnixS::CME::MDH::Handler instance is constructed and bound to an instance of the OnixS::CME::MDH::NetFeedEngine, market data processing can be started. To get the results of market data processing, subscribe to the corresponding events (e.g., order book updates).
- See also
- Event listeners
Starting market data processing
To start market data processing, call the OnixS::CME::MDH::Handler::start method.
- Note
- The OnixS::CME::MDH::Handler::start method switches the handler to the market data processing state. However, the Feed Engine logic must be executed to make market data come into the handler instance. It is necessary to explicitly run the Feed Engine logic either by invoking the OnixS::CME::MDH::NetFeedEngine::process method repeatedly or by using additional services like one offered by the OnixS::CME::MDH::FeedEngineThreadPool class.
To stop market data processing, call the OnixS::CME::MDH::Handler::stop method.
Configuring logging (optional)
The handler can log market data it processes and other events that may occur during market data processing.
The OnixS::CME::MDH::Logger abstract class encapsulates the logging subsystem. The handler provides a few logging implementations. File-based logging is a good choice for most cases.
Below is an example of how the file-based logging is configured:
FileLoggerSettings loggerSettings;
loggerSettings.severityLevel(LogSeverity::Debug);
FileLogger logger(loggerSettings);
handler.settings().logging().logger(&logger);
- Note
- An OnixS::CME::MDH::Handler instance does not manage the lifetime of the associated OnixS::CME::MDH::Logger instance. Therefore, the user must keep the OnixS::CME::MDH::Logger instance alive while it is bound to the handler.
- See also