跳到主要内容

创建触发订单

类型: POST

描述: /future/trade/v1/entrust/create-plan

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

限流规则

200/s/apikey

参数

名称类型必填默认值描述范围
clientOrderIdstringfalseN/A客户端订单ID
symbolstringtrue交易对
orderSidestringtrueN/A订单方向:BUY(买入);SELL(卖出)BUY;SELL
entrustTypestringtrueN/A委托类型:TAKE_PROFIT(止盈限价单);STOP(止损限价单);TAKE_PROFIT_MARKET(止盈市价单);STOP_MARKET(止损市价单)TAKE_PROFIT;STOP;TAKE_PROFIT_MARKET;STOP_MARKET
origQtynumbertrueN/A数量(张)
pricenumberfalseN/A价格
stopPricenumbertrueN/A触发价格
timeInForcestringtrueN/A有效方式:GTC;IOC;FOK;GTX。市价单仅支持IOCGTC;IOC;FOK;GTX
triggerPriceTypestringtrueN/A触发价格类型:INDEX_PRICE(指数价格);MARK_PRICE(标记价格);LATEST_PRICE(最新价格)INDEX_PRICE;MARK_PRICE;LATEST_PRICE
positionSidestringtrueN/A持仓方向:LONG(多头);SHORT(空头)LONG;SHORT

请求示例

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

返回示例

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

错误码

错误码描述
deposit_coupon_exists保证金优惠券已存在
exist_bonus_positon_not_create_reverse_position不允许创建反向仓位(存在赠金仓位)
invalid_params有必填参数未填写
invalid_price某个价格参数填写有误;计划止盈/止损限价校验失败
market_plan_entrust_must_be_ioc_or_fok市价止盈/止损委托必须为 IOC 或 FOK
invalid_stop_price止损价格有误
invalid_quantity_scale下单数量必须是整数
invalid_trigger_profit_price触发止盈价格有误
invalid_time_in_force计划委托止盈的 timeInForce 校验失败
on_board_30_minutes_limit_order_price_limit上板后 30 分钟内限价单价格限制