# DXtrade API: REST, HMAC, rate limits and broker access

URL: https://fincodelabs.com/en/blog/dxtrade-api · Publisher: Fincode (Fincode Yazılım ve Teknoloji A.Ş.), Istanbul, Turkey · Category: Stocks, forex and broker APIs · Published: 2026-11-26 · Updated: 2026-11-26

DXtrade API from Devexperts' own documents, read 26 November 2026: REST endpoints, Basic and HMAC login, default limits, and what your broker controls.

**Short answer:** The **DXtrade API** is a set of public Devexperts interfaces, mainly a REST API for orders, positions and account data plus a WebSocket Push API, but your broker or prop firm decides whether you can use them. Devexperts' REST specification, last revised on 17 July 2026, documents login with username, domain and password or per-request HMAC signing, with default limits of one trading request and two data requests a second per session. Credentials, host and IP allowlist come from the broker, not Devexperts.

Devexperts' pages were read on 26 November 2026, without a DXtrade account. Leveraged forex, CFDs, futures and options can lose money quickly. Rules depend on your country, account types and API access vary by broker, and no broker or prop firm is recommended or linked with a referral.

For readers in Turkey: the Capital Markets Board (SPK) [said on 23 February 2023](https://spk.gov.tr/duyurular/basin-duyurulari/2023/izinsiz-kaldiracli-islemlere-iliskin-basin-duyurusu) (still online 26 November 2026) that residents may carry out leveraged FX trades only through firms it has authorized. Offering such trades without authorization carries two to five years in prison and a judicial fine, and SPK can order access blocked to sites offering leveraged trades from abroad to residents ([Law No. 6362](https://www.mevzuat.gov.tr/mevzuatmetin/1.5.6362.pdf) Articles 99(4) and 109(2)).

Section 3 of TradingView's [Terms of Use](https://www.tradingview.com/policies/), read on 26 November 2026, licenses alerts and webhooks for display-only use and bars automated trading, automated order generation and third-party products built to enable them. That covers any bridge from TradingView alerts to DXtrade: read the terms and take legal advice first.

## What the DXtrade API includes

Devexperts lists six DXtrade APIs, but on 26 November 2026 only the REST specification could be read.

**DXtrade APIs as Devexperts describes them (articles of 16 April 2024 and 24 January 2025, read 26 November 2026)**

| API | Vendor description | Specification read? |
| --- | --- | --- |
| REST | Trading operations, account data and metrics | Yes, revision of 17 July 2026 |
| Push | WebSocket subscriptions for account and market data updates | No: portal unreachable |
| FIX Trading | B2B order entry and execution reports | No |
| FIX Market Data | Instrument data and market data subscriptions | No |
| Administrative REST | Account and user management, deposits, withdrawals | No |
| Amazon SQS | Reliable message delivery for B2B integrations, complementing Push | No |

The [DXtrade APIs page](https://dx.trade/apis/) links to a developer portal at `demo.dx.trade/developers`, which refused connections on two attempts on 26 November 2026. The REST specification itself loads from `demo-xt.dx.trade`. One conflict: both vendor articles say REST covers market data, but the July 2026 specification lists no quote endpoint, while at least one firm's own DXtrade page documents a `/marketdata` resource, so deployments differ. Otherwise prices come through the Push API, or a dxFeed token returned only in third-party UI vendor setups. For the WebSocket side, see [WebSocket heartbeat and reconnect](https://fincodelabs.com/en/blog/websocket-heartbeat-reconnect) for the failure handling.

## Who gets DXtrade API access

Your broker or prop firm does: Devexperts sells the platform to firms and sends traders back to them.

- **No direct route.** The [Traders' FAQ](https://dx.trade/traders-faq) says Devexperts provides no services to traders and that the dx.trade demo is for firms trialling the software.
- **The firm opens or closes the API.** The same FAQ says brokers and prop firms may open the APIs for external use and that most do, but no list is published, for contractual reasons. The firm also controls permitted IP addresses, so an unlisted server can fail with correct credentials.
- **Basic login** needs a username, a domain and a password. The specification defines domain only as the client's domain; the broker supplies the value.
- **HMAC tokens** are a public and private pair issued in a manual onboarding step; the specification recommends HMAC for trading on behalf of several accounts.

A prop firm's own rules can forbid bots, copiers or API use even where the platform supports them, so read them first. The specification names no official SDK, and PyPI had no packages named `dxtrade`, `dxtrade-api` or `pydxtrade` on 26 November 2026; a community TypeScript SDK is on npm. Any community wrapper is unofficial: it sees your password or private token, may lag the specification, and does not change what your firm allows. Storing those secrets is covered in [API key security for trading bots](https://fincodelabs.com/en/blog/api-key-security-trading-bots).

## DXtrade REST API endpoints and authentication

Paths hang off a broker-specific host and base path; the specification's example uses `/dxsca-web`.

**DXtrade REST resources, specification revised 17 July 2026**

| Purpose | Method and path after the base path |
| --- | --- |
| Log in, keep alive, log out | `POST /login`, `POST /ping`, `POST /logout` |
| Place, modify, cancel | `POST`, `PUT /accounts/{account}/orders`; `DELETE .../orders/{orderCode}` or `.../orders/group` |
| Pre-check without placing | `POST /accounts/{account}/orders/validate` |
| Close all, or one symbol | `POST /accounts/{account}/flatten` |
| Positions, open orders, history | `GET /accounts/{account}/positions`, `/orders`, `/orders/history` |
| Portfolio, transfers, metrics, events | `GET /accounts/{account}/portfolio`, `/transfers`, `/metrics`, `/events` |
| Several accounts at once | `GET /accounts/positions?accounts=...` and the same pattern for the others |
| Instruments and schedules | `GET /instruments/{symbol}`, `/instruments/query/`, `/instruments/{symbol}/schedule` |

After Basic login, every request carries `Authorization: DXAPI <session token>`. Login also returns a `timeout`; after that much inactivity, or a logout, the token returns 401. `/ping` resets the timer; HMAC needs no ping. Account codes take the form `clearing:account` and must be URL-encoded. JSON is the default; XML is available. Account events gained RISK and DANGER types on 29 April 2026.

## DXtrade API rate limits and request rules

The defaults are low, and the specification says each is configurable per client, so your broker's values may differ. Some third-party pages quote 10 a second as the default; the specification does not.

**Default limits in the REST specification, read 26 November 2026**

| Rule | Default | When broken |
| --- | --- | --- |
| Login requests, per IP | 1 a second | 429 |
| Data requests, per session | 2 a second | 429 |
| Place, modify or cancel, per session | 1 a second | 429 |
| Request size | 512 KB | 413 |
| PUT and DELETE without `If-Match` | Required | 403, code 99 |
| Stale `If-Match` value | Must match current ETag | 412 |
| Reused `orderCode` | Unique among the account's orders, up to 64 characters, case-sensitive | 409, code 100 |

So a modify or cancel needs a GET for the ETag first, and both count against the limits; a shared [token bucket](https://fincodelabs.com/en/blog/token-bucket-rate-limiter-python) keeps a bot under them.

> **Hypothetical polling budget.** A bot watches 5 accounts and reads positions, open orders and metrics for each. Per-account calls are 5 x 3 = 15 requests; at the default 2 a second, one refresh takes 7.5 seconds. The multi-account endpoints need 3 requests, or 1.5 seconds. Polling still sees fills late; the Push API exists for that.

## DXtrade HMAC authentication: what the specification leaves open

The signing steps are documented, but one detail is ambiguous and no worked hash is published, so expect to confirm the format with your broker.

The header is `Authorization: DXAPI principal="<public token>",timestamp=<ms>,hash="<Base64>"`. The candidate joins `Key=value` lines with a newline in the order Method, Content, URI and Timestamp, and the hash is SHA-256 with the private token. The ambiguity: the key table also lists a fifth line, `Token`, holding the private token, while the sample candidate stops at Timestamp. The code below supports both; on 401 with code 13 (signature mismatch), the other variant is the first thing to test. Nor does it say whether the key is the token string or its raw bytes.

- **Content** must be the body exactly as sent, so serialize once and send those bytes; an HTTP library that re-serializes a dict breaks the hash. An empty body signs as an empty string.
- **URI** is the path and query without the host, including the base path and the percent-encoded account code exactly as sent.
- **Timestamp** is Unix milliseconds and must fall within a window the server configures; code 12 means too old, so keep the clock synced. Code 11 means a malformed header.

General mechanics are in [API signature generation](https://fincodelabs.com/en/blog/api-signature-generation).

## DXtrade API Python: order handling tested offline

The checks around the HTTP call matter more than the call: valid order codes, finite quantities, exact signed bytes and a safe answer to a timeout.

```python
import base64, hashlib, hmac, json, math, re

SAFE_ID = re.compile(r"[A-Za-z0-9._-]{1,64}")  # stricter than spec 3.6; no colon

def hmac_header(method, uri, body, principal, secret, ts, token_line=False):
    lines = [f"Method={method}", f"Content={body}", f"URI={uri}", f"Timestamp={ts}"]
    if token_line:  # the key table lists Token; the sample omits it
        lines.append(f"Token={secret}")
    mac = hmac.new(secret.encode(), "\n".join(lines).encode(), hashlib.sha256)
    h = base64.b64encode(mac.digest()).decode()
    return f'DXAPI principal="{principal}",timestamp={ts},hash="{h}"'

def positive(x):
    try:
        v = float(str(x))
    except ValueError:
        v = math.nan
    if not math.isfinite(v) or v <= 0:
        raise ValueError(f"not a finite positive number: {repr(x)}")
    return v

def order_body(code, symbol, side, qty, limit=None):
    if not SAFE_ID.fullmatch(code or "") or side not in ("BUY", "SELL"):
        raise ValueError(f"bad orderCode or side: {repr(code)}, {repr(side)}")
    body = {"orderCode": code, "type": "MARKET", "instrument": symbol,
            "quantity": positive(qty), "side": side,
            "positionEffect": "OPEN", "tif": "GTC"}
    if limit is not None:
        body.update(type="LIMIT", limitPrice=positive(limit))
    return json.dumps(body, separators=(",", ":"))  # sign these exact bytes

def error_code(text):
    try:
        b = json.loads(text or "{}")
    except ValueError:
        b = {}
    b = b if isinstance(b, dict) else {}
    return next((b[k] for k in ("errorCode", "code", "Code") if k in b), None)

def place(send, uri, body):
    try:
        status, text = send("POST", uri, body)
    except (ConnectionError, TimeoutError) as e:
        return f"UNKNOWN ({type(e).__name__}): resend the SAME orderCode"
    code = error_code(text) if status >= 300 else None
    if status in (200, 201):
        return "placed"
    if status == 409 and str(code) == "100":
        return "already exists: read open orders, do not resend"
    if status == 401:
        return f"auth failed, code {code}: log in again or check the HMAC"
    if status == 429:
        return "throttled: default is 1 trading request a second"
    return f"rejected: HTTP {status}, code {code}"
```

Run on 26 November 2026 with Python 3.11.3, a fake `send`, a made-up token and the specification's sample URI and timestamp; HMAC lines show the last 48 characters:

```
h="+/b3EJFEo1I0R7ANKnEC315P/UdK1Od9kCxphKjvsNA="
h="FIjr1AeN7qo5VPcci85yJjnkoeG432p7xmHNDX8wync="
/dxsca-web/accounts/clearing%3AACC%201/orders
{"orderCode":"bot-1","type":"LIMIT","instrument":"EUR/USD","quantity":1000.0,"side":"BUY","positionEffect":"OPEN","tif":"GTC","limitPrice":1.085}
refused: bad orderCode or side: '', 'BUY'
refused: not a finite positive number: '1e400'
refused: not a finite positive number: 'nan'
refused: bad orderCode or side: 'bot 4', 'BUY'
placed
UNKNOWN (TimeoutError): resend the SAME orderCode
already exists: read open orders, do not resend
rejected: HTTP 409, code None
throttled: default is 1 trading request a second
auth failed, code 13: log in again or check the HMAC
rejected: HTTP 400, code None
```

- A timeout after a POST leaves the order state unknown. Resending the *same* `orderCode` is safe because the server rejects a duplicate with 409 and code 100, which then tells you the first attempt landed; a fresh code risks a double order. More in [client order IDs](https://fincodelabs.com/en/blog/client-order-id).
- `float("1e400")` is infinity and NaN slips past `v <= 0`, so quantities go through `math.isfinite`; an empty order code is refused, not treated as a duplicate. Colons are refused: modify and cancel read an `a:b` code as a system order code if one matches.
- A real `send` must map network errors to `ConnectionError` or `TimeoutError`; exceptions from `requests` subclass neither.

Not run: login, ping, any request to a DXtrade host, the HMAC hash against a real server, and the Push API. Each needs a broker-issued account.

## DXtrade API error codes and gaps in the documents

Errors use standard HTTP status codes plus an object with a numeric code and an English description, but several details are missing from the public document.

- **Field names.** The specification describes the error object's fields as Code and Description without showing the JSON key names, so the parser above tries several and returns None when none match. Descriptions may change without a version change; branch on codes.
- **Permission errors look like missing data:** 404 with code 2, not 403, by design.
- **Validation codes.** A failed pre-trade check returns 409 with varying codes, and the list of validation descriptors links to a Devexperts Confluence page that redirected to a login screen on 26 November 2026.

If you are weighing a DXtrade integration against REST or FIX on other platforms, [broker API integration: REST, WebSocket and FIX](https://fincodelabs.com/en/blog/broker-api-integration-fix-rest) compares the patterns, and Fincode's [broker API integration](https://fincodelabs.com/en/services/broker-api-integration) page describes that kind of work in general; naming DXtrade here does not mean Fincode integrates it or has built on it.

Related guide: [TradeStation API](https://fincodelabs.com/en/blog/tradestation-api).

## Frequently asked questions

### Where is the DXtrade API documentation?

The REST specification is on demo-xt.dx.trade, revised 17 July 2026 (read 26 November 2026). The developer portal linked from dx.trade/apis refused connections that day, so other specifications were not read.

### Can I get DXtrade API access from Devexperts directly?

No. Devexperts' Traders' FAQ says it does not provide services to traders and that the dx.trade demo is for firms trialling the software; credentials and API permission come from your broker or prop firm.

### What is the domain field in the DXtrade API login?

The specification defines it only as the domain of the client, sent with username and password. Your broker sets the value.

### Is there an official DXtrade API Python library?

The REST specification names no SDK, and no PyPI packages named dxtrade, dxtrade-api or pydxtrade existed on 26 November 2026; a community TypeScript SDK is on npm. Plain HTTPS requests in any language work; unofficial wrappers carry credential and maintenance risk.

## Sources

- [Devexperts: DX REST API Specification (revision of 17 July 2026)](https://demo-xt.dx.trade/dxweb/specs/DX_REST_API.html)
- [DXtrade: APIs page linking the developer portal](https://dx.trade/apis/)
- [DXtrade: Traders' FAQ (API access, demo account, brokers and prop firms)](https://dx.trade/traders-faq)
- [DXtrade: Why we chose to make our DXtrade APIs public (24 January 2025)](https://dx.trade/news/articles/why-we-keep-our-apis-open-and-why-it-matters/)
- [Devexperts blog: DXtrade API suite for integration with brokerage infrastructure (16 April 2024)](https://devexperts.com/blog/dxtrade-api-for-seamless-integration-with-brokerage-infrastructure/)
- [TradingView: Terms of Use, section 3](https://www.tradingview.com/policies/)
- [SPK (Capital Markets Board): Press notice on unauthorized leveraged transactions, 23 February 2023 (Turkish)](https://spk.gov.tr/duyurular/basin-duyurulari/2023/izinsiz-kaldiracli-islemlere-iliskin-basin-duyurusu)
- [Capital Markets Law No. 6362, Articles 99 and 109 (Turkish, consolidated text)](https://www.mevzuat.gov.tr/mevzuatmetin/1.5.6362.pdf)

> This guide is general information about software and markets, not investment, legal or tax advice. Automated trading can lose money, past or backtested performance does not guarantee future results, and the rules that apply depend on your jurisdiction and your exchange's terms. Sources, checks and corrections: see the [editorial policy](https://fincodelabs.com/en/editorial-policy).

---

Published by Fincode (Fincode Yazılım ve Teknoloji A.Ş.), a software company in Istanbul, Turkey: https://fincodelabs.com/en/blog/dxtrade-api

Cite as: Fincode, "DXtrade API: REST, HMAC, rate limits and broker access", updated November 26, 2026, https://fincodelabs.com/en/blog/dxtrade-api
