...
...
MultiExcerptName | scenarios |
---|
Example 1 - Login Authenticated
Code Block |
---|
|
{
"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
Code Block |
---|
|
{
"header":
{
"messageType": "SUBSCRIBE",
"version": "1.0",
"requestId": "1",
"token": ""
},
"payload":
{
"subscriptionMessageTypes":
[
"TRD"
],
"subscriptions":
[
{
"productType": "FUT",
"productCode": "CL"
}
]
}
} |
CME WebSocket API Response
Code Block |
---|
|
{
"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 - Trade Subscription using filters
In this example, a client system is using market data subscription filters to filter by month/year (periodCodes ) and message type (spreadReportTypes).
Code Block |
---|
|
{
"header":
{
"messageType": "SUBSCRIBE",
"sentTime": "2022-12-13T15:25:56.600000000Z",
"version": "1.0",
"requestId": 1477
},
"payload":
{
"subscriptionMessageTypes":
[
"TOB","TRD","STAT"
],
"subscriptions":
[
{
"productType": "OOF",
"productCode": "E1C",
"periodCodes": ["202409", "202409w1"]
"spreadReportTypes":
[
"OUTRIGHT"
]
}
]
}
} |
Example 4 - Multiple Top of Book and Trade Subscriptions
In this example, a client system successfully subscribes to multiple products.
Client Request
Code Block |
---|
|
{
"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
Code Block |
---|
|
{
"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 5 - 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
Code Block |
---|
|
{
"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
Code Block |
---|
|
{
"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 6 - Trade Message
Code Block |
---|
|
{
"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 7 - Top of Book Message
Code Block |
---|
|
{
"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 8 - Statistics Message
Code Block |
---|
|
{
"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
}
}
]
} |