Fortexa API

Market data for your apps and a trading API for your bots: quotes, candles, account data and order management.

Base URL

https://api.fortexatrade.com

Format

JSON · UTF-8

Signing

HMAC-SHA256

Withdrawals via API

Not available

Machine-readable specification (OpenAPI 3.1) — for code generators and automated clients:

https://api.fortexatrade.com/v1/openapi.json

Overview

The API consists of two parts. Market data is open without a key: instruments, current prices and candles. Trading requires an API key and a signature on every request: account balance, positions, orders and order management.

  • Symbols use the BASE/QUOTE format: BTC/USDT, XAU/USD, EUR/USD. In a URL the slash is encoded as %2F.
  • Times are milliseconds since the Unix epoch (UTC). Dates in positions and orders are ISO 8601 in UTC.
  • Amounts (margin, balance, PnL) are in USD. size is the position notional in USD: margin × leverage. The same volume in lots is lots.
  • Order volume is set either in lots or in USD margin. Lot size depends on the instrument and comes in GET /v1/market/symbols (contractSize): gold — 100 ounces, forex — 100 000 units of the base currency, oil — 1000 barrels, crypto — its own size per instrument (BTC 1 coin, SOL 10, ADA 10 000). The margin for a given number of lots is calculated by the server at the execution price, so there is nothing to compute on your side.
  • Prices in the API are the prices the platform executes at. A market order is filled at the server price, not at a price sent by the client.
  • Market data endpoints can be called from a browser (CORS is open). Trading endpoints are meant for servers: never put your secret into a web page.
  • Real-time WebSocket streams are not part of API v1 yet — poll the ticker endpoint within the rate limits.

API keys

Create keys in your account: Dashboard → API Keys.

SettingHow it works
AccountDemo or real, chosen once when the key is created. The key only sees and trades on that account; switching the mode in the web interface does not affect it.
PermissionsRead-only — account, positions, orders, history. Read & Trade — additionally create, amend, cancel orders and close positions.
IP whitelistOptional: up to 20 IPv4/IPv6 addresses or CIDR subnets. Requests from other addresses get ip_not_allowed. Keys do not expire, with or without a whitelist.
SecretShown only once. The server stores it encrypted and cannot show it again — if lost, delete the key and create a new one.
LimitsUp to 10 active keys per account. If the account is blocked, all its keys stop working.

Authentication

Every trading request carries four headers:

HeaderRequiredValue
X-FX-API-KEYyesYour API key
X-FX-TIMESTAMPyesCurrent time in milliseconds (UTC)
X-FX-RECV-WINDOWnoHow long the request stays valid, ms. Default 5000, maximum 60000
X-FX-SIGNyesHMAC-SHA256 signature in hex
X-FX-SIGN = HEX( HMAC_SHA256( secret, timestamp + apiKey + recvWindow + payload ) )
  • payload for GET is the query string exactly as sent, without ? (empty if there are no parameters).
  • payload for POST is the raw JSON body exactly as sent. Sign and send the same string — do not serialize the object twice.
  • recvWindow in the signed string must equal the X-FX-RECV-WINDOW header; if you omit the header, sign with 5000.
  • A request older than recvWindow is rejected, and a timestamp more than 1 second in the future is rejected too. Keep your clock in sync using GET /v1/time.
  • Each signed POST can be executed only once: sending the same request again returns 409 duplicate_request. To retry, sign the request again with a new timestamp and use clientOrderId so that the order is not created twice.

Reference values to check your implementation:

secret      your-api-secret
apiKey      fx0123456789abcdef0123456789abcd
timestamp   1700000000000
recvWindow  5000

GET /v1/positions?symbol=XAU%2FUSD
payload     symbol=XAU%2FUSD
string      1700000000000fx0123456789abcdef0123456789abcd5000symbol=XAU%2FUSD
X-FX-SIGN   dc2ab26e240569c88af6ed4d68f790ef44f91a27af07893f362927d9cae8280e

POST /v1/orders
payload     {"symbol":"XAU/USD","side":"buy","type":"market","margin":50,"leverage":20}
string      1700000000000fx0123456789abcdef0123456789abcd5000{"symbol":"XAU/USD","side":"buy","type":"market","margin":50,"leverage":20}
X-FX-SIGN   4f274b3465a3019f3342e0998ffaed46ac687549819ec058cfaedc986d7e10fb

Rate limits

