Broker API HubMenu

DXtrade Push MarketDataSubscriptionRequest

messageMarketDataSubscriptionRequestDXtrade Push APIWebSocketMarket data

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.

Independent and unofficialdemo.dx.tradechecked

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

NameTypeDescription
typerequiredStringAlways MarketDataSubscriptionRequest.
requestIdrequiredStringAn id of your own for the request. The answer names it in inReplyTo. The specification says to keep ids unique within a session.
timestamprequiredTimestampWhen the message was sent, in UTC.
sessionrequiredStringThe token of the session the message belongs to. It comes from the token login of the DXtrade REST API.
payloadrequiredMarket data subscriptionThe subscription, with the fields below.
payload.eventTypesrequiredMarket data event typeThe kinds of event wanted. Each entry holds the fields listed below as eventTypes[].
payload.eventTypes[].typerequiredStringQuote 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[].formatStringAlways COMPACT.
payload.eventTypes[].candleTypeStringThe width of the candle, for candles only: m, 5m, 15m, 30m, h, 2h, 4h, d, w or mo.
payload.eventTypes[].fromTimeTimestampFor candles, the UTC time to start the history from. Marked optional in the table and described as required for candles.
payload.eventTypes[].toTimeTimestampFor candles, the UTC time to end the history at. Marked optional in the table and described as required for candles.
payload.eventTypes[].countNumberThe most candles to return. Where the period holds more, the older ones are left out.
payload.symbolsrequiredList of stringsThe symbols of the instruments, such as EUR/USD.
payload.accountAccount codeThe 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.

NameTypeDescription
typerequiredStringAlways MarketData.
inReplyTorequiredStringThe requestId of the MarketDataSubscriptionRequest message it answers.
timestamprequiredTimestampWhen the message was sent, in UTC.
sessionrequiredStringThe token of the session the message belongs to. It comes from the token login of the DXtrade REST API.
payload.eventsrequiredList of Quote or CandleThe market data objects.
payload.events[].typerequiredStringQuote or Candle.
payload.events[].symbolrequiredStringThe symbol of the instrument.
payload.events[].bidrequiredNumberOn a quote: the bid price.
payload.events[].askrequiredNumberOn a quote: the ask price.
payload.events[].timerequiredTimestampThe time of the quote or candle, in UTC.
payload.events[].candleTyperequiredStringOn a candle: its width.
payload.events[].openrequiredNumberOn a candle: the opening price.
payload.events[].highrequiredNumberOn a candle: the highest price.
payload.events[].lowrequiredNumberOn a candle: the lowest price.
payload.events[].closerequiredNumberOn a candle: the closing price.
payload.events[].volumerequiredNumberOn 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"
      }
    ]
  }
}