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.
Request Parameters
Section titled “Request Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
ticket | number | Yes | Position ticket to reverse |
comment | string | No | Order comment. Max 27 characters, ASCII only. |
Example Request
Section titled “Example Request”curl -X POST https://interface.xbtfx.com/v1/reverse \ -H "Authorization: Bearer xbtfx_live_..." \ -H "Content-Type: application/json" \ -d '{ "ticket": 12345678 }'Response (200 — Full Success)
Section titled “Response (200 — Full Success)”{ "close": { "status": "filled", "deal": 99001, "price": 1.08620 }, "open": { "status": "filled", "deal": 99002, "order": 88002, "volume": 0.10, "price": 1.08625, "side": "sell" }}Response (207 — Partial Failure)
Section titled “Response (207 — Partial Failure)”{ "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."}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
close.status | string | filled or rejected |
close.deal | number | Deal ticket for the close |
close.price | number | Close execution price |
open.status | string | filled or rejected |
open.deal | number | Deal ticket for the new position |
open.order | number | Order ticket for the new position |
open.volume | number | Volume of the new position |
open.price | number | Open execution price |
open.side | string | buy or sell |
warning | string | Present on 207 — explains partial failure |