OnixS C++ CME MDP Premium Market Data Handler  5.8.3
API Documentation
Market data processing session

The SDK allows fine-tuning market data processing to match business requirements.

Defining processing behaviour

Parameters defining the market data processing session's behaviour are gathered into the OnixS::CME::MDH::SessionSettings class. The OnixS::CME::MDH::HandlerSettings class exposes an instance of the given class through the OnixS::CME::MDH::HandlerSettings::session member.

The OnixS::CME::MDH::SessionSettings class defines whether market data recovery must be performed at the beginning of market data processing or in case of data loss or other processing errors, and so on. Also, settings define which type of market (by price or by order or both) to recover. Finally, the settings tell the handler whether to use the TCP Recovery to request missing data before recovering the market state from snapshots.

The table below describes parameters affecting market data processing:

Parameter Description Behaviour Visualization
OnixS::CME::MDH::SessionSettings::joinRecovery Defines whether the handler must recover either instruments or the entire market state, or nothing when joining the market. For a complete list of available options, see OnixS::CME::MDH::JoinRecoveryOptions::Enum members.
SessionSettings-JoinAndGap.jpg
OnixS::CME::MDH::SessionSettings::gapAndErrorHandling

When live market data is processed, a failure may occur due to data errors or data loss. Using this parameter, it's possible to specify whether processing real-time market data should continue or the handler must recover the market state (e.g., to have accurate order books). Also, the handler may recover all instruments in addition to the market state to have an accurate list of traded securities.

See the OnixS::CME::MDH::GapAndErrorHandlingOptions::Enum for the complete list of available options.

OnixS::CME::MDH::SessionSettings::instrumentRecovery

If the processing session must perform instrument recovery due to either late join or processing failure, this parameter affects how security definitions are recovered.

By default, the handler processes recovery data from the beginning of a recovery loop to have the correct set of available instruments. If the handler joins the feed in the middle of a security definition dissemination loop, it waits till its end. When the number of security definitions being looped is significant, it takes a while for the handler to recover all instrument definitions. Also, data loss causes the handler to process security definitions from the beginning of the next loop. Client systems may need a faster way of recovering security definitions. For this reason, the SDK offers alternative ways of recovering instrument definitions.

For the complete list of options, see OnixS::CME::MDH::InstrumentRecoveryOptions::Enum.

OnixS::CME::MDH::SessionSettings::marketRecovery

If the processing session must perform market state recovery due to either late join or processing failure, this parameter allows defining a type of market to recover.

CME MDP Premium offers market-by-order (MBO) and market-by-price (MBP) data. Although the data for both MBO and MBP is disseminated via the same Incremental Feed, recovery is separated for each data type. The handler must be configured with the kinds of markets to be recovered.

For the complete list of options, see OnixS::CME::MDH::MarketRecoveryOptions::Enum.

Note
This parameter must be reconciled with order book maintaining settings. For example, suppose a processing session is configured to recover the market at the join time or due to data loss for market-by-price (MBP) only. Properly maintaining market-by-order (MBO) books is impossible, so an exception is thrown.
SessionSettings-MarketRecovery.jpg
OnixS::CME::MDH::SessionSettings::tcpRecovery These parameters control the usage of TCP Recovery. Suppose an OnixS::CME::MDH::TcpRecoveryService instance is assigned (using the OnixS::CME::MDH::TcpRecoverySessionSettings::service setting). In that case, the handler tries to recover missing Incremental data using this service before it switches to recovering market state from snapshots or resumes Incremental data processing (depending on the OnixS::CME::MDH::SessionSettings::gapAndErrorHandling value).

Accurate book maintenance while joining lately

The following code snippet shows how to configure a market data processing session to maintain order books accurately starting from the middle of a trading session (a.k.a. "late join").

Handler handler;
SessionSettings& settings = handler.settings().session();
// In case of late join, instruments and market state must be recovered before switching to process real-time (incremental) data.
settings.joinRecovery(JoinRecoveryOptions::InstrumentsAndMarketState);
// Accurate order book maintenance assumes performing market recovery each time data is lost or another processing failure occurs.
settings.gapAndErrorHandling(GapAndErrorHandlingOptions::RecoverMarketState);
handler.start();

Accurate market-by-price (MBP) book maintenance while joining in Preopening

The following code snippet shows how to configure a market data processing session to accurately maintain market-by-price (MBP) books, starting from the beginning of a trading session when the market is blank (no initial recovery is needed to catch up with the market).

Handler handler;
SessionSettings& settings = handler.settings().session();
// In the case of pre-opening, instruments are transmitted via a real-time feed, and the market state is blank. Therefore, the market-join recovery is optional.
settings.joinRecovery(JoinRecoveryOptions::Disabled);
// Accurate order book maintenance requires performing market recovery each time data is lost or another processing failure occurs.
settings.gapAndErrorHandling(GapAndErrorHandlingOptions::RecoverMarketState);
// Limits market recovery to market-by-price (MBP) only.
settings.marketRecovery(MarketRecoveryOptions::MbpOnly);
handler.start();

Refresh order books naturally after the initial market data recovery

The following code snippet shows how to configure market data processing to maintain order books in the natural refresh mode and to perform a full state recovery at a join stage. This configuration is frequently used when a server doing market data processing is collocated in the CME network, and the possibility of data loss is minimal. It provides almost the same benefits as accurate order book maintenance while preventing real-time processing freeze due to executing market recovery in case of data loss.

Handler handler;
SessionSettings& settings = handler.settings().session();
// Configures the instrument and market recovery at the market-join time.
settings.joinRecovery(JoinRecoveryOptions::InstrumentsAndMarketState);
// Natural refresh assumes the continuation of real-time data processing even if some of the transmitted data is lost.
settings.gapAndErrorHandling(GapAndErrorHandlingOptions::ContinueProcessing);
handler.start();

Refresh order books naturally but use TCP Recovery in case of data losses

The following code snippet shows how to configure market data processing to maintain order books in the natural refresh mode. However, in contrast to a typical case, when real-time processing is resumed immediately, the handler tries to recover missing data using TCP Recovery Feeds.

TcpRecoverySettings tcpRecoverySettings("username", "password");
TcpRecoveryService tcpRecovery(tcpRecoverySettings);
Handler handler;
SessionSettings& settings = handler.settings().session();
// Natural refresh assumes the continuation of real-time data processing even if some of the transmitted data is lost.
settings.gapAndErrorHandling(GapAndErrorHandlingOptions::ContinueProcessing);
// Tells the Handler to involve TCP Recovery if data is missed.
settings.tcpRecovery().service(&tcpRecovery);
handler.start();