DXtrade Push MarketDataSubscriptionRequest
Subscribes to market data for a list of symbols: quotes, which carry the latest bid and ask, or candles of a chosen width over a period. The server then sends MarketData messages.
Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.
This is a message of the DXtrade Push API, not an HTTP endpoint. It has no method and no path: it is sent as JSON or XML over an open WebSocket connection.
Besides the common errors, the section lists error code 34 where the user is not permitted to use the market data API, and 32 for an incorrect event type, format or symbol.
The message
- Name
- MarketDataSubscriptionRequest
- Direction
- Request, sent by the client
- Carried by
- WebSocket. Sent on the separate WebSocket resource for market data, whose address ends /md. The specification writes the address with a placeholder for the host, which each broker or firm that offers DXtrade supplies. Two optional query string arguments are set when connecting: format, XML or JSON, and compression, which can only be gzip.
Fields
| Name | Type | Description |
|---|---|---|
| typerequired | String | Always MarketDataSubscriptionRequest. |
| requestIdrequired | String | An id of your own for the request. The answer names it in inReplyTo. The specification says to keep ids unique within a session. |
| timestamprequired | Timestamp | When the message was sent, in UTC. |
| sessionrequired | String | The token of the session the message belongs to. It comes from the token login of the DXtrade REST API. |
| payloadrequired | Market data subscription | The subscription, with the fields below. |
| payload.eventTypesrequired | Market data event type | The kinds of event wanted. Each entry holds the fields listed below as eventTypes[]. |
| payload.eventTypes[].typerequired | String | Quote or Candle. The specification's table gives the type of this field as an account code, which reads as a slip: its examples send the strings Quote and Candle. |
| payload.eventTypes[].format | String | Always COMPACT. |
| payload.eventTypes[].candleType | String | The width of the candle, for candles only: m, 5m, 15m, 30m, h, 2h, 4h, d, w or mo. |
| payload.eventTypes[].fromTime | Timestamp | For candles, the UTC time to start the history from. Marked optional in the table and described as required for candles. |
| payload.eventTypes[].toTime | Timestamp | For candles, the UTC time to end the history at. Marked optional in the table and described as required for candles. |
| payload.eventTypes[].count | Number | The most candles to return. Where the period holds more, the older ones are left out. |
| payload.symbolsrequired | List of strings | The symbols of the instruments, such as EUR/USD. |
| payload.account | Account code | The account, used only where one user has several accounts with different pricing. |
What arrives
MarketData: Market data for the subscription. payload.events holds quotes or candles.
| Name | Type | Description |
|---|---|---|
| typerequired | String | Always MarketData. |
| inReplyTorequired | String | The requestId of the MarketDataSubscriptionRequest message it answers. |
| timestamprequired | Timestamp | When the message was sent, in UTC. |
| sessionrequired | String | The token of the session the message belongs to. It comes from the token login of the DXtrade REST API. |
| payload.eventsrequired | List of Quote or Candle | The market data objects. |
| payload.events[].typerequired | String | Quote or Candle. |
| payload.events[].symbolrequired | String | The symbol of the instrument. |
| payload.events[].bidrequired | Number | On a quote: the bid price. |
| payload.events[].askrequired | Number | On a quote: the ask price. |
| payload.events[].timerequired | Timestamp | The time of the quote or candle, in UTC. |
| payload.events[].candleTyperequired | String | On a candle: its width. |
| payload.events[].openrequired | Number | On a candle: the opening price. |
| payload.events[].highrequired | Number | On a candle: the highest price. |
| payload.events[].lowrequired | Number | On a candle: the lowest price. |
| payload.events[].closerequired | Number | On a candle: the closing price. |
| payload.events[].volumerequired | Number | On a candle: the total volume. |
Sample
Written by this site from the fields recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. No credential is typed into it: where a field holds one, the placeholder says where it comes from. Nothing is entered on this site.
{
"type": "MarketDataSubscriptionRequest",
"requestId": "009",
"timestamp": "2026-10-12T09:00:00.000Z",
"session": "<the session token from the REST login, from your own environment>",
"payload": {
"account": "default:fx1",
"symbols": [
"EUR/USD"
],
"eventTypes": [
{
"type": "Quote",
"format": "COMPACT"
}
]
}
}