Trade
Open a new market position. The trade executes at the current market price.
Endpoint
Section titled “Endpoint”POST /v1/trade
Request Parameters
Section titled “Request Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | Trading symbol (e.g., EURUSD) |
side | string | Yes | Trade direction: buy or sell |
volume | number | Yes | Trade volume in lots. Must respect the symbol’s volume_min, volume_max, and volume_step |
price | number | No | Advisory price. The trade executes at market; this is for reference only |
sl | number | No | Stop loss price |
tp | number | No | Take profit price |
comment | string | No | Trade comment. Max 27 characters, ASCII only. Automatically prefixed with -API |
Example Request
Section titled “Example Request”curl -X POST https://interface.xbtfx.com/v1/trade \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "symbol": "EURUSD", "side": "buy", "volume": 0.1, "sl": 1.08000, "tp": 1.09500 }'Response
Section titled “Response”{ "status": "success", "retcode": 10009, "volume": 0.1, "comment": "-API", "deal": 87654321, "order": 12345678, "price": 1.08757}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
status | string | Result status |
retcode | integer | MT5 return code. 10008 (placed) and 10009 (done) indicate success |
volume | number | Executed volume in lots |
comment | string | Trade comment (includes -API prefix) |
deal | integer | Deal ticket number |
order | integer | Order ticket number |
price | number | Execution price |
- On netting accounts, opening a trade in the same direction as an existing position increases that position. Opening in the opposite direction reduces or closes it. See Hedging vs Netting for details.
- On hedging accounts, each trade creates an independent position.
- Use the Symbols endpoint to verify volume constraints before trading.
- Consider using an idempotency key to prevent duplicate trades on retries.