Skip to main content

Create Trigger Orders

Type: POST

Description: /future/trade/v1/entrust/create-plan

Remark: Content-Type = application/x-www-form-urlencoded && application/json

Limit Flow Rules

200/s/apikey

Parameters

NameTypeMandatoryDefaultDescriptionRanges
clientOrderIdstringfalseN/AClient order ID
symbolstringtrueTrading pair
orderSidestringtrueN/AOrder side: BUY; SELLBUY;SELL
entrustTypestringtrueN/AOrder type: TAKE_PROFIT (Take Profit Limit Order); STOP (Stop Limit Order); TAKE_PROFIT_MARKET (Take Profit Market Order); STOP_MARKET (Stop Loss Market Order)TAKE_PROFIT;STOP;TAKE_PROFIT_MARKET;STOP_MARKET
origQtynumbertrueN/AQuantity (Cont)
pricenumberfalseN/APrice
stopPricenumbertrueN/ATrigger price
timeInForcestringtrueN/AValid way: GTC; IOC; FOK; GTX. Market orders only support IOCGTC;IOC;FOK;GTX
triggerPriceTypestringtrueN/ATrigger price type: INDEX_PRICE (Index price); MARK_PRICE (Mark price); LATEST_PRICE (latest price)INDEX_PRICE;MARK_PRICE;LATEST_PRICE
positionSidestringtrueN/APosition side: LONG; SHORTLONG;SHORT

Request Example

curl -X POST "https://fapi.xt.com/future/trade/v1/entrust/create-plan" \
-H "validate-appkey: $APPKEY" \ # Required
-H "validate-timestamp: $TIMESTAMP" \ # Required
-H "validate-singature: $SINGATURE" \ # Required
-H "Content-Type: application/x-www-form-urlencoded" \ # Required
-d "symbol=btc_usdt" \ # Required
-d "orderSide=BUY" \ # Required
-d "entrustType=STOP" \ # Required
-d "origQty=1" \ # Required
-d "stopPrice=999" \ # Required
-d "timeInForce=IOC" \ # Required
-d "triggerPriceType=LATEST_PRICE" \ # Required
-d "positionSide=LONG" # Ture

Request Example

Response
{
"error": {
"code": "",
"msg": ""
},
"msgInfo": "",
"result": {},
"returnCode": 0
}

Error code

Error codeDescription
deposit_coupon_existsMargin coupon already exists
exist_bonus_positon_not_create_reverse_positionReverse position not allowed when a bonus position exists
invalid_paramsRequired parameter missing
invalid_priceInvalid price; take-profit/stop-loss limit price validation failed
market_plan_entrust_must_be_ioc_or_fokMarket TP/SL order must use IOC or FOK
invalid_stop_priceInvalid stop price
invalid_quantity_scaleOrder quantity must be an integer
invalid_trigger_profit_priceInvalid take-profit trigger price
invalid_time_in_forcetimeInForce validation failed for planned take-profit order
on_board_30_minutes_limit_order_price_limitLimit order price restriction within first 30 minutes after listing