Yellow BoxTrading APIv1 · pre-release

Trade

PUTModify position SL/TP (TRADE)

API Description

Sets the stop loss and take profit on an open position.

HTTP Request

HTTP
PUT /v1/position

Request Weight

1 (1 against ORDERS)

Request Parameters

Name Type Mandatory Description
login LONG YES
positionId LONG YES
sl DECIMAL NO New stop loss. Send 0 to clear. Omit to leave unchanged.
tp DECIMAL NO New take profit. Send 0 to clear. Omit to leave unchanged.
newClientOrderId STRING NO Idempotency key for this modification.
recvWindow, timestamp, signature

At least one of sl / tp (-1102 otherwise). A request that would change nothing is -5005. -2023 if the position does not exist on this login. A negative level is -4001.

Both levels must be multiples of tickSize (-4008) and keep stopsLevel points from the market on the position's closing side — bid for a BUY position, ask for a SELL (-4009). A level being changed that currently sits inside freezeLevel of that price cannot be modified (-4021).

Response Example

JSON
{
  "login": 100123,
  "positionId": 44412345,
  "clientOrderId": "bot-sltp-1",
  "symbol": "XAUUSD",
  "side": "BUY",
  "volume": "0.10",
  "sl": "2325.00",
  "tp": "2350.00",
  "status": "FILLED",
  "mt5RetCode": 10009,
  "transactTime": 1789012500110
}

status is FILLED when the trade server confirmed the change, ACCEPTED when it is still queued after the 5-second wait (see Known limitations). clientOrderId is this modification's id — yours, or a generated one. sl / tp are the levels sent, "0" meaning none. volume is the position's volume when the change was made; it may be absent on an idempotent replay.