This section provides messaging examples for CME Market Data Over Websocket API.

Example 1 - Login Authenticated  

{
    "header": {
        "messageType": "LOGINSTATUS",
        "sentTime": "2023-11-21T16:47:52.155000000Z",
        "version": "1.0",
        "sequenceNumber": "0"
    },
    "payload": {
        "status": "authenticated"
    }
}

Example 2 - Trade Subscription for a Single Product

In this example, a client system successfully subscribes to a single product.

Client Request

{
"header":
    {"messageType": "SUBSCRIBE","version": "1.0","requestId": "1","token": ""},
"payload":
    {"subscriptionMessageTypes":["TRD"],"subscriptions":[ {"productType": "FUT","productCode": "CL"}
     ]}
}

CME WebSocket API Response

{
    "header": {
        "messageType": "SUBSCRIPTION_STATUS",
        "requestId": "1",
        "sentTime": "2023-11-28T15:46:20.532000000Z",
        "version": "1.0",
        "sequenceNumber": "2"
    },
    "payload": {
        "status": "SUBSCRIBED",
        "subscriptionMessageTypes": [
            "TRD"
        ],
        "subscriptions": [
            {
                "productType": "FUT",
                "productCode": "CL"
            }
        ]
    }
}

Example 3 -  Multiple Top of Book and Trade Subscriptions

In this example, a client system successfully subscribes to multiple products.

Client Request

{
"header":
    {"messageType": "SUBSCRIBE","version": "1.0","requestId": "1","token": ""},
"payload":
    {"subscriptionMessageTypes":["TRD", "TOB"],"subscriptions":
	[ {"productType": "FUT","productCode": "CL"}, 
{"productType": "FUT","productCode": "BTC"}
     ]}
}

CME WebSocket API Response

{
    "header": {
        "messageType": "SUBSCRIPTION_STATUS",
        "requestId": "1",
        "sentTime": "2023-11-28T15:56:56.374000000Z",
        "version": "1.0",
        "sequenceNumber": "1"
    },
    "payload": {
        "status": "SUBSCRIBED",
        "subscriptionMessageTypes": [
            "TOB",
            "TRD"
        ],
        "subscriptions": [
            {
                "productType": "FUT",
                "productCode": "CL"
            },
            {
                "productType": "FUT",
                "productCode": "BTC"
            }
        ]
    }
}

Example 4 - Subscription Request Rejection

In this example a client subscription is rejected due to a "FUT&&&" typo for product code 6A.  Consequently both requests, 6A and 6J, are rejected.

Client Request

{
"header":
    {"messageType": "SUBSCRIBE","version": "1.0","requestId": "1","token": ""},
"payload":
    {"subscriptionMessageTypes":["TRD", "TOB"],"subscriptions":
	[ {"productType": "FUT&&&","productCode": "6A"}, 
{"productType": "FUT","productCode": "6J"}
     ]}
}

CME WebSocket API Response

{
    "header": {
        "messageType": "SUBSCRIPTION_ERROR",
        "version": "1.0",
        "requestId": "1",
        "token": "",
        "sequenceNumber": "1"
    },
    "payload": {
        "subscriptionMessageTypes": [
            "TRD",
            "TOB"
        ],
        "subscriptions": [
            {
                "productType": "FUT&&&",
                "productCode": "6A"
            },
            {
                "productType": "FUT",
                "productCode": "6J"
            }
        ]
    },
    "errors": [
        {
            "code": "ERROR_400",
            "message": "Invalid productType field",
            "referenceIndex": 0
        }
    ]
}

Example 5 - Trade Message

{
    "header": {
        "messageType": "TRD",
        "sentTime": "2023-11-28T16:06:34.407000000Z",
        "sequenceNumber": "48",
        "version": "1.0"
    },
    "payload": [
        {
            "instrument": {
                "definitionSource": "E",
                "exchangeMic": "XNYM",
                "id": "95658",
                "marketSeqmentId": "80",
                "periodCode": "20242",
                "productCode": "CL",
                "productGroup": "CL",
                "productType": "FUT",
                "symbol": "CLG4-CLU4"
            },
            "lastUpdateTime": "2023-11-28T15:37:34.700372189Z",
            "tradeSummary": {
                "aggressorSide": "",
                "mdTradeEntryId": "",
                "tradePrice": "157.0",
                "tradeQty": "1",
                "tradeOrderCount": "1",
                "tradeUpdateAction": "",
                "orderQty": []
            }
        }
    ]
}

Example 6 - Top of Book Message

{
    "header": {
        "messageType": "TOB",
        "sentTime": "2023-11-28T16:06:36.948000000Z",
        "sequenceNumber": "728",
        "version": "1.0"
    },
    "payload": [
        {
            "instrument": {
                "definitionSource": "E",
                "exchangeMic": "XNYM",
                "id": "735995",
                "marketSeqmentId": "80",
                "periodCode": "",
                "productCode": "CL",
                "productGroup": "CL",
                "productType": "FUT",
                "symbol": "CLG34"
            },
            "askLevel": [],
            "bidLevel": []
        }
    ]
}

Example 7 - Statistics Message 

{
    "header": {
        "messageType": "STAT",
        "sentTime": "2023-11-28T16:06:34.535000000Z",
        "sequenceNumber": "725",
        "version": "1.0"
    },
    "payload": [
        {
            "instrument": {
                "definitionSource": "E",
                "exchangeMic": "XNYM",
                "id": "792951",
                "marketSeqmentId": "80",
                "periodCode": "",
                "productCode": "CL",
                "productGroup": "CL",
                "productType": "FUT",
                "symbol": "CLG9"
            },
            "lastUpdateTime": "2023-11-28T16:06:20.395650235Z",
            "tradeStatistics": {
                "settlementPrice": "2068.0",
                "settlementPriceDate": "2023-11-28",
                "settlementPriceTimestamp": "2023-11-28T16:06:20.395650235Z",
                "settlementFinal": false,
                "settlementActual": true,
                "settlementRounded": false
            }
        }
    ]
}

  • No labels