Positions
Read, modify and close open positions.
GET /v1/accounts/:id/positions
{
"positions": [
{
"ticket": "4737871287", "symbol": "XAUUSD", "brokerSymbol": "XAUUSDm", "side": "buy", "volume": 0.1,
"openPrice": 2411.82, "currentPrice": 2413.4, "stopLoss": 2395,
"takeProfit": null, "profit": 15.8, "swap": -0.12, "openedAt": 1759225600000
}
]
}
GET /v1/accounts/:id/summary
Balance, positions and working orders in one call. marginLevel is equity over margin in
percent (null with nothing open). Under netting, an opposite order shrinks the open
position instead of opening a second one.
{
"account": { "login": "477072059", "currency": "USD", "balance": 7243.1,
"equity": 7258.9, "margin": 48.2, "marginFree": 7210.7, "profit": 15.8,
"leverage": 100, "credit": 0, "marginLevel": 15060.0, "marginMode": "hedging" },
"positions": [ "…" ],
"orders": [ "…" ]
}
PATCH /v1/accounts/:id/positions/:ticket
Change stop loss or take profit. Send at least one. Needs trade; send an
Idempotency-Key.
{ "stopLoss": 2400, "takeProfit": 2440 }
DELETE /v1/accounts/:id/positions/:ticket
Close one position at market, or part of it with ?volume=0.05. Needs trade; send an
Idempotency-Key.
DELETE /v1/accounts/:id/positions
Close every open position. Narrow it with ?symbol=XAUUSD, and with
?filter=profitable or ?filter=losing. Needs trade; send an Idempotency-Key.
{
"result": {
"ok": true, "requested": 50, "closed": 48,
"pending": ["4737871290", "4737871291"],
"failures": [],
"message": "closed 48/50, 2 awaiting broker confirmation"
}
}
Closes go out together rather than one by one: fifty positions close and confirm in
about a second on a typical account. pending lists closes the broker accepted
but had not confirmed when we answered. They are not failures and ok stays true;
re-read positions a moment later. Only failures makes ok false.