OnixS C++ CME MDP Premium Market Data Handler  5.8.3
API Documentation
Processing market data in a FIX-like manner

The SDK exposes the FIX-like messaging subsystem to provide a uniform technique to deal with SBE messages. This subsystem represents an additional layer between the SBE messages and user code. It allows users to achieve much higher tolerance to changes in SBE messaging by providing access to market data in the FIX-like (tag=value) way.

The FIX-like messaging subsystem is not intended to use in time-critical paths as it is designed to provide more flexibility in manipulating the market data, but it does not give the fastest way to access the data.

The subsystem classes are located in the OnixS::CME::MDH::FIX namespace. The following files must be included in the target project:

Constructing FIX messages manually

Every FIX-like message wrapper contains a constructor which allows creating an object from the corresponding message:

void onMessage(Handler&, const IncrementalRefreshLimitsBanding50Args& args) override
const FIX::Message& fixMessage = FIX::IncrementalRefreshLimitsBanding50(args.message());
// use fixMessage

Listening to FIX messages

The SDK provides the ability to subscribe to market data-related notifications and obtain incoming market data wrapped into FIX containers instead of receiving SBE messages directly via the OnixS::CME::MDH::FIX::MessageListener class. The user code must inherit from the given class and register the instance as the listener to market data. See Event listeners for more information concerning how to get subscribed to market data events.

struct FixMessageListener : public FIX::MessageListener
void onMessage(Handler&, const FIX::MessageArgs& args) override
// use args.message()
// ...
FixMessageListener listener;

Using FIX messaging

The following example shows how to access market data fields and groups using the FIX-like messaging subsystem:

void trace(const FIX::Message& message)
using namespace OnixS::CME::MDH::FIX;
if(message.type() == "X")
const Field transact = message[Tags::TransactTime];
const Field indicator = message[Tags::MatchEventIndicator];
// Any time-stamp field can be successfully converted into
// an unsigned 64-bit integer representing ticks since the epoch.
// Bit-set fields can be accessed either as raw integers or
// as structured entities as they are exposed by SBE messages.
<< "Transact time: " << toStr(transact.cast<Timestamp>()) << "." << std::endl
<< "Transact time (Ticks from Epoch): " << toStr(transact.cast<UInt64>()) << "." << std::endl
<< "Event Indicator: " << toStr(indicator.cast<MatchEventIndicator>()) << "." << std::endl
<< "Event Indicator (Raw Numeric Value): " << toStr(indicator.cast<UInt32>()) << "." << std::endl;
const Group entries = message.group(Tags::NoMDEntries);
for(Group::Size index = 0; index != entries.size(); ++index)
const GroupEntry entry = entries[index];
std::cout << "[" << index << "] {Price=";
if(const Field px = entry[Tags::MDEntryPx])
std::cout << toStr(px.cast<Decimal>());
Int32 size;
// If the side is unavailable, the casting operation will fail.
std::cout << ",Size=" << size;
const Field side = entry[Tags::MDEntryType];
std::cout << ",Side=" << toStr(side.cast<EntryType>()) << ",Side(Raw)=" << toStr(side.cast<EntryType::Base>());
const Field action = entry[Tags::MDUpdateAction];
// In addition to accessing the field value in a raw FIX format,
// it's possible to cast the value to the corresponding enumeration type.
// In such cass, the field value can be compared with enumeration constants.
std::cout << ",Action=" << toStr(action.cast<UpdateAction>()) << ",Action(Raw)=" << toStr(action.cast<UpdateAction::Base>()) << '}' << std::endl;
else if(message.type() == "d")
std::cout << "Maturity Month-Year for $" << securityId << ": " << toStr(mmy) << std::endl;
struct Tracer : public FIX::MessageListener
void onMessage(Handler&, const FIX::MessageArgs& args) override
See also