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.jsonOverview
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.
sizeis the position notional in USD: margin × leverage. The same volume in lots islots. - 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.
| Setting | How it works |
|---|---|
| Account | Demo 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. |
| Permissions | Read-only — account, positions, orders, history. Read & Trade — additionally create, amend, cancel orders and close positions. |
| IP whitelist | Optional: 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. |
| Secret | Shown only once. The server stores it encrypted and cannot show it again — if lost, delete the key and create a new one. |
| Limits | Up to 10 active keys per account. If the account is blocked, all its keys stop working. |
Authentication
Every trading request carries four headers:
| Header | Required | Value |
|---|---|---|
X-FX-API-KEY | yes | Your API key |
X-FX-TIMESTAMP | yes | Current time in milliseconds (UTC) |
X-FX-RECV-WINDOW | no | How long the request stays valid, ms. Default 5000, maximum 60000 |
X-FX-SIGN | yes | HMAC-SHA256 signature in hex |
X-FX-SIGN = HEX( HMAC_SHA256( secret, timestamp + apiKey + recvWindow + payload ) )payloadfor GET is the query string exactly as sent, without?(empty if there are no parameters).payloadfor POST is the raw JSON body exactly as sent. Sign and send the same string — do not serialize the object twice.recvWindowin 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 4f274b3465a3019f3342e0998ffaed46ac687549819ec058cfaedc986d7e10fbRate limits
| Endpoints | Limit | Counted per |
|---|---|---|
| Market data (/v1/time, /v1/market/*) | 100 requests per second | IP |
| Signed GET (account, positions, orders) | 60 requests per second | API key |
| Signed POST (trading) | 30 requests per second | API 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"
}| HTTP | code | Meaning |
|---|---|---|
| 400 | bad_request | Invalid parameters or body, unknown field, broken JSON |
| 400 | invalid_symbol | Symbol is not in the BASE/QUOTE format |
| 400 | invalid_recv_window | X-FX-RECV-WINDOW outside 1–60000 |
| 400 | leverage_too_high | Leverage above maxLeverage of the instrument |
| 400 | order_rejected | The platform rejected the order: insufficient funds, below the minimum size, market closed, invalid TP/SL |
| 400 | rejected | The platform rejected cancel, amend, close or TP/SL change |
| 401 | auth_required | Authentication headers are missing |
| 401 | invalid_api_key | Key not found or deleted |
| 401 | api_key_expired | Key without an IP whitelist has expired |
| 401 | invalid_signature | Signature does not match |
| 401 | timestamp_out_of_window | Timestamp is too old or in the future |
| 403 | ip_not_allowed | Request IP is not in the key whitelist |
| 403 | permission_denied | Read-only key used for trading |
| 403 | account_disabled | The account is blocked |
| 404 | symbol_not_found | Instrument is not traded |
| 404 | no_quote | No current price for the instrument |
| 404 | order_not_found | No such pending order on the key account |
| 404 | position_not_found | No such open position on the key account |
| 409 | duplicate_request | This signed request was already executed |
| 409 | duplicate_client_order_id | An order with this clientOrderId already exists — the message contains its orderId |
| 409 | order_in_progress | An order with this clientOrderId is still being processed |
| 429 | rate_limited | Rate limit exceeded |
| 500 | internal_error | Internal error |
| 503 | service_unavailable | A platform service is temporarily unavailable — retry later |
Market data
/v1/timeNo keyServer time
{
"serverTime": 1789392600000
}/v1/market/symbolsNo keyTradable 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
}
]
}/v1/market/tickerNo keyCurrent price of an instrument
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | yes | XAU/USD |
The price a market order would be executed at right now.
{
"symbol": "XAU/USD",
"price": 4273.97,
"time": 1789392600000
}/v1/market/tickersNo keyCurrent 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
}/v1/market/klinesNo keyCandles
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | yes | BTC/USDT |
interval | string | no | 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w. Default 1h. Monthly (1M) is not supported |
limit | integer | no | 1–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.
/v1/accountAPI keyAccount and balance
{
"accountType": "demo",
"canTrade": true,
"currency": "USD",
"balance": {
"available": 9850.5,
"locked": 149.5,
"total": 10000.0
}
}/v1/positionsAPI keyOpen positions
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | no | Filter 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
}/v1/positions/historyAPI keyClosed and liquidated positions
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | no | Filter by instrument |
limit | integer | no | 1–500, default 50. Newest first |
closeReason: manual, TAKE_PROFIT, STOP_LOSS, liquidation and others.
/v1/ordersAPI keyPending limit orders
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | no | Filter 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"
}/v1/ordersAPI key · tradingCreate an order
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | yes | XAU/USD |
side | string | yes | buy | sell |
type | string | yes | market | limit |
lots | number | lots or margin | Volume in lots, > 0. The server converts it to margin at the execution price |
margin | number | lots or margin | Margin in USD, > 0. The minimum depends on the instrument |
leverage | integer | yes | 1 — maxLeverage of the instrument |
price | number | limit only | Order price. Must NOT be sent for market orders |
takeProfit | number | no | Take profit price |
stopLoss | number | no | Stop loss price |
clientOrderId | string | no | Your 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 */ }
}/v1/orders/cancelAPI key · tradingCancel a pending order
The reserved margin is returned to the balance.
// request
{ "orderId": 1543 }
// response
{ "orderId": 1543, "status": "cancelled" }/v1/orders/amendAPI key · tradingChange 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 */ } }/v1/positions/closeAPI key · tradingClose a position
The position is closed at the current server price.
// request
{ "positionId": 1542 }
// response
{ "position": { /* position object, status: closed */ } }/v1/positions/tpslAPI key · tradingSet take profit and stop loss
- A field that is not sent keeps its current level.
nullremoves 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
swapfield of the position and grows every night. - Accrued swap eats into the margin, so
liquidationPriceof 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):
| Instrument | Long | Short |
|---|---|---|
| Crypto | 0.035% | 0.025% |
| Gold, silver | 0.020% | 0.012% |
| Oil | 0.020% | 0.015% |
| Forex | 0.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.