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.
- Warning
- 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());
}
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
{
}
};
FixMessageListener listener;
handler.settings().listeners().marketData(&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)
{
if(message.type() == "X")
{
std::cout
<<
"Transact time (Ticks from Epoch): " <<
toStr(transact.
cast<
UInt64>()) <<
"." << std::endl
<<
"Event Indicator (Raw Numeric Value): " <<
toStr(indicator.
cast<
UInt32>()) <<
"." << std::endl;
if(entries)
{
{
std::cout << "[" << index << "] {Price=";
std::cout << ",Size=" << size;
}
}
}
else if(message.type() == "d")
{
{
std::cout <<
"Maturity Month-Year for $" <<
securityId <<
": " <<
toStr(mmy) << std::endl;
}
}
}
{
void onMessage(Handler&, const FIX::MessageArgs& args) override
{
}
};
- See also
-