EndpointsLimitCounted per
Market data (/v1/time, /v1/market/*)100 requests per secondIP
Signed GET (account, positions, orders)60 requests per secondAPI key
Signed POST (trading)30 requests per secondAPI key

When a limit is exceeded the API returns 429 rate_limited with the header Retry-After: 1.

Errors

Errors come with an HTTP status and a JSON body. Build your logic on code — it is stable; message is for humans and may change.

{
  "code": "invalid_signature",
  "message": "Signature mismatch"
}
HTTPcodeMeaning
400bad_requestInvalid parameters or body, unknown field, broken JSON
400invalid_symbolSymbol is not in the BASE/QUOTE format
400invalid_recv_windowX-FX-RECV-WINDOW outside 1–60000
400leverage_too_highLeverage above maxLeverage of the instrument
400order_rejectedThe platform rejected the order: insufficient funds, below the minimum size, market closed, invalid TP/SL
400rejectedThe platform rejected cancel, amend, close or TP/SL change
401auth_requiredAuthentication headers are missing
401invalid_api_keyKey not found or deleted
401api_key_expiredKey without an IP whitelist has expired
401invalid_signatureSignature does not match
401timestamp_out_of_windowTimestamp is too old or in the future
403ip_not_allowedRequest IP is not in the key whitelist
403permission_deniedRead-only key used for trading
403account_disabledThe account is blocked
404symbol_not_foundInstrument is not traded
404no_quoteNo current price for the instrument
404order_not_foundNo such pending order on the key account
404position_not_foundNo such open position on the key account
409duplicate_requestThis signed request was already executed
409duplicate_client_order_idAn order with this clientOrderId already exists — the message contains its orderId
409order_in_progressAn order with this clientOrderId is still being processed
429rate_limitedRate limit exceeded
500internal_errorInternal error
503service_unavailableA platform service is temporarily unavailable — retry later

Market data

GET/v1/timeNo key

Server time

{
  "serverTime": 1789392600000
}
GET/v1/market/symbolsNo key

Tradable instruments

type: crypto, forex, commodity, index, stock. maxLeverage — maximum leverage; null if the instrument has no separate limit.

{
  "symbols": [
    {
      "symbol": "XAU/USD",
      "name": "Gold",
      "type": "commodity",
      "base": "XAU",
      "quote": "USD",
      "priceDecimals": 2,
      "maxLeverage": 100
    }
  ]
}
GET/v1/market/tickerNo key

Current price of an instrument

ParameterTypeRequiredDescription
symbolstringyesXAU/USD

The price a market order would be executed at right now.

{
  "symbol": "XAU/USD",
  "price": 4273.97,
  "time": 1789392600000
}
GET/v1/market/tickersNo key

Current prices of all instruments

Only instruments with a fresh price are included.

{
  "tickers": [
    { "symbol": "BTC/USDT", "price": 78244.0 },
    { "symbol": "XAU/USD", "price": 4273.97 }
  ],
  "time": 1789392600000
}
GET/v1/market/klinesNo key

Candles

ParameterTypeRequiredDescription
symbolstringyesBTC/USDT
intervalstringno1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w. Default 1h. Monthly (1M) is not supported
limitintegerno1–500, default 200

time — candle open time, candles are sorted from old to new. For forex and metals volume is 0.

{
  "symbol": "BTC/USDT",
  "interval": "1h",
  "klines": [
    { "time": 1789390800000, "open": 77698.01, "high": 78247.45, "low": 77481.98, "close": 78244.0, "volume": 512.13907 }
  ]
}

Trading

All endpoints below require a signature. They work only with the account the key is bound to. Unknown fields in a request body are rejected with bad_request.

GET/v1/accountAPI key

Account and balance

{
  "accountType": "demo",
  "canTrade": true,
  "currency": "USD",
  "balance": {
    "available": 9850.5,
    "locked": 149.5,
    "total": 10000.0
  }
}
GET/v1/positionsAPI key

Open positions

ParameterTypeRequiredDescription
symbolstringnoFilter by instrument
{
  "positions": [ /* position object */ ]
}

Position object:

{
  "positionId": 1542,
  "symbol": "XAU/USD",
  "side": "buy",
  "status": "open",
  "entryPrice": 4268.4,
  "markPrice": 4273.97,
  "size": 1000.0,
  "lots": 0.0023,
  "margin": 50.0,
  "leverage": 20,
  "liquidationPrice": 4054.98,
  "takeProfit": 4300.0,
  "stopLoss": 4220.0,
  "pnl": 1.3,
  "pnlPercent": 2.61,
  "fee": 0.7,
  "swap": 0.6,
  "openedAt": "2026-09-14T13:41:07.512",
  "closedAt": null,
  "closeReason": null
}
GET/v1/positions/historyAPI key

