Skip to content

Trade

Open a new market position. The trade executes at the current market price.

POST /v1/trade

ParameterTypeRequiredDescription
symbolstringYesTrading symbol (e.g., EURUSD)
sidestringYesTrade direction: buy or sell
volumenumberYesTrade volume in lots. Must respect the symbol’s volume_min, volume_max, and volume_step
pricenumberNoAdvisory price. The trade executes at market; this is for reference only
slnumberNoStop loss price
tpnumberNoTake profit price
commentstringNoTrade comment. Max 27 characters, ASCII only. Automatically prefixed with -API
Terminal window
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
}'
{
"status": "placed",
"retcode": 10008,
"volume": 0.10,
"comment": ""
}

Retcodes: 10008 = order placed (market execution), 10009 = done. Both indicate success.

FieldTypeDescription
statusstringplaced or filled or rejected
retcodeintegerMT5 return code. 10008 (placed) and 10009 (done) indicate success
volumenumberExecuted volume in lots
commentstringTrade comment (includes -API prefix)
dealintegerDeal ticket number (present when status is filled)
orderintegerOrder ticket number (present when status is filled)
pricenumberExecution price (present when status is filled)
  • 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.