MDP 3.0 - SBE Decoding Example

This topic provides an example of a fully decoded of SBE message.

Contents

 

SBE Schema 

The following SBE Schema will be used for the SBE decoding example in the next section.

<?xml version="1.0" encoding="UTF-8" standalone="true"?>

<ns2:messageSchema xsi:schemaLocation="http://www.fixtradingcommunity.org/pg/file/fplpo/read/1196759/simple-binary-encoding-rc2xsd SimpleBinary-RC2.xsd" byteOrder="littleEndian" description="20210310" semanticVersion="FIX5SP2" version="9" id="1" package="mktdata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.fixprotocol.org/ns/simple/1.0">

<types>

<type name="uInt32" description="uInt32" primitiveType="uint32"/>

<type name="Int32" description="int32" primitiveType="int32"/>

<type name="uInt64" description="uInt64" primitiveType="uint64"/>

<type description="MDUpdateActionNew" primitiveType="int8" name="MDUpdateActionNew" presence="constant">0</type>

<type description="MDEntryTypeLimits" primitiveType="char" name="MDEntryTypeLimits" presence="constant">g</type>

<composite description="Repeating group dimensions" semanticType="NumInGroup" name="groupSize">

<type primitiveType="uint16" name="blockLength"/>

<type primitiveType="uint8" name="numInGroup"/>

</composite>

<composite description="Optional Price with constant exponent -9" name="PRICENULL9" sinceVersion="9">

<type description="mantissa" primitiveType="int64" name="mantissa" presence="optional" nullValue="9223372036854775807"/>

<type description="exponent" primitiveType="int8" name="exponent" presence="constant">-9</type>

</composite>

<set name="MatchEventIndicator" encodingType="uInt8">

<choice description="1=Last trade message for the event, 0=Not last" name="LastTradeMsg">0</choice>

<choice description="1=Last electronic volume message, 0=Not last" name="LastVolumeMsg">1</choice>

<choice description="1=Last real quote message, 0=Not last" name="LastQuoteMsg">2</choice>

<choice description="1=Last statistics message, 0=Not last" name="LastStatsMsg">3</choice>

<choice description="1=Last implied quote message, 0=Not last" name="LastImpliedMsg">4</choice>

<choice description="1=Message is sent during recovery process" name="RecoveryMsg">5</choice>

<choice description="0=Reserved for future use" name="Reserved">6</choice>

<choice description="1=Last message for the event, 0=Not last" name="EndOfEvent">7</choice>

</set>

<types>

<ns2:message description="MDIncrementalRefreshLimitsBanding" id="50" semanticType="X" name="MDIncrementalRefreshLimitsBanding50" sinceVersion="9" blockLength="11">

<field description="Start of event processing time in number of nanoseconds since Unix epoch" id="60" semanticType="UTCTimestamp" name="TransactTime" offset="0" type="uInt64"/>

<field description="Bitmap field of eight Boolean type indicators reflecting the end of updates for a given Globex event" id="5799" semanticType="MultipleCharValue" name="MatchEventIndicator" offset="8" type="MatchEventIndicator"/>

<group description="Number of entries in Market Data message" id="268" name="NoMDEntries" blockLength="32" dimensionType="groupSize">

<field description="Upper price threshold for the instrument" id="1149" semanticType="Price" name="HighLimitPrice" offset="0" type="PRICENULL9"/>

<field description="Lower price threshold for the instrument" id="1148" semanticType="Price" name="LowLimitPrice" offset="8" type="PRICENULL9"/>

<field description="Differential static value for price banding" id="1143" semanticType="Price" name="MaxPriceVariation" offset="16" type="PRICENULL9"/>

<field description="Security ID " id="48" semanticType="int" name="SecurityID" offset="24" type="Int32"/>

<field description="MD Entry sequence number per instrument update" id="83" semanticType="int" name="RptSeq" offset="28" type="uInt32"/>

<field description="Market Data entry update action. In order to delete banding value, high or low limit, the deleted price field is populated with a NULL " id="279" semanticType="int" name="MDUpdateAction" type="MDUpdateActionNew"/>

<field description="Market Data entry type " id="269" semanticType="char" name="MDEntryType" type="MDEntryTypeLimits"/>

</group>

</ns2:message>

</ns2:messageSchema>

Message Example

