跳到主要内容

机器人下单

机器人专用下单接口,不冻结保证金、不落库,直接发送到撮合引擎。

🔒 需要 IP 白名单授权。

接口信息

  • 方法: POST
  • 路径: /fapi/v1/bot/orders

请求参数(Body)

参数类型必填说明
symbolstring交易对
sideinteger方向:1=买,2=卖
position_sideinteger仓位方向:1=做多,2=做空(单向模式下=1)
position_actioninteger动作:1=开仓,2=平仓
typeinteger类型:1=限价,2=市价
pricestring条件价格(限价单必填)
qtystring合约数量
leverageinteger杠杆倍数(开仓时使用)
margin_modeinteger保证金模式:1=逐仓,2=全仓
time_in_forceinteger有效期:1=GTC(默认),2=IOC,3=FOK,4=GTX(只做 Maker)
reduce_onlyboolean只减仓
client_order_idstring客户端订单 ID
need_cacheboolean机器人订单是否缓存(默认 false)

请求示例

POST /fapi/v1/bot/orders
{
"symbol": "BTC_USDT",
"side": 1,
"position_side": 1,
"position_action": 1,
"type": 1,
"price": "68500",
"qty": "0.1",
"leverage": 10,
"margin_mode": 1,
"time_in_force": 1,
"client_order_id": "bot-order-001",
"need_cache": true
}

响应字段

响应字段同"下单"接口。

字段类型说明
codeinteger状态码
messagestring返回消息
data.order_idstring订单 ID
data.client_order_idstring客户端订单 ID
data.statusinteger订单状态
data.filled_qtystring已成交数量
data.filled_quotestring已成交金额

响应示例

{
"code": 0,
"message": "success",
"data": {
"order_id": "1234567890123456789",
"client_order_id": "bot-order-001",
"status": 1,
"filled_qty": "0",
"filled_quote": "0"
}
}