CME MDP 3.0 Market Data AdaptorFIX Antenna .NET Programmer's Guide

MDP 3.0 is a new binary interface to CME Group services. More detailed description you can obtain at CME Group MDP 3.0 Wiki page.

FIX Antenna .NET CME MDP3 Market Data handler description

There is full set of API for effective listening CME Globex market data. Like in CME FIX/FAST Market Data Adaptor, but adopted to new SBE protocol, and supporting all major features of MDP 3.0.

Supported features

  • A/B arbitrage
  • Recovery with snapshots. Natural Refresh recovery is coming.
  • Ability to bind A and B feeds to different NICs
  • Option to bind threads to CPU cores
  • Works with SOCAT gateway. Allows to receive market data from any network.
  • Dedicated thread pool for incremental messages.
Quick guide

You can work with MDP 3.0 platform via classes contained at com.b2bits.FIXAntenna.Cme.Mdp namespace. Start point for new MDP 3.0 market data service instance is FixEngine.CreateCmeMdpMarketDataService(String, MarketDataServiceOptions).

For succesfull quick start with CME MDP3 market data processing you should be able to follow such steps:

Engine initialization

Execute the following instruction to initialize FIX engine.

C#
// Initialize engine
FixEngine.Create();

The engine.properties file is required to read the engine configuration parameters. It must, by default, be present in the current directory. If the file is located elsewhere or has a different name specify the properties file name and path explicitly.

C#
// Initialize engine
FixEngine.Create("engine.properties");

If an error occurs during initialization (the properties file is not found, a required property is missing etc.) the exception will be thrown.

C#
// Initialize engine
FixEngine engine = null;
try {
    engine = FixEngine.Create("engine.properties");
} catch (System.Exception err) {
MarketDataService creation

You can create an MarketDataService in these steps:

  • Configure MarketDataService parameters
  • Create an MarketDataService object
  • Initialize market data service
C#
//...
using com.b2bits.FIXAntenna.Cme.Mdp;
//...
static void Main(string[] args)
{
    // Configuration parameters
    MarketDataServiceOptions options = new MarketDataServiceOptions(); // will be felt with default values
    options.ConfigXmlFileName = "config.xml";
    options.TemplateFilename = "templates.xml";

    // Create MarketDataService object with specified parameter
    MarketDataService service = engine.CreateCmeMdpMarketDataService("SampleInstance", options);

    // Initialize just created service instance
    service.Open();

    // Thats all, next do your stuff...
}
//...
Subscribing by SecurityID

To get market data for interested Instrument follow these steps:

  • Implement Instrument Listener
  • Get channel from MarketDataService
  • Processing Instrument Listener onMessage callbacks with Increments, Snapshots, StatusMesssages.
  • Processing Instrument Listener onEvent callbacks

When Market Data Service receives a message with market data, it calls one of the callback functions of the Listener object. A class should implement InstrumentListener interface to be used as InstrumentListener:

C#
class InstrumentListener : com.b2bits.FIXAntenna.Cme.Mdp.InstrumentListener
{
    public void OnEvent(Instrument instrument, InstrumentEvent instrumentEvent)
    {
        //...
    }

    public void OnMessage(Instrument instrument, Message message, ref PerformanceIndicator performanceIndicator)
    {
        //...
    }
}
  • InstrumentListener.OnEvent(Instrument, InstrumentEvent) - Called on instrument event.
  • InstrumentListener.OnMessage(Instrument, Message, PerformanceIndicator) - Called on instrument message (W, X, f, R) received.
C#
//...
    InstrumentListener instrumentListener = new InstrumentListener();
    InstrumentOptions options;
    options.Group="ES";
    options.MarketDepth=1;
    options.ImpliedMarketDepth=1;
    UInt64 securityID = 12345678;// Value of the SecurityID(48) field of the Security Definition(d) message.
    Channel channel = marketDataService.GetChannel(310);
    Instrument instrument = channel.AddInstrument(securityID, options);
    instrument.Subscribe(instrumentListener);
//...
Subscribing using security definition messages

You can subscribe to instrument by Symbol/SecurityGroup/Asset/etc

  • Implement resolverListener using ResolverListener interface.
  • Get channel and listen to it with resolverListener.
  • Receive ResolverListener.OnMessage(Resolver, Message) callbacks from resolverListener
  • Filter security definition messages by Symbol/SecurityGroup/Asset/etc and process it
C#
// ...
class ResolverListener : com.b2bits.FIXAntenna.Cme.Mdp.ResolverListener
{
    // ...
    public void OnMessage(Resolver resolver, Message message)
    {
        // Filter messages by Symbol, SecurityGroup, Asset, etc..
        // assumes user-defined function someCheckingFunction() return true on interested tag values.
        if (someCheckingFunction(message))
        {
            // Instrument found
            InstrumentListener listener = new InstrumentListener();
            Instrument instrument = resolver.GetChannel())->AddInstrument(message);
            instrument.Subscribe(listener);
        }
    }
}

//...
ResolverListener resolverListener = new ResolverListener();
Channel channel = marketDataService->GetChannel(310);
Resolver resolver = channel->AddResolver("my_resolver");
resolver->Start(resolverListener);
//...
Events description

CME MDP3 uses event driven messaging system. Learn more about event driven messaging system on official CME site

See also reference to Resolver and Instrument events:
  • ResolverEvent
  • InstrumentEvent
Full Sample

You can find CME MDP3 Sample in package at this path: installation_dir/samples/CmeMdpClient/