The table below decodes a Limits and Banding message. The following SBE hexadecimal message will be decoded:

A6 BB 0A 00 5B 19 01 72 1E EF A9 16 38 00 0B 00 32 00 01 00 09 00 4B 52 E8 71 1E EF A9 16 00 00 00 20 00 01 FF FF FF FF FF FF FF 7F 00 90 CD 79 2F 08 00 00 00 E4 0B 54 02 00 00 00 F4 15 00 00 4D 07 00 00

CME Globex MDP uses little-endian byte ordering. Therefore, in the example below a hexadecimal value of A6 BB 0A 00 is inputted as 00 0A BB A6 in most conversion calculators.

Hexadecimal 

FIX Tag

Name

Primitive Type

Value

Block Length

Description

Hexadecimal 

FIX Tag

Name

Primitive Type

Value

Block Length

Description

Technical Header

A6 BB 0A 00

-

MsgSeqNum

uInt32

703398

-

This example uses a UDP technical header within the packet structure .  The TCP technical header includes an additional field named encodingType.

 

The epoch SendingTime value of 1633099253939247451 converts to October 1, 2021 14:40:53.939 in UTC.

5B 19 01 72 1E EF A9 16

-

SendingTime

uInt64

1633099253939247451

-

Message Header

38 00

-

MsgSize

uInt16

56

-

MsgSize is the first field in the the SBE message header.

0B 00

-

BlockLength

uInt16

11 

-

 

32 00

-

TemplateID

uInt16

50

-

 

01 00

-

SchemaID

uInt16

01

-

 

09 00

-

Version

uInt16

09

-

 

SBE Encoded FIX Message

4B 52 E8 71 1E EF A9 16

60

TransactTime

uInt64

1633099253937623627

11 

TransactTimeThe epoch SendingTime value of 1633099253937623627 converts to October 1, 2021 14:40:53.937 UTC.

The value of 11 maps to BlockLength in the message header field.

00

5799

MatchEventIndicator

uInt8

0

The MatchEventIndicator type uses binary values from the type section of the schema.  In this example the binary value is equal to 0000 0000.  

00 00

-

Block Alignment Padding

-

-

Two byte padding due to block alignment.   

11 bytes (BlockLength) - 8 (TransactTime) - 1 (MatchEventIndicator) = 2 (Block Alignment Padding)

20 00

268

NoMDEntries

→BlockLength

uInt16

32

32

Beginning of the repeating group.

01

→NumInGroup

uInt8

1

The repeating group has one iteration. 

FF FF FF FF FF FF FF 7F

 

1149

→HighLimitPrice

Mantissa

Int64

9223372036854775807

(null)

This field has an SBE type of PRICENULL9.  The type PRICENULL9 in the SBE schema defines a null value as 9223372036854775807 for the mantissa. 

Exponent

int8

-9

00 90 CD 79 2F 08 00 00

1148

→LowLimitPrice

Mantissa

Int64

9000000000000

A mantissa value of 9000000000000 and a exponent of -9 combine to make a value of 9000.000000000.

The exponent is defined as a constant of -9 for the type PRICENULL9 in the SBE schema and is not sent in the SBE message on the wire and is not part of the block length calculation.

Exponent 

int8

-9

00 E4 0B 54 02 00 00 00

1143

→MaxPriceVariation

Mantissa

Int64

10000000000

A mantissa value of 10000000000 and a exponent of -9 combine to make a value of 10.000000000.

The exponent is defined as a constant of -9 for the type PRICENULL9 in the SBE schema and is not sent in the SBE message on the wire and is not part of the block length calculation.  

Exponent

int8

-9

F4 15 00 00

48

→SecurityID

Int32

5620

 

4D 07 00 00

83

→RptSeq

uInt32

1869

 

-

279

→MDUpdateAction

uInt8

0

This field is defined as a constant value of zero for the type MDUpdateActionNew in the SBE schema and is not sent in the SBE message on the wire.  Therefore, this field is not part of the block length calculation. 

-

269

→MDEntryType

char

g

This field is defined as a constant value of "g" for the type MDEntryTypeLimits in the SBE schema and is not sent in the SBE message on the wire.  Therefore, this field is not part of the block length calculation.  

 

 




How was your Client Systems Wiki Experience? Submit Feedback

Copyright © 2024 CME Group Inc. All rights reserved.