Welcome to the new WEEX API documentation. Looking for the previous version?Switch to the legacy docs
WEEX

Place TP/SL Conditional Orders (TRADE)

  • POST /capi/v3/placeTpSlOrder

Request Weight

1 on 10s order rate limit(X-ORDER-COUNT-10S); 1 on 1min order rate limit(X-ORDER-COUNT-1M); 0 on IP rate limit(X-USED-WEIGHT-1M);

Request parameters

ParameterTypeRequired?Description
symbolStringYesTrading pair.
clientAlgoIdStringYesClient-defined identifier (1-36 characters, pattern ^[\\.A-Z\:/a-z0-9_-]{1,36}$).
planTypeStringYesPlan type. Values: TAKE_PROFIT, STOP_LOSS.
triggerPriceStringYesTrigger price (> 0).
executePriceStringConditionalExecution price. Set to 0 or omit for market execution. Copy-trading API keys only support market close, so this field must be 0 or omitted.
quantityStringNoQuantity to execute. Set to 0 or omit to set TP/SL for the full position. Copy-trading API keys must close the full position, so this field must be 0 or omitted.
positionSideStringYesPosition side (LONG, SHORT).
triggerPriceTypeStringNoTrigger source. CONTRACT_PRICE or MARK_PRICE. Default CONTRACT_PRICE.
reduceOnlyBooleanNoWhether the order is reduce-only.
Request example
PowerShellCode
curl -X POST "https://api-contract.weex.com/capi/v3/placeTpSlOrder" \ -H "ACCESS-KEY:*******" \ -H "ACCESS-SIGN:*******" \ -H "ACCESS-PASSPHRASE:*****" \ -H "ACCESS-TIMESTAMP:1659076670000" \ -H "Content-Type: application/json" \ -d '{ "symbol": "BTCUSDT", "clientAlgoId": "tp-20240201-1", "planType": "TAKE_PROFIT", "triggerPrice": "70500", "executePrice": "70500", "quantity": "0.01", "positionSide": "LONG", "triggerPriceType": "MARK_PRICE", "reduceOnly": false }'
Response parameters

Returns an array of objects with the following fields:

FieldTypeDescription
successBooleanWhether the plan order was accepted.
orderIdLongPlan order ID when successful.
errorCodeStringError code when success = false.
errorMessageStringError description when success = false.
Response example
JSONCode
[ { "success": true, "orderId": 812345678901234900, "errorCode": "", "errorMessage": "" } ]