EPAM B2BITS CME MDP Handler C++  5.4.2
Namespaces | Classes | Typedefs
Tag-Value interface

By tag access to message fields and groups. More...

Namespaces

 Cme::Mdp::FIXTag
 

Classes

struct  Cme::Mdp::TagValue
 Lightweight TagValue wrapper for generated messages. More...
 
struct  Cme::Mdp::Group
 

Typedefs

typedef Message< TagValue > Cme::Mdp::FIXMessage
 

Detailed Description

By tag access to message fields and groups.


Cme::Mdp::TagValue interface provides uniform access to MDP3 messages.
Raw C++ messages provide ultra low latency access to message fields and groups, but require to override many onMessage methods.
E.g. MDP3 schema contains 9 different templates for incremental(35=X) updates, which means that if all of them are needed to process - 9 onMessage() callbacks are to be overriden.

With TagValue interface it is enough to override only one InstrumentListener::onIncrementMessage callback, which make the code less complicated.
FIXMessage can be enabled on a per-service basis via MarketDataServiceOptions::useFIXUpdates_ property

Please note that although TagValue interface is lightweight, it does not require any memory allocations and provide low latency access, reading fields by tag is about 2 times slower than than using regular C++ messages. E.g. if reading all fields from Cme::Mdp::MBPIncBookMsg takes ~20ns, using TagValue would take 40-50 ns.

Example: receiving security definition messages

//
struct MsgListener : public ResolverListener
{
// three callbacks to be implemented to receive futures, spreads and options
ResolverControlCode onMessage(Resolver* resolver, const InstrumentFutureMsg&)
{
}
ResolverControlCode onMessage(Resolver* resolver, const InstrumentSpreadMsg&)
{
}
ResolverControlCode onMessage(Resolver* resolver, const InstrumentOptionMsg& msg)
{
i32 id = msg.getSecurityID();
StringRef type = msg.getSecurityType();
auto mei = msg.getMatchEventIndicator();
auto status = msg.getMDSecurityTradingStatus();
for(auto it = msg.getMDFeedTypesIterator(); it.isValid(); ++it)
{
auto entry = it.get();
auto type = entry.getEventType();
auto time = entry.getEventTime();
}
}
}

Example: receiving security definition messages via FIX interface

//
struct MsgListener : public ResolverListener
{
// single callback is required
ResolverControlCode onSecDefMessage(Resolver* resolver, const FIXMessage& msg)
{
i32 id = msg.getAsInt32(FIXTag::SecurityID);
StringRef symbol = msg.getAsString(FIXTag::SecurityType);
auto mei = get<MatchEventIndicatorSet>(FIXTag::MatchEventIndicator);
auto status = get<SecurityTradingStatus>(FIXTag::MDSecurityTradingStatus);
if (msg.isSupported(FIXTag::NoMDFeedTypes)
{
auto group = msg.getGroup(FIXTag::NoMDFeedTypes);
for(auto i = 0; i < group.size(); ++i)
{
auto entry = group.getEntry(i);
auto type = entry.get<EventType>(FIXTag::EventType);
auto time = entry.getAsUInt64(FIXTag::EventTime);
}
}
}

Typedef Documentation

typedef Message< TagValue > Cme::Mdp::FIXMessage