Close By
POST /v1/close-by | Weight: 1
Net two opposing positions on the same symbol via MT5 CLOSE_BY, saving the spread on the smaller side.
Request Parameters
Section titled “Request Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
position | number | Yes | First position ticket |
position_by | number | Yes | Opposing position ticket (same symbol, opposite side) |
comment | string | No | Order comment. Max 27 characters, ASCII only. |
Example Request
Section titled “Example Request”curl -X POST https://interface.xbtfx.com/v1/close-by \ -H "Authorization: Bearer xbtfx_live_..." \ -H "Content-Type: application/json" \ -d '{ "position": 12345678, "position_by": 12346789 }'Response
Section titled “Response”{ "status": "ok", "position": 12345, "position_by": 12346, "retcode": 10009}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
status | string | ok or rejected |
position | number | First position ticket |
position_by | number | Second position ticket |
retcode | number | MT5 execution result code |