# DXtrade Push MarketDataSubscriptionRequest

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/platforms/dxtrade/messages/marketdatasubscriptionrequest, written from the same records as that page.

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.

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.

- Message: `MarketDataSubscriptionRequest`
- Interface: DXtrade Push API
- Group: Market data
- Status: verified. Source: [demo.dx.trade](https://demo.dx.trade/developers/#/DXtrade-Push-API?id=market-data-subscription), checked 2026-10-12.

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. It is in no OpenAPI file on this site and the request builder does not list it.

Note: 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

- `type` (type String, required): Always MarketDataSubscriptionRequest.
- `requestId` (type String, required): An id of your own for the request. The answer names it in inReplyTo. The specification says to keep ids unique within a session.
- `timestamp` (type Timestamp, required): When the message was sent, in UTC.
- `session` (type String, required): The token of the session the message belongs to. It comes from the token login of the DXtrade REST API.
- `payload` (type Market data subscription, required): The subscription, with the fields below.
- `payload.eventTypes` (type Market data event type, required): The kinds of event wanted. Each entry holds the fields listed below as eventTypes[].
- `payload.eventTypes[].type` (type String, required): 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` (type String, optional): Always COMPACT.
- `payload.eventTypes[].candleType` (type String, optional): The width of the candle, for candles only: m, 5m, 15m, 30m, h, 2h, 4h, d, w or mo.
- `payload.eventTypes[].fromTime` (type Timestamp, optional): For candles, the UTC time to start the history from. Marked optional in the table and described as required for candles.
- `payload.eventTypes[].toTime` (type Timestamp, optional): For candles, the UTC time to end the history at. Marked optional in the table and described as required for candles.
- `payload.eventTypes[].count` (type Number, optional): The most candles to return. Where the period holds more, the older ones are left out.
- `payload.symbols` (type List of strings, required): The symbols of the instruments, such as EUR/USD.
- `payload.account` (type Account code, optional): 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.

- `type` (type String, required): Always MarketData.
- `inReplyTo` (type String, required): The requestId of the MarketDataSubscriptionRequest message it answers.
- `timestamp` (type Timestamp, required): When the message was sent, in UTC.
- `session` (type String, required): The token of the session the message belongs to. It comes from the token login of the DXtrade REST API.
- `payload.events` (type List of Quote or Candle, required): The market data objects.
- `payload.events[].type` (type String, required): Quote or Candle.
- `payload.events[].symbol` (type String, required): The symbol of the instrument.
- `payload.events[].bid` (type Number, required): On a quote: the bid price.
- `payload.events[].ask` (type Number, required): On a quote: the ask price.
- `payload.events[].time` (type Timestamp, required): The time of the quote or candle, in UTC.
- `payload.events[].candleType` (type String, required): On a candle: its width.
- `payload.events[].open` (type Number, required): On a candle: the opening price.
- `payload.events[].high` (type Number, required): On a candle: the highest price.
- `payload.events[].low` (type Number, required): On a candle: the lowest price.
- `payload.events[].close` (type Number, required): On a candle: the closing price.
- `payload.events[].volume` (type Number, required): 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.

```json
{
  "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"
      }
    ]
  }
}
```

## Related DXtrade Push messages: Market data

- [MarketDataCloseSubscriptionRequest](https://openbrokerapi.com/platforms/dxtrade/messages/marketdataclosesubscriptionrequest): Closes a market data subscription, by the requestId of the request that opened it. The server confirms, and no more market data is sent for that subscription.

## More on DXtrade

- [All DXtrade messages](https://openbrokerapi.com/platforms/dxtrade/messages): 8 documented here, grouped by what they do.
- [Subscribe to a stream: the call at each API](https://openbrokerapi.com/endpoints/streaming-subscribe): The same job at every broker and platform API recorded here, HTTP or not.
- [All DXtrade error codes](https://openbrokerapi.com/errors/dxtrade)
- [DXtrade API page](https://openbrokerapi.com/platforms/dxtrade): The full record: access, authentication, limits and the source for each.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: DXtrade Push MarketDataSubscriptionRequest. Broker API Hub, https://openbrokerapi.com/platforms/dxtrade/messages/marketdatasubscriptionrequest, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
