创建触发订单
类型: POST
描述: /future/trade/v1/entrust/create-plan
备注: Content-Type = application/x-www-form-urlencoded && application/json
限流规则
200/s/apikey
参数
| 名称 | 类型 | 必填 | 默认值 | 描述 | 范围 |
|---|---|---|---|---|---|
| clientOrderId | string | false | N/A | 客户端订单ID | |
| symbol | string | true | 交易对 | ||
| orderSide | string | true | N/A | 订单方向:BUY(买入);SELL(卖出) | BUY;SELL |
| entrustType | string | true | N/A | 委托类型:TAKE_PROFIT(止盈限价单);STOP(止损限价单);TAKE_PROFIT_MARKET(止盈市价单);STOP_MARKET(止损市价单) | TAKE_PROFIT;STOP;TAKE_PROFIT_MARKET;STOP_MARKET |
| origQty | number | true | N/A | 数量(张) | |
| price | number | false | N/A | 价格 | |
| stopPrice | number | true | N/A | 触发价格 | |
| timeInForce | string | true | N/A | 有效方式:GTC;IOC;FOK;GTX。市价单仅支持IOC | GTC;IOC;FOK;GTX |
| triggerPriceType | string | true | N/A | 触发价格类型:INDEX_PRICE(指数价格);MARK_PRICE(标记价格);LATEST_PRICE(最新价格) | INDEX_PRICE;MARK_PRICE;LATEST_PRICE |
| positionSide | string | true | N/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 分钟内限价单价格限制 |