MT5 — Positions
List open positions
GET /api/external/instances/{accountId}/positions
curl -s "$ATLAS_BASE_URL/api/external/instances/5012345/positions" \
-H "Authorization: Bearer $ATLAS_API_KEY"
{
"success": true,
"data": [
{
"ticket": 123456789,
"symbol": "EURUSD",
"type": "BUY",
"volume": 0.10,
"openPrice": 1.08420,
"currentPrice": 1.08550,
"sl": 0,
"tp": 0,
"profit": 13.0,
"swap": -0.2,
"openTime": 1716631200
}
]
}
Get a single position
GET /api/external/instances/{accountId}/positions/{ticket} — returns 404 if the ticket is not
currently open.
curl -s "$ATLAS_BASE_URL/api/external/instances/5012345/positions/123456789" \
-H "Authorization: Bearer $ATLAS_API_KEY"
Modify a position (SL/TP)
PATCH /api/external/instances/{accountId}/positions/{ticket} — body must include at least one of
sl / tp.
curl -s -X PATCH "$ATLAS_BASE_URL/api/external/instances/5012345/positions/123456789" \
-H "Authorization: Bearer $ATLAS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "sl": 1.08000, "tp": 1.09000 }'
Trailing stops are not available over REST — see What you cannot do.
Close a position (full or partial)
POST /api/external/instances/{accountId}/positions/{ticket}/close — send { "volume": <lots> }
for a partial close; an empty body closes the full position.
# Full close
curl -s -X POST "$ATLAS_BASE_URL/api/external/instances/5012345/positions/123456789/close" \
-H "Authorization: Bearer $ATLAS_API_KEY"
# Partial close (0.05 lots)
curl -s -X POST "$ATLAS_BASE_URL/api/external/instances/5012345/positions/123456789/close" \
-H "Authorization: Bearer $ATLAS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "volume": 0.05 }'
Close all positions for a symbol
POST /api/external/instances/{accountId}/positions/close-by-symbol — body { "symbol": "EURUSD" }.
curl -s -X POST "$ATLAS_BASE_URL/api/external/instances/5012345/positions/close-by-symbol" \
-H "Authorization: Bearer $ATLAS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "symbol": "EURUSD" }'
{
"success": true,
"data": {
"symbol": "EURUSD",
"closedCount": 2,
"totalProfit": 150.50,
"positions": [
{ "ticket": 123456789, "symbol": "EURUSD", "type": "BUY", "volume": 0.10, "profit": 75.25, "closePrice": 1.08550 }
]
}
}