MetaTrader 5 Account Data & Status API
Read live and static state for a connected MetaTrader 5 account: balance and equity, the static account configuration, open positions and pending orders, trade and position history, and a single connection-health endpoint to confirm the account is logged in and trading-ready.
/mt5/{account_id}/AccountSummarySnapshot of the connected trading account: balance, credit, floating profit, equity, margin, free margin, margin level, leverage, account currency, and account type. Reflects broker-side state at call time — no caching.
curl -H "X-API-Key: fxs_live_..." \
https://api.fxsocket.com/mt5/{account_id}/AccountSummary{
"balance": 9686.15,
"credit": 0.0,
"profit": 0.0,
"equity": 9686.15,
"margin": 0.0,
"freeMargin": 9686.15,
"marginLevel": 0.0,
"leverage": 400,
"currency": "USD",
"type": "Demo"
}/mt5/{account_id}/AccountInfoStatic identity and configuration of the account — the who-and-how that rarely changes, as opposed to the live financials in /AccountSummary. Includes the account holder name, login, broker company and server, currency, leverage, account type, margin mode (Netting / Hedging / Exchange — needed to know whether an opposite order nets a position or opens a new one), stop-out configuration, and trade permissions.
curl -H "X-API-Key: fxs_live_..." \
https://api.fxsocket.com/mt5/{account_id}/AccountInfo{
"name": "Lars Joeressen",
"login": 2100152454,
"server": "TegasFX-Demo",
"company": "TegasFX Ltd",
"currency": "USD",
"currencyDigits": 2,
"leverage": 200,
"type": "Demo",
"marginMode": "Hedging",
"marginSoMode": "Percent",
"marginCallLevel": 100.0,
"stopOutLevel": 70.0,
"tradeAllowed": true,
"tradeExpert": true,
"limitOrders": 200,
"fifoClose": false
}/mt5/{account_id}/OpenedOrdersAll open positions and active pending orders — one row per position (already-filled trade) and one per pending order (limit / stop / stop-limit). kind discriminates the two; pending orders show their trigger price in openPrice and carry zero swap/profit.
curl -H "X-API-Key: fxs_live_..." \
https://api.fxsocket.com/mt5/{account_id}/OpenedOrders[{
"ticket": 211438758,
"symbol": "USDJPY",
"type": "Sell",
"kind": "position",
"lots": 0.1,
"openPrice": 160.505,
"currentPrice": 160.547,
"stopLoss": 160.576,
"takeProfit": 160.458,
"swap": 0.0,
"profit": -2.62,
"magic": 0,
"comment": "",
"openTime": "2026-06-11T11:02:04.000Z"
}, {
"ticket": 211583734,
"symbol": "GBPUSD",
"type": "BuyStop",
"kind": "pending",
"lots": 0.01,
"openPrice": 1.34958,
"currentPrice": 1.33683,
"stopLoss": 1.34611,
"takeProfit": 1.35275,
"swap": 0.0,
"profit": 0.0,
"magic": 0,
"comment": "",
"openTime": "2026-06-10T09:30:00.000Z"
}]/mt5/{account_id}/OrderHistoryClosed deals in a time range. Returns DEAL entries (executions), not ORDER entries — pending orders that never filled don't appear here. Omit both bounds to fetch all-time history.
from— Inclusive lower bound (broker server time). ISO-8601 (2026-01-01T00:00:00Z) or YYYY-MM-DD. Absent → epoch.to— Inclusive upper bound, same formats. Absent → now.
curl -H "X-API-Key: fxs_live_..." \
"https://api.fxsocket.com/mt5/{account_id}/OrderHistory?from=2026-01-01&to=2026-12-31"[{
"ticket": 211438992,
"order": 211438991,
"symbol": "EURUSD",
"type": "Sell",
"entry": "Out",
"volume": 0.1,
"price": 1.15410,
"commission": -0.40,
"swap": 0.0,
"profit": 12.00,
"magic": 0,
"comment": "",
"time": "2026-06-10T15:42:11Z"
}]/mt5/{account_id}/PositionHistoryClosed positions in a time range — one row per round-trip trade (open → close), reconstructed from the underlying deals with volume-weighted open/close prices. Use this when you want net results per position; use /OrderHistory when you need the raw deal log. Omit both bounds to fetch all-time history.
from— Inclusive lower bound (broker server time). ISO-8601 (2026-01-01T00:00:00Z) or YYYY-MM-DD. Absent → epoch.to— Inclusive upper bound, same formats. Absent → now.
curl -H "X-API-Key: fxs_live_..." \
"https://api.fxsocket.com/mt5/{account_id}/PositionHistory?from=2026-01-01&to=2026-12-31"[{
"positionId": 211438758,
"symbol": "EURUSD",
"type": "Buy",
"volume": 0.1,
"openTime": "2026-06-10T09:12:04.000Z",
"openPrice": 1.15201,
"closeTime": "2026-06-10T15:42:11.000Z",
"closePrice": 1.15410,
"profit": 20.90,
"swap": 0.0,
"commission": -0.80,
"netProfit": 20.10,
"magic": 0,
"comment": ""
}]/mt5/{account_id}/statusFull connection health of the terminal, in one call: is the terminal alive, is it connected to the broker, and is the account logged in? Use this to confirm an account is live and trading-ready before sending orders. Always returns HTTP 200 — read the body to see the actual state. The top-level status is ready (everything healthy and the account logged in), starting (still booting / logging in), degraded (e.g. broker disconnected), or down. For lightweight probes there are also two unauthenticated routes that signal via HTTP status code: GET /healthz (200 once fully ready, 503 otherwise) and GET /livez (200 while the terminal is alive, regardless of broker connection).
curl -H "X-API-Key: fxs_live_..." \
https://api.fxsocket.com/mt5/{account_id}/status{
"status": "ready",
"terminal": { "alive": true, "build": 5180, "pingMs": 42 },
"broker": { "connected": true, "server": "TegasFX-Demo" },
"account": {
"loggedIn": true,
"login": 2100152454,
"currency": "USD",
"type": "Demo",
"tradeAllowed": true
},
"bridge": { "version": "0.2.0", "tradeEaReady": true, "symbolsSynced": true },
"serverTime": "2026-06-11T08:55:57.000Z"
}