Skip to content

Reverse

POST /v1/reverse | Weight: 2

Close a position and open the opposite side with the same volume. This is an atomic two-step operation. If the close succeeds but the open fails, returns 207 Multi-Status with a warning.

ParameterTypeRequiredDescription
ticketnumberYesPosition ticket to reverse
commentstringNoOrder comment. Max 27 characters, ASCII only.
Terminal window
curl -X POST https://interface.xbtfx.com/v1/reverse \
-H "Authorization: Bearer xbtfx_live_..." \
-H "Content-Type: application/json" \
-d '{ "ticket": 12345678 }'
{
"close": {
"status": "filled",
"deal": 99001,
"price": 1.08620
},
"open": {
"status": "filled",
"deal": 99002,
"order": 88002,
"volume": 0.10,
"price": 1.08625,
"side": "sell"
}
}
{
"close": { "status": "filled", "deal": 99001, "price": 1.08620 },
"open": { "status": "rejected", "retcode": 10006, "message": "Trade rejected" },
"warning": "Position was closed but reverse open failed. Re-enter manually."
}
FieldTypeDescription
close.statusstringfilled or rejected
close.dealnumberDeal ticket for the close
close.pricenumberClose execution price
open.statusstringfilled or rejected
open.dealnumberDeal ticket for the new position
open.ordernumberOrder ticket for the new position
open.volumenumberVolume of the new position
open.pricenumberOpen execution price
open.sidestringbuy or sell
warningstringPresent on 207 — explains partial failure