Closed and liquidated positions

ParameterTypeRequiredDescription
symbolstringnoFilter by instrument
limitintegerno1–500, default 50. Newest first

closeReason: manual, TAKE_PROFIT, STOP_LOSS, liquidation and others.

GET/v1/ordersAPI key

Pending limit orders

ParameterTypeRequiredDescription
symbolstringnoFilter by instrument
{
  "orderId": 1543,
  "symbol": "EUR/USD",
  "side": "sell",
  "type": "limit",
  "status": "new",
  "price": 1.162,
  "lots": 0.0427,
  "margin": 100.0,
  "leverage": 50,
  "fee": 1.2,
  "takeProfit": 1.155,
  "stopLoss": null,
  "createdAt": "2026-09-14T13:45:00.118"
}
POST/v1/ordersAPI key · trading

Create an order

ParameterTypeRequiredDescription
symbolstringyesXAU/USD
sidestringyesbuy | sell
typestringyesmarket | limit
lotsnumberlots or marginVolume in lots, > 0. The server converts it to margin at the execution price
marginnumberlots or marginMargin in USD, > 0. The minimum depends on the instrument
leverageintegeryes1 — maxLeverage of the instrument
pricenumberlimit onlyOrder price. Must NOT be sent for market orders
takeProfitnumbernoTake profit price
stopLossnumbernoStop loss price
clientOrderIdstringnoYour ID, 1–36 characters [A-Za-z0-9_-]. Protects against duplicates for 24 hours
  • Volume is set by exactly one of the two fields: lots or margin. Sending both — or neither — is rejected with bad_request.
  • A market order is filled immediately at the current server price.
  • A limit order waits until the market reaches its price and is filled at that price. The price can be on either side of the market.
  • An order and the position it opens share the same ID.
  • Forex, metals and commodities do not trade on weekends: such orders get order_rejected.
  • If a request with the same clientOrderId is repeated, no second order is created — you get duplicate_client_order_id with the existing orderId. A rejected order does not reserve the clientOrderId.

Request by volume in lots:

{
  "symbol": "XAU/USD",
  "side": "buy",
  "type": "market",
  "lots": 0.01,
  "leverage": 100,
  "clientOrderId": "bot-gold-001"
}

Request by margin in USD:

{
  "symbol": "EUR/USD",
  "side": "sell",
  "type": "limit",
  "price": 1.162,
  "margin": 100,
  "leverage": 50,
  "takeProfit": 1.155,
  "clientOrderId": "grid-eu-017"
}

Response for a limit order:

{
  "orderId": 1543,
  "status": "new",
  "clientOrderId": "grid-eu-017",
  "order": { /* order object */ }
}

Response for a market order:

{
  "orderId": 1542,
  "positionId": 1542,
  "status": "filled",
  "clientOrderId": null,
  "position": { /* position object */ }
}
POST/v1/orders/cancelAPI key · trading

Cancel a pending order

The reserved margin is returned to the balance.

// request
{ "orderId": 1543 }

// response
{ "orderId": 1543, "status": "cancelled" }
POST/v1/orders/amendAPI key · trading

Change the price of a pending order

The waiting direction is recalculated from the market at the moment of the change.

// request
{ "orderId": 1543, "price": 1.165 }

// response
{ "order": { /* order object */ } }
POST/v1/positions/closeAPI key · trading

Close a position

The position is closed at the current server price.

// request
{ "positionId": 1542 }

// response
{ "position": { /* position object, status: closed */ } }
POST/v1/positions/tpslAPI key · trading

Set take profit and stop loss

  • A field that is not sent keeps its current level.
  • null removes the level.
  • At least one of the two fields is required.
// move the stop, keep the take profit
{ "positionId": 1542, "stopLoss": 4235 }

// remove the take profit
{ "positionId": 1542, "takeProfit": null }

Costs

A trade costs two things: a round-turn fee and an overnight financing charge. Both are deducted once, when the position is closed: the account receives margin + pnl − fee − swap.

Round-turn fee

Calculated when the position is opened and stored in its fee. It covers both opening and closing — nothing is charged twice. The rate per lot for each instrument is feePerLotUsd in GET /v1/market/symbols. A pending limit order already carries its fee, so you can read it before the fill.

Overnight financing (swap)

A position held through the daily rollover pays for the carry. The rate is a percentage of the position notional per night, separate for long and short: swapLongPctPerDay and swapShortPctPerDay in GET /v1/market/symbols.

  • The rollover happens at swapChargeHourUtc (00:00 UTC). A position opened after it pays for the first time on the next night.
  • Crypto pays every night, weekends included. Forex, metals and oil do not pay on Saturday and Sunday, but pay triple on swapTripleWeekday (0 = Monday) — that covers the weekend carry.
  • The accrued amount is in the swap field of the position and grows every night.
  • Accrued swap eats into the margin, so liquidationPrice of a long-held position moves. Read it from the response instead of deriving it from leverage.

Current rates per night, as a percentage of the notional (authoritative numbers always come from /v1/market/symbols):

InstrumentLongShort
Crypto0.035%0.025%
Gold, silver0.020%0.012%
Oil0.020%0.015%
Forex0.008%0.008%

Code examples

Market data without a key (cURL):

curl "https://api.fortexatrade.com/v1/market/ticker?symbol=XAU%2FUSD"

curl "https://api.fortexatrade.com/v1/market/klines?symbol=BTC%2FUSDT&interval=1h&limit=100"

Python client with signing (requires the requests package):

import hashlib
import hmac
import json
import time
from urllib.parse import urlencode

import requests

BASE_URL = "https://api.fortexatrade.com"
API_KEY = "fx..."          # из кабинета: Dashboard -> API Keys
API_SECRET = "..."         # показывается один раз при создании ключа
RECV_WINDOW = "5000"


def _headers(payload: str) -> dict:
    timestamp = str(int(time.time() * 1000))
    message = timestamp + API_KEY + RECV_WINDOW + payload
    signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest()
    return {
        "X-FX-API-KEY": API_KEY,
        "X-FX-TIMESTAMP": timestamp,
        "X-FX-RECV-WINDOW": RECV_WINDOW,
        "X-FX-SIGN": signature,
        "Content-Type": "application/json",
    }


def get(path: str, params: dict | None = None) -> dict:
    query = urlencode(params or {})
    url = BASE_URL + path + ("?" + query if query else "")
    return requests.get(url, headers=_headers(query), timeout=10).json()


def post(path: str, body: dict) -> dict:
    # Подписываем и отправляем ОДНУ и ту же строку — без повторной сериализации.
    payload = json.dumps(body, separators=(",", ":"))
    return requests.post(BASE_URL + path, data=payload, headers=_headers(payload), timeout=10).json()


print(get("/v1/account"))
print(get("/v1/positions", {"symbol": "XAU/USD"}))

# Сначала на демо-ключе!
order = post("/v1/orders", {
    "symbol": "XAU/USD",
    "side": "buy",
    "type": "limit",
    "price": 4250,
    "margin": 50,
    "leverage": 20,
    "takeProfit": 4300,
    "stopLoss": 4220,
    "clientOrderId": "grid-001",
})
print(order)

Node.js client with signing:

// Node.js 18+ (встроенные fetch и crypto)
import crypto from "node:crypto";

const BASE_URL = "https://api.fortexatrade.com";
const API_KEY = process.env.FX_API_KEY;
const API_SECRET = process.env.FX_API_SECRET;
const RECV_WINDOW = "5000";

function headers(payload) {
  const timestamp = Date.now().toString();
  const signature = crypto
    .createHmac("sha256", API_SECRET)
    .update(timestamp + API_KEY + RECV_WINDOW + payload)
    .digest("hex");
  return {
    "X-FX-API-KEY": API_KEY,
    "X-FX-TIMESTAMP": timestamp,
    "X-FX-RECV-WINDOW": RECV_WINDOW,
    "X-FX-SIGN": signature,
    "Content-Type": "application/json",
  };
}

export async function get(path, params = {}) {
  const query = new URLSearchParams(params).toString();
  const url = BASE_URL + path + (query ? `?${query}` : "");
  const res = await fetch(url, { headers: headers(query) });
  return res.json();
}

export async function post(path, body) {
  // Подписываем и отправляем одну и ту же строку.
  const payload = JSON.stringify(body);
  const res = await fetch(BASE_URL + path, { method: "POST", body: payload, headers: headers(payload) });
  return res.json();
}

console.log(await get("/v1/account"));
console.log(await post("/v1/orders/cancel", { orderId: 1543 }));

Security recommendations

  • Keep the secret only on your server, in environment variables or a secrets store — not in code repositories.
  • Always add an IP whitelist to trading keys.
  • Use read-only keys for monitoring and analytics.
  • Create a separate key for each bot, so that one can be revoked without stopping the others.
  • Test a strategy on a demo key first, then create a real-account key.
  • If a secret leaks, delete the key in the dashboard immediately — it stops working at once.
Trading with leverage carries a high risk of losing funds. Automated strategies can lose money quickly — control your risks.