跳到主要内容

交易请求

下新的订单 (TRADE)

{
"id": "56374a46-3061-486b-a311-99ee972eb648",
"method": "order.place",
"params": {
"symbol": "BTCUSDT",
"side": "SELL",
"type": "LIMIT",
"timeInForce": "GTC",
"price": "23416.10000000",
"quantity": "0.00847000",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "15af09e41c36f3cc61378c2fbe2c33719a03dd5eba8d0f9206fbda44de717c88",
"timestamp": 1660801715431
}
}

下新的订单。

权重: 1

参数:

名称类型是否必需描述
symbolSTRINGYES
sideENUMYESBUY 或者 SELL
typeENUMYES
timeInForceENUMNO *
priceDECIMALNO *
quantityDECIMALNO *
quoteOrderQtyDECIMALNO *
newClientOrderIdSTRINGNO客户自定义的唯一订单ID。如果未发送,则自动生成。
newOrderRespTypeENUMNO

可选的响应格式: ACKRESULTFULL.

MARKETLIMIT订单默认使用FULL,其他订单类型默认使用ACK

stopPriceDECIMALNO *
trailingDeltaINTNO *请看 Trailing Stop order FAQ
icebergQtyDECIMALNO
strategyIdLONGNO标识订单策略中订单的任意ID。
strategyTypeINTNO

标识订单策略的任意数值。

小于1000000的值是保留的,不能使用。

selfTradePreventionModeENUMNO允许的 ENUM 取决于交易对的配置。支持值:STP 模式
apiKeySTRINGYES
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

根据订单 type某些参数(*) 可能成为必需参数:

订单 type 强制要求的参数
LIMIT
  • timeInForce
  • price
  • quantity
LIMIT_MAKER
  • price
  • quantity
MARKET
  • quantity 或者 quoteOrderQty
STOP_LOSS
  • quantity
  • stopPrice 或者 trailingDelta
STOP_LOSS_LIMIT
  • timeInForce
  • price
  • quantity
  • stopPrice 或者 trailingDelta
TAKE_PROFIT
  • quantity
  • stopPrice 或者 trailingDelta
TAKE_PROFIT_LIMIT
  • timeInForce
  • price
  • quantity
  • stopPrice 或者 trailingDelta

支持的订单类型:

订单 type 描述
LIMIT

以指定的 price 或更好的 price, 买入或卖出 quantity

LIMIT_MAKER

LIMIT 订单,如果它立即匹配并成为吃单方将被拒绝。

此订单类型也称为 POST-ONLY 订单。

MARKET

以最佳市场价格买入或卖出。

  • 带有 quantity 参数的 MARKET 订单指定您要BUY或SELL的base asset的数量。 报价资产的实际执行quantity将取决于可用的市场流动性。

    例如,在 BTCUSDT 下 "quantity": "0.1000" 的市场买单,指定您想以最优惠的价格 BUY 0.1 BTC。 如果以最优价格没有足够的 BTC,会继续以次优价格买入,直到您的订单被执行,或者您的 USDT 用完,或者市场上的 BTC 用完。

  • 使用 quoteOrderQtyMARKET 订单 明确的是通过买入(或卖出)想要花费(或获取)的 quote asset 数量。 基础资产的实际执行数量将取决于可用的市场流动性。

    例如,在 BTCUSDT 下 "quoteOrderQty": "100.00" 的市场买单,指定您想以最优惠的价格以 100 USDT 购买尽可能多的 BTC。 同样,卖出订单将卖出尽可能多的可用 BTC,以便您获得 100 USDT(佣金前)。

STOP_LOSS

当满足指定条件时,执行给定 quantityMARKET 订单。

I.e., 当达到 stopPrice 或激活 trailingDelta 时。

STOP_LOSS_LIMIT

当满足指定条件时,执行给定参数的 LIMIT 订单。

TAKE_PROFIT

STOP_LOSS 类似,但在市场价格向有利方向移动时激活。

TAKE_PROFIT_LIMIT

STOP_LOSS_LIMIT 类似,但在市场价格向有利方向移动时激活。

可用的 timeInForce 选项,设置订单在到期前应该活跃多长时间:

TIF描述
GTCGood 'til Canceled – 成交为止。订单会一直有效,直到被成交或者取消。
IOCImmediate 或者 Cancel – 无法立即成交的部分就撤销。订单在失效前会尽量多的成交。
FOKFill 或者 Kill – 无法全部立即成交就撤销。如果无法全部成交,订单会失效。

备注:

  • newClientOrderId 指定订单的 clientOrderId 值。

    仅当前一个订单已成交或过期时,才会接受具有相同 clientOrderId 的新订单。

  • 任何 LIMITLIMIT_MAKER 订单都可以通过指定 icebergQty 变成冰山订单。

    带有 icebergQty 的订单必须将 timeInForce 设置为 GTC

  • STOP_LOSS/TAKE_PROFIT 订单的触发订单价格规则:

    • stopPrice 必须高于市场价格:STOP_LOSS BUYTAKE_PROFIT SELL
    • stopPrice 必须低于市场价格:STOP_LOSS SELLTAKE_PROFIT BUY
  • 使用 quoteOrderQtyMARKET 订单遵循 LOT_SIZE 过滤规则。

    该订单将执行一个名义价值尽可能接近请求的 quoteOrderQty 的数量。

数据源: 撮合引擎

响应: 使用 newOrderRespType 参数可以选择响应格式。

ACK 响应类型:

{
"id": "56374a46-3061-486b-a311-99ee972eb648",
"status": 200,
"result": {
"symbol": "BTCUSDT",
"orderId": 12569099453,
"orderListId": -1, // 单个订单会一直是 -1
"clientOrderId": "4d96324ff9d44481926157ec08158a40",
"transactTime": 1660801715639
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 1
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 1
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

RESULT 响应类型:

{
"id": "56374a46-3061-486b-a311-99ee972eb648",
"status": 200,
"result": {
"symbol": "BTCUSDT",
"orderId": 12569099453,
"orderListId": -1, // 单个订单会一直是 -1
"clientOrderId": "4d96324ff9d44481926157ec08158a40",
"transactTime": 1660801715639,
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"workingTime": 1660801715639,
"selfTradePreventionMode": "NONE"
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 1
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 1
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

FULL 响应类型:

{
"id": "56374a46-3061-486b-a311-99ee972eb648",
"status": 200,
"result": {
"symbol": "BTCUSDT",
"orderId": 12569099453,
"orderListId": -1,
"clientOrderId": "4d96324ff9d44481926157ec08158a40",
"transactTime": 1660801715793,
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00847000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "198.33521500",
"status": "FILLED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"workingTime": 1660801715639,
// FULL 响应与 RESULT 响应相同,具有相同的可选字段基于订单类型和参数。FULL响应还包括立即完成订单的交易列表。
"fills": [
{
"price": "23416.10000000",
"qty": "0.00635000",
"commission": "0.000000",
"commissionAsset": "BNB",
"tradeId": 1650422481
},
{
"price": "23416.50000000",
"qty": "0.00212000",
"commission": "0.000000",
"commissionAsset": "BNB",
"tradeId": 1650422482
}
],
"selfTradePreventionMode": "NONE"
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 1
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 1
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

订单响应中的特定条件时才会出现的字段

订单响应中的有一些字段仅在满足特定条件时才会出现。这些订单响应可以来自下订单,查询订单或取消订单,并且可以包括订单列表类型。 下面列出了这些字段:

名称描述显示的条件示例
icebergQty冰山订单的数量。只有在请求中发送 icebergQty 参数时才会出现。"icebergQty": "0.00000000"
preventedMatchIdsymbol 结合使用时,可用于查询因为 STP 导致订单失效的过期订单。只有在因为 STP 导致订单失效时可见。"preventedMatchId": 0
preventedQuantity因为 STP 导致订单失效的数量。只有在因为 STP 导致订单失效时可见。"preventedQuantity": "1.200000"
stopPrice用于设置逻辑订单中的触发价。STOP_LOSSTAKE_PROFITSTOP_LOSS_LIMITTAKE_PROFIT_LIMIT 订单时可见。"stopPrice": "23500.00000000"
strategyId策略单ID; 用以关联此订单对应的交易策略。如果在请求中添加了参数,则会出现。"strategyId": 37463720
strategyType策略单类型; 用以显示此订单对应的交易策略。如果在请求中添加了参数,则会出现。"strategyType": 1000000
trailingDelta用以定义追踪止盈止损订单被触发的价格差。出现在追踪止损订单中。"trailingDelta": 10
trailingTime追踪单被激活和跟踪价格变化的时间。出现在追踪止损订单中。"trailingTime": -1
usedSor用于确定订单是否使用SOR的字段在使用SOR下单时出现"usedSor": true
workingFloor用以定义订单是通过 SOR 还是由订单提交到的订单薄(order book)成交的。出现在使用了 SOR 的订单中。"workingFloor": "SOR"

测试下单 (TRADE)

{
"id": "6ffebe91-01d9-43ac-be99-57cf062e0e30",
"method": "order.test",
"params": {
"symbol": "BTCUSDT",
"side": "SELL",
"type": "LIMIT",
"timeInForce": "GTC",
"price": "23416.10000000",
"quantity": "0.00847000",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "15af09e41c36f3cc61378c2fbe2c33719a03dd5eba8d0f9206fbda44de717c88",
"timestamp": 1660801715431
}
}

测试下单。

验证新订单参数并验证您的签名但不会将订单发送到撮合引擎。

权重:

条件请求权重
没有 computeCommissionRates1
computeCommissionRates20

参数:

除了 order.place 的所有参数, 下面参数也有效:

参数名类型是否必需描述
computeCommissionRatesBOOLEANNO默认: false

数据源: 缓存

响应:

没有 computeCommissionRates:

{
"id": "6ffebe91-01d9-43ac-be99-57cf062e0e30",
"status": 200,
"result": {},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

computeCommissionRates:

{
"id": "6ffebe91-01d9-43ac-be99-57cf062e0e30",
"status": 200,
"result": {
"standardCommissionForOrder": { // 根据订单的角色(例如,Maker或Taker)确定的佣金费率。
"maker": "0.00000112",
"taker": "0.00000114"
},
"taxCommissionForOrder": { // 根据订单的角色(例如,Maker或Taker)确定的税收扣除率。
"maker": "0.00000112",
"taker": "0.00000114"
},
"discount": { // 以BNB支付时的标准佣金折扣。
"enabledForAccount": true,
"enabledForSymbol": true,
"discountAsset": "BNB",
"discount": "0.25000000" // 当用BNB支付佣金时,在标准佣金上按此比率打折。
}
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}

查询订单 (USER_DATA)

{
"id": "aa62318a-5a97-4f3b-bdc7-640bbe33b291",
"method": "order.status",
"params": {
"symbol": "BTCUSDT",
"orderId": 12569099453,
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "2c3aab5a078ee4ea465ecd95523b77289f61476c2f238ec10c55ea6cb11a6f35",
"timestamp": 1660801720951
}
}

查询订单状态。

权重: 4

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId INT YES orderId 查找顺序
origClientOrderId STRING clientOrderId 查找顺序
apiKey STRING YES
recvWindow INT NO 值不能大于 60000
signature STRING YES
timestamp INT YES

备注:

  • 如果同时指定了 orderIdorigClientOrderId 参数,仅使用 orderId 并忽略 origClientOrderId

  • 对于某些历史订单,cummulativeQuoteQty 响应字段可能为负数,意味着此时数据不可用。

数据源: 缓存 => 数据库

响应:

{
"id": "aa62318a-5a97-4f3b-bdc7-640bbe33b291",
"status": 200,
"result": {
"symbol": "BTCUSDT",
"orderId": 12569099453,
"orderListId": -1, // 如果是属于订单列表的订单时会出现
"clientOrderId": "4d96324ff9d44481926157",
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00847000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "198.33521500",
"status": "FILLED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"stopPrice": "0.00000000", // 始终存在,如果订单类型不使用 stopPrice,则为零
"trailingDelta": 10, // 如果订单设置了 trailingDelta 会出现
"trailingTime": -1, // 如果订单设置了 trailingDelta 会出现
"icebergQty": "0.00000000", // 始终存在,非冰山订单为零
"time": 1660801715639, // 下单时间
"updateTime": 1660801717945, // 最后一次更新订单的时间
"isWorking": true,
"workingTime": 1660801715639,
"origQuoteOrderQty": "0.00000000" // 始终存在,如果订单类型不使用 quoteOrderQty,则为零
"strategyId": 37463720, // 如果订单设置了 strategyId 会出现
"strategyType": 1000000, // 如果订单设置了 strategyType 会出现
"selfTradePreventionMode": "NONE",
"preventedMatchId": 0, // 这仅在订单因 STP 而过期时可见
"preventedQuantity": "1.200000" // 这仅在订单因 STP 而过期时可见
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 4
}
]
}

注意: 上面的 payload 没有显示所有可以出现的字段,更多请看 订单响应中的特定条件时才会出现的字段 部分。

撤销订单 (TRADE)

{
"id": "5633b6a2-90a9-4192-83e7-925c90b6a2fd",
"method": "order.cancel",
"params": {
"symbol": "BTCUSDT",
"origClientOrderId": "4d96324ff9d44481926157",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "33d5b721f278ae17a52f004a82a6f68a70c68e7dd6776ed0be77a455ab855282",
"timestamp": 1660801715830
}
}

取消有效订单。

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId INT YES orderId 取消订单
origClientOrderId STRING clientOrderId 取消订单
newClientOrderId STRING NO 已取消订单的新 ID。如果未发送,则自动生成
cancelRestrictions ENUM NO 支持的值:
ONLY_NEW - 如果订单状态为 NEW,撤销将成功。
ONLY_PARTIALLY_FILLED - 如果订单状态为 PARTIALLY_FILLED,撤销将成功。
apiKey STRING YES
recvWindow INT NO 值不能大于 60000
signature STRING YES
timestamp INT YES

备注:

  • 如果同时指定了 orderIdorigClientOrderId 参数,仅使用 orderId 并忽略 origClientOrderId

  • newClientOrderId 将替换已取消订单的 clientOrderId,为新订单腾出空间。

  • 如果您取消属于订单列表的订单,则整个订单列表将被取消。

数据源: 撮合引擎

响应:

取消单个订单时:

{
"id": "5633b6a2-90a9-4192-83e7-925c90b6a2fd",
"status": 200,
"result": {
"symbol": "BTCUSDT",
"origClientOrderId": "4d96324ff9d44481926157", // 被取消的 clientOrderId
"orderId": 12569099453,
"orderListId": -1, // 订单列表的ID,不然就是 -1
"clientOrderId": "91fe37ce9e69c90d6358c0", // 请求的 newClientOrderId
"transactTime": 1684804350068,
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00001000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.23416100",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"stopPrice": "0.00000000", // 如果订单设置了 stopPrice 会出现
"trailingDelta": 0, // 如果订单设置了 trailingDelta 会出现
"icebergQty": "0.00000000", // 如果订单设置了 icebergQty 会出现
"strategyId": 37463720, // 如果订单设置了 strategyId 会出现
"strategyType": 1000000, // 如果订单设置了 strategyType 会出现
"selfTradePreventionMode": "NONE"
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 2
}
]
}

取消订单列表时:

{
"id": "16eaf097-bbec-44b9-96ff-e97e6e875870",
"status": 200,
"result": {
"orderListId": 19431,
"contingencyType": "OCO",
"listStatusType": "ALL_DONE",
"listOrderStatus": "ALL_DONE",
"listClientOrderId": "iuVNVJYYrByz6C4yGOPPK0",
"transactionTime": 1660803702431,
"symbol": "BTCUSDT",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 12569099453,
"clientOrderId": "bX5wROblo6YeDwa9iTLeyY"
},
{
"symbol": "BTCUSDT",
"orderId": 12569099454,
"clientOrderId": "Tnu2IP0J5Y4mxw3IATBfmW"
}
],
// 订单列表的状态格式与单个订单相同。
"orderReports": [
{
"symbol": "BTCUSDT",
"origClientOrderId": "bX5wROblo6YeDwa9iTLeyY",
"orderId": 12569099453,
"orderListId": 19431,
"clientOrderId": "OFFXQtxVFZ6Nbcg4PgE2DA",
"transactTime": 1684804350068,
"price": "23450.50000000",
"origQty": "0.00850000"
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "STOP_LOSS_LIMIT",
"side": "BUY",
"stopPrice": "23430.00000000",
"selfTradePreventionMode": "NONE"
},
{
"symbol": "BTCUSDT",
"origClientOrderId": "Tnu2IP0J5Y4mxw3IATBfmW",
"orderId": 12569099454,
"orderListId": 19431,
"clientOrderId": "OFFXQtxVFZ6Nbcg4PgE2DA",
"transactTime": 1684804350068,
"price": "23400.00000000",
"origQty": "0.00850000"
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "BUY",
"selfTradePreventionMode": "NONE"
}
]
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

注意: 上面的 payload 没有显示所有可以出现的字段,更多请看 订单响应中的特定条件时才会出现的字段 部分。

关于 cancelRestrictions

  • 如果 cancelRestrictions 值不是任何受支持的值,则错误将是:
{
"code": -1145,
"msg": "Invalid cancelRestrictions"
}
  • 如果订单没有通过 cancelRestrictions 的条件,错误将是:
{
"code": -2011,
"msg": "Order was not canceled due to cancel restrictions."
}

撤消挂单再下单 (TRADE)

{
"id": "99de1036-b5e2-4e0f-9b5c-13d751c93a1a",
"method": "order.cancelReplace",
"params": {
"symbol": "BTCUSDT",
"cancelReplaceMode": "ALLOW_FAILURE",
"cancelOrigClientOrderId": "4d96324ff9d44481926157",
"side": "SELL",
"type": "LIMIT",
"timeInForce": "GTC",
"price": "23416.10000000",
"quantity": "0.00847000",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "7028fdc187868754d25e42c37ccfa5ba2bab1d180ad55d4c3a7e2de643943dc5",
"timestamp": 1660813156900
}
}

撤消挂单并在同个交易对上重新下单。

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
cancelReplaceMode ENUM YES
cancelOrderId INT YES orderId 取消订单
cancelOrigClientOrderId STRING clientOrderId 取消订单
cancelNewClientOrderId STRING NO 已取消订单的新 ID。如果未发送,则自动生成
side ENUM YES BUY 或者 SELL
type ENUM YES
timeInForce ENUM NO *
price DECIMAL NO *
quantity DECIMAL NO *
quoteOrderQty DECIMAL NO *
newClientOrderId STRING NO 客户自定义的唯一订单ID。如果未发送,则自动生成
newOrderRespType ENUM NO

选择响应格式: ACK, RESULT, FULL

MARKETLIMIT 订单默认推送 FULL 响应, 其他订单类型默认为 ACK

stopPrice DECIMAL NO *
trailingDelta DECIMAL NO * 请看 Trailing Stop order FAQ
icebergQty DECIMAL NO
strategyId LONG NO 标识订单策略中订单的任意ID。
strategyType INT NO

标识订单策略的任意数值。

小于 1000000 的值被保留,不能使用。

selfTradePreventionMode ENUM NO

允许的 ENUM 取决于交易对的配置。

支持的值有: EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE.

cancelRestrictions ENUM NO 支持的值:
ONLY_NEW - 如果订单状态为 NEW,撤销将成功。
ONLY_PARTIALLY_FILLED - 如果订单状态为 PARTIALLY_FILLED,撤销将成功。
apiKey STRING YES
orderRateLimitExceededMode ENUM NO 支持的值:
DO_NOTHING (默认值) - 仅在账户未超过未成交订单频率限制时,会尝试取消订单。
CANCEL_ONLY - 将始终取消订单。
recvWindow INT NO 值不能大于 60000
signature STRING YES
timestamp INT YES

类似于 order.place 请求,额外的强制参数 (*) 由新订单的 type 确定。

可用的 cancelReplaceMode 选项:

  • STOP_ON_FAILURE – 如果撤销订单请求失败,将不会尝试下新订单。
  • ALLOW_FAILURE – 即使撤销订单请求失败,也会尝试下新订单。
请求 响应
cancelReplaceMode orderRateLimitExceededMode 未成交订单数 cancelResult newOrderResult status
STOP_ON_FAILURE DO_NOTHING 在限制范围内 SUCCESS SUCCESS 200
FAILURE NOT_ATTEMPTED 400
SUCCESS FAILURE 409
超出限制范围 SUCCESS SUCCESS N/A
FAILURE NOT_ATTEMPTED N/A
SUCCESS FAILURE N/A
CANCEL_ONLY 在限制范围内 SUCCESS SUCCESS 200
FAILURE NOT_ATTEMPTED 400
SUCCESS FAILURE 409
超出限制范围 FAILURE NOT_ATTEMPTED 429
SUCCESS FAILURE 429
ALLOW_FAILURE DO_NOTHING 在限制范围内 SUCCESS SUCCESS 200
FAILURE FAILURE 400
FAILURE SUCCESS 409
SUCCESS FAILURE 409
超出限制范围 SUCCESS SUCCESS N/A
FAILURE FAILURE N/A
FAILURE SUCCESS N/A
SUCCESS FAILURE N/A
CANCEL_ONLY 在限制范围内 SUCCESS SUCCESS 200
FAILURE FAILURE 400
FAILURE SUCCESS 409
SUCCESS FAILURE 409
超出限制范围 SUCCESS SUCCESS 200
FAILURE FAILURE 400
FAILURE SUCCESS N/A
SUCCESS FAILURE 409

备注:

  • 如果同时指定了 cancelOrderIdcancelOrigClientOrderId 参数,仅使用 cancelOrderId 并忽略 cancelOrigClientOrderId

  • cancelNewClientOrderId 将替换已撤销订单的 clientOrderId,为新订单腾出空间。

  • newClientOrderId 指定下单的 clientOrderId 值。

    仅当前一个订单已成交或过期时,才会接受具有相同 clientOrderId 的新订单。

    新订单可以重用已取消订单的旧 clientOrderId

  • 此 cancel-replace 操作不是事务性的

    如果一个操作成功但另一个操作失败,则仍然执行成功的操作。

    例如,在 STOP_ON_FAILURE 模式下,如果下新订单达失败,旧订单仍然被撤销。

  • 过滤器和订单次数限制会在撤销和下订单之前评估。

  • 如果未尝试下新订单,订单次数仍会增加。

  • order.cancel 一样,如果您撤销订单列表内的某个订单,则整个订单列表将被撤销。

数据源: 撮合引擎

响应:

如果撤销订单和下新订单都成功,响应会是 "status": 200

{
"id": "99de1036-b5e2-4e0f-9b5c-13d751c93a1a",
"status": 200,
"result": {
"cancelResult": "SUCCESS",
"newOrderResult": "SUCCESS",
// 格式与 "order.cancel" 格式相同。
// 某些字段是可选的,仅在订单中有设置它们时才包括。
"cancelResponse": {
"symbol": "BTCUSDT",
"origClientOrderId": "4d96324ff9d44481926157", // 请求的 cancelOrigClientOrderId
"orderId": 125690984230,
"orderListId": -1,
"clientOrderId": "91fe37ce9e69c90d6358c0", // 请求的 cancelNewClientOrderId
"transactTime": 1684804350068,
"price": "23450.00000000",
"origQty": "0.00847000",
"executedQty": "0.00001000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.23450000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"selfTradePreventionMode": "NONE"
},
// 格式与 "order.place" 格式相同, 受 "newOrderRespType" 影响。
// 某些字段是可选的,仅在订单中有设置它们时才包括。
"newOrderResponse": {
"symbol": "BTCUSDT",
"orderId": 12569099453,
"orderListId": -1,
"clientOrderId": "bX5wROblo6YeDwa9iTLeyY", // 请求的 newClientOrderId
"transactTime": 1660813156959,
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"selfTradePreventionMode": "NONE"
}
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 1
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 1
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

STOP_ON_FAILURE 模式,失败的撤销订单会阻止下新订单,响应会是"status": 400

{
"id": "27e1bf9f-0539-4fb0-85c6-06183d36f66c",
"status": 400,
"error": {
"code": -2022,
"msg": "Order cancel-replace failed.",
"data": {
"cancelResult": "FAILURE",
"newOrderResult": "NOT_ATTEMPTED",
"cancelResponse": {
"code": -2011,
"msg": "Unknown order sent."
},
"newOrderResponse": null
}
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 1
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 1
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

如果 cancel-replace 模式允许失败并且其中一个操作失败,响应会是 "status": 409"data" 字段会制定哪个操作成功,哪个失败,以及原因:

{
"id": "b220edfe-f3c4-4a3a-9d13-b35473783a25",
"status": 409,
"error": {
"code": -2021,
"msg": "Order cancel-replace partially failed.",
"data": {
"cancelResult": "SUCCESS",
"newOrderResult": "FAILURE",
"cancelResponse": {
"symbol": "BTCUSDT",
"origClientOrderId": "4d96324ff9d44481926157",
"orderId": 125690984230,
"orderListId": -1,
"clientOrderId": "91fe37ce9e69c90d6358c0",
"transactTime": 1684804350068,
"price": "23450.00000000",
"origQty": "0.00847000",
"executedQty": "0.00001000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.23450000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"selfTradePreventionMode": "NONE"
},
"newOrderResponse": {
"code": -2010,
"msg": "Order would immediately match and take."
}
}
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 1
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 1
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}
{
"id": "ce641763-ff74-41ac-b9f7-db7cbe5e93b1",
"status": 409,
"error": {
"code": -2021,
"msg": "Order cancel-replace partially failed.",
"data": {
"cancelResult": "FAILURE",
"newOrderResult": "SUCCESS",
"cancelResponse": {
"code": -2011,
"msg": "Unknown order sent."
},
"newOrderResponse": {
"symbol": "BTCUSDT",
"orderId": 12569099453,
"orderListId": -1,
"clientOrderId": "bX5wROblo6YeDwa9iTLeyY",
"transactTime": 1660813156959,
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"selfTradePreventionMode": "NONE"
}
}
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 1
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 1
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

如果两个操作都失败,响应将有 "status": 400

{
"id": "3b3ac45c-1002-4c7d-88e8-630c408ecd87",
"status": 400,
"error": {
"code": -2022,
"msg": "Order cancel-replace failed.",
"data": {
"cancelResult": "FAILURE",
"newOrderResult": "FAILURE",
"cancelResponse": {
"code": -2011,
"msg": "Unknown order sent."
},
"newOrderResponse": {
"code": -2010,
"msg": "Order would immediately match and take."
}
}
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 1
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 1
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

如果 orderRateLimitExceededModeDO_NOTHING,那么无论 cancelReplaceMode 的取值,当账户超出未成交订单计数时,响应将有 "status": 429:

{
"id": "3b3ac45c-1002-4c7d-88e8-630c408ecd87",
"status": 429,
"error": {
"code": -1015,
"msg": "Too many new orders; current limit is 50 orders per 10 SECOND."
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 50
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 50
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

如果 orderRateLimitExceededModeCANCEL_ONLY,那么无论 cancelReplaceMode 的取值,当账户超出未成交订单计数时,响应将有 "status": 409:

{
"id": "3b3ac45c-1002-4c7d-88e8-630c408ecd87",
"status": 409,
"error": {
"code": -2021,
"msg": "Order cancel-replace partially failed.",
"data": {
"cancelResult": "SUCCESS",
"newOrderResult": "FAILURE",
"cancelResponse": {
"symbol": "LTCBNB",
"origClientOrderId": "GKt5zzfOxRDSQLveDYCTkc",
"orderId": 64,
"orderListId": -1,
"clientOrderId": "loehOJF3FjoreUBDmv739R",
"transactTime": 1715779007228,
"price": "1.00",
"origQty": "10.00000000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"selfTradePreventionMode": "NONE"
},
"newOrderResponse": {
"code": -1015,
"msg": "Too many new orders; current limit is 50 orders per 10 SECOND."
}
}
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 50
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 50
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

注意: 上面的 payload 没有显示所有可以出现的字段,更多请看 订单响应中的特定条件时才会出现的字段 部分。

当前挂单 (USER_DATA)

{
"id": "55f07876-4f6f-4c47-87dc-43e5fff3f2e7",
"method": "openOrders.status",
"params": {
"symbol": "BTCUSDT",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "d632b3fdb8a81dd44f82c7c901833309dd714fe508772a89b0a35b0ee0c48b89",
"timestamp": 1660813156812
}
}

查询所有挂订单的执行状态。

如果您需要持续监控订单状态更新,请考虑使用 WebSocket Streams:

权重: 根据交易对的数量进行调整:

参数重量
symbol6
none80

参数:

名称类型是否必需描述
symbolSTRINGNO如果省略,则返回所有交易对的挂单
apiKeySTRINGYES
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

数据源: 缓存 => 数据库

响应:

挂单的状态报告与 order.status 相同。

请注意,某些字段是可选的,仅在订单中有设置它们时才包括。

挂订单始终作为平面列表返回。 如果所有交易对被请求,请使用 symbol 字段来告知订单属于哪个交易对。

{
"id": "55f07876-4f6f-4c47-87dc-43e5fff3f2e7",
"status": 200,
"result": [
{
"symbol": "BTCUSDT",
"orderId": 12569099453,
"orderListId": -1,
"clientOrderId": "4d96324ff9d44481926157",
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00720000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "172.43931000",
"status": "PARTIALLY_FILLED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"stopPrice": "0.00000000",
"icebergQty": "0.00000000",
"time": 1660801715639,
"updateTime": 1660801717945,
"isWorking": true,
"workingTime": 1660801715639,
"origQuoteOrderQty": "0.00000000",
"selfTradePreventionMode": "NONE"
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 6
}
]
}

注意: 上面的 payload 没有显示所有可以出现的字段,更多请看 订单响应中的特定条件时才会出现的字段 部分。

撤销单一交易对的所有挂单 (TRADE)

{
"id": "778f938f-9041-4b88-9914-efbf64eeacc8",
"method": "openOrders.cancelAll"
"params": {
"symbol": "BTCUSDT",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "773f01b6e3c2c9e0c1d217bc043ce383c1ddd6f0e25f8d6070f2b66a6ceaf3a5",
"timestamp": 1660805557200
}
}

撤销单一交易对的所有挂单,包括交易组。

权重: 1

参数:

名称类型是否必需描述
symbolSTRINGYES
apiKeySTRINGYES
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

数据源: 撮合引擎

响应:

订单和订单列表的撤销报告的格式与 order.cancel 中的格式相同。

{
"id": "778f938f-9041-4b88-9914-efbf64eeacc8",
"status": 200,
"result": [
{
"symbol": "BTCUSDT",
"origClientOrderId": "4d96324ff9d44481926157",
"orderId": 12569099453,
"orderListId": -1,
"clientOrderId": "91fe37ce9e69c90d6358c0",
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00001000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.23416100",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"stopPrice": "0.00000000",
"trailingDelta": 0,
"icebergQty": "0.00000000",
"strategyId": 37463720,
"strategyType": 1000000,
"selfTradePreventionMode": "NONE"
},
{
"orderListId": 19431,
"contingencyType": "OCO",
"listStatusType": "ALL_DONE",
"listOrderStatus": "ALL_DONE",
"listClientOrderId": "iuVNVJYYrByz6C4yGOPPK0",
"transactionTime": 1660803702431,
"symbol": "BTCUSDT",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 12569099453,
"clientOrderId": "bX5wROblo6YeDwa9iTLeyY"
},
{
"symbol": "BTCUSDT",
"orderId": 12569099454,
"clientOrderId": "Tnu2IP0J5Y4mxw3IATBfmW"
}
],
"orderReports": [
{
"symbol": "BTCUSDT",
"origClientOrderId": "bX5wROblo6YeDwa9iTLeyY",
"orderId": 12569099453,
"orderListId": 19431,
"clientOrderId": "OFFXQtxVFZ6Nbcg4PgE2DA",
"transactTime": 1684804350068,
"price": "23450.50000000",
"origQty": "0.00850000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "STOP_LOSS_LIMIT",
"side": "BUY",
"stopPrice": "23430.00000000",
"selfTradePreventionMode": "NONE"
},
{
"symbol": "BTCUSDT",
"origClientOrderId": "Tnu2IP0J5Y4mxw3IATBfmW",
"orderId": 12569099454,
"orderListId": 19431,
"clientOrderId": "OFFXQtxVFZ6Nbcg4PgE2DA",
"transactTime": 1684804350068,
"price": "23400.00000000",
"origQty": "0.00850000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "BUY",
"selfTradePreventionMode": "NONE"
}
]
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

注意: 上面的 payload 没有显示所有可以出现的字段,更多请看 订单响应中的特定条件时才会出现的字段 部分。

订单列表(Order lists)

OCO下单 - 已弃用 (TRADE)

{
"id": "56374a46-3061-486b-a311-99ee972eb648",
"method": "orderList.place",
"params": {
"symbol": "BTCUSDT",
"side": "SELL",
"price": "23420.00000000",
"quantity": "0.00650000",
"stopPrice": "23410.00000000",
"stopLimitPrice": "23405.00000000",
"stopLimitTimeInForce": "GTC",
"newOrderRespType": "RESULT",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "6689c2a36a639ff3915c2904871709990ab65f3c7a9ff13857558fd350315c35",
"timestamp": 1660801713767
}
}

发送新的OCO(one-cancels-the-other) 订单: LIMIT_MAKER 订单 + STOP_LOSS/STOP_LOSS_LIMIT 订单(称呼为 legs), 其中一个订单的激活会立即取消另一个订单。

权重: 1

参数:

名称类型是否必需描述
symbolSTRINGYES
sideENUMYESBUY 或者 SELL
priceDECIMALYESLimit 订单的价格
quantityDECIMALYES
listClientOrderIdSTRINGNO订单列表的客户自定义的唯一订单ID。如果未发送,则自动生成
limitClientOrderIdSTRINGNOLimit 挂单的客户自定义的唯一订单ID。如果未发送,则自动生成
limitIcebergQtyDECIMALNO
limitStrategyIdLONGNO标识订单策略中的 limit 订单的任意ID。
limitStrategyTypeINTNO

标识 limit 订单策略的任意数值

小于1000000的值是保留的,不能使用。

stopPriceDECIMALYES *必须指定 stopPricetrailingDelta,或两者都指定
trailingDeltaINTYES *请看 追踪止盈止损(Trailing Stop)订单常见问题
stopClientOrderIdSTRINGNOStop 订单的客户自定义的唯一订单ID。如果未发送,则自动生成
stopLimitPriceDECIMALNO *
stopLimitTimeInForceENUMNO *有关可用选项,请看 order.place
stopIcebergQtyDECIMALNO *
stopStrategyIdLONGNO标识订单策略中的 stop 订单的任意ID。
stopStrategyTypeINTNO

标识 stop 订单策略的任意数值。

小于1000000的值是保留的,不能使用。

newOrderRespTypeENUMNO可选的响应格式: ACKRESULTFULL (默认)
selfTradePreventionModeENUMNO允许的 ENUM 取决于交易对的配置。支持的值有:STP 模式
apiKeySTRINGYES
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

备注:

  • listClientOrderId 参数指定 OCO 对的 listClientOrderId

    只有当前一个 OCO 已满或完全过期时,才会接受具有相同 listClientOrderId 的新 OCO。

    listClientOrderId 与单个订单的 clientOrderId 不同。

  • legs 的价格限制:

    side价格关系
    BUYprice < 市场价格 < stopPrice
    SELLprice > 市场价格 > stopPrice
  • 两个 legs 的 quantity 需要相同。

    不过单个 leg 可以设置不同的冰山数量。

    如果使用 stopIcebergQtystopLimitTimeInForce 必须是 GTC

  • trailingDelta 仅适用于 OCO 的 STOP_LOSS/STOP_LOSS_LIMIT leg。

  • OCO2个订单添加到未成交的订单计数, EXCHANGE_MAX_ORDERS 过滤器和 MAX_NUM_ORDERS 过滤器中。

数据源: 撮合引擎

响应:

使用 newOrderRespType 参数选择 orderReports 的响应格式。 以下示例适用于 RESULT 响应类型。 有关更多示例,请参阅 order.place

{
"id": "57833dc0-e3f2-43fb-ba20-46480973b0aa",
"status": 200,
"result": {
"orderListId": 1274512,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "08985fedd9ea2cf6b28996",
"transactionTime": 1660801713793,
"symbol": "BTCUSDT",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 12569138901,
"clientOrderId": "BqtFCj5odMoWtSqGk2X9tU"
},
{
"symbol": "BTCUSDT",
"orderId": 12569138902,
"clientOrderId": "jLnZpj5enfMXTuhKB1d0us"
}
],
"orderReports": [
{
"symbol": "BTCUSDT",
"orderId": 12569138901,
"orderListId": 1274512,
"clientOrderId": "BqtFCj5odMoWtSqGk2X9tU",
"transactTime": 1660801713793,
"price": "23410.00000000",
"origQty": "0.00650000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "STOP_LOSS_LIMIT",
"side": "SELL",
"stopPrice": "23405.00000000",
"workingTime": -1,
"selfTradePreventionMode": "NONE"
},
{
"symbol": "BTCUSDT",
"orderId": 12569138902,
"orderListId": 1274512,
"clientOrderId": "jLnZpj5enfMXTuhKB1d0us",
"transactTime": 1660801713793,
"price": "23420.00000000",
"origQty": "0.00650000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "SELL",
"workingTime": 1660801713793,
"selfTradePreventionMode": "NONE"
}
]
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 2
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 2
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

发送新 OCO 订单 (TRADE)

{
"id": "56374a46-3261-486b-a211-99ed972eb648",
"method": "orderList.place.oco",
"params":
{
"symbol": "LTCBNB",
"side": "BUY",
"quantity": 1,
"timestamp": 1711062760647,
"aboveType": "STOP_LOSS_LIMIT",
"abovePrice": "1.5",
"aboveStopPrice": "1.50000001",
"aboveTimeInForce": "GTC",
"belowType": "LIMIT_MAKER",
"belowPrice": "1.49999999",
"apiKey": "duwNf97YPLqhFIk7kZF0dDdGYVAXStA7BeEz0fIT9RAhUbixJtyS6kJ3hhzJsRXC",
"signature": "64614cfd8dd38260d4fd86d3c455dbf4b9d1c8a8170ea54f700592a986c30ddb"
}
}

权重: 1

发送新 one-cancels-the-other (OCO) 订单,激活其中一个订单会立即取消另一个订单。

  • OCO 包含了两个订单,分别被称为 上方订单下方订单
  • 其中一个订单必须是 LIMIT_MAKER/TAKE_PROFIT/TAKE_PROFIT_LIMIT 订单,另一个订单必须是 STOP_LOSSSTOP_LOSS_LIMIT 订单。
  • 针对价格限制:
    • 如果 OCO 订单方向是 SELL
      • LIMIT_MAKER/TAKE_PROFIT_LIMIT price > 最后交易价格 > STOP_LOSS/STOP_LOSS_LIMIT stopPrice
      • TAKE_PROFIT stopPrice > 最后交易价格 > STOP_LOSS/STOP_LOSS_LIMIT stopPrice
    • 如果 OCO 订单方向是 BUY
      • LIMIT_MAKER price < 最后交易价格 < STOP_LOSS/STOP_LOSS_LIMIT stopPrice
      • TAKE_PROFIT stopPrice > 最后交易价格 > STOP_LOSS/STOP_LOSS_LIMIT stopPrice
  • OCO 将2 个订单添加到未成交订单计数、EXCHANGE_MAX_ORDERS过滤器和 MAX_NUM_ORDERS 过滤器中。

参数:

名称类型是否必需描述
symbolSTRINGYES
listClientOrderIdSTRINGNO整个订单列表的唯一ID。 如果未发送则自动生成。
仅当前一个订单已填满或完全过期时,才会接受具有相同的listClientOrderId
listClientOrderIdaboveClientOrderIdbelowCLientOrderId 不同。
sideENUMYES订单方向:BUY or SELL
quantityDECIMALYES两个订单的数量。
aboveTypeENUMYES支持值:STOP_LOSS_LIMIT, STOP_LOSS, LIMIT_MAKER, TAKE_PROFIT, TAKE_PROFIT_LIMIT
aboveClientOrderIdSTRINGNO上方订单的唯一ID。 如果未发送则自动生成。
aboveIcebergQtyLONGNO请注意,只有当 aboveTimeInForceGTC 时才能使用。
abovePriceDECIMALNOaboveTypeSTOP_LOSS_LIMIT, LIMIT_MAKERTAKE_PROFIT_LIMIT 时,可用以指定限价。
aboveStopPriceDECIMALNO如果 aboveTypeSTOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFITTAKE_PROFIT_LIMIT 才能使用。
必须指定 aboveStopPriceaboveTrailingDelta 或两者。
aboveTrailingDeltaLONGNO请看 追踪止盈止损(Trailing Stop)订单常见问题.
aboveTimeInForceDECIMALNO如果 aboveTypeSTOP_LOSS_LIMITTAKE_PROFIT_LIMIT,则为必填项。
aboveStrategyIdLONGNO订单策略中上方订单的 ID。
aboveStrategyTypeINTNO上方订单策略的任意数值。
小于 1000000 的值被保留,无法使用。
belowTypeENUMYES支持值:STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT,TAKE_PROFIT_LIMIT
belowClientOrderIdSTRINGNO
belowIcebergQtyLONGNO请注意,只有当 belowTimeInForceGTC 时才能使用。
belowPriceDECIMALNObelowTypeSTOP_LOSS_LIMIT, LIMIT_MAKERTAKE_PROFIT_LIMIT 时,可用以指定限价。
belowStopPriceDECIMALNO如果 belowTypeSTOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFITTAKE_PROFIT_LIMIT 才能使用。
必须指定 belowStopPricebelowTrailingDelta 或两者。
belowTrailingDeltaLONGNO请看 追踪止盈止损(Trailing Stop)订单常见问题
belowTimeInForceENUMNO如果belowTypeSTOP_LOSS_LIMITTAKE_PROFIT_LIMIT,则为必须配合提交的值。
belowStrategyIdLONGNO订单策略中下方订单的 ID。
belowStrategyTypeINTNO下方订单策略的任意数值。
小于 1000000 的值被保留,无法使用。
newOrderRespTypeENUMNO响应格式可选值: ACK, RESULT, FULL
selfTradePreventionModeENUMNO允许的 ENUM 取决于交易对上的配置。 可能支持的值为:STP 模式
apiKeySTRINGYES
recvWindowLONGNO不能大于 60000
signatureSTRINGYES
timestampLONGYES

数据源: 撮合引擎

响应:

使用 newOrderRespType 参数来选择 orderReports 的响应格式。以下示例适用于 RESULT 响应类型。 请参阅 order.place了解更多 orderReports 的响应类型。

{
"id": "56374a46-3261-486b-a211-99ed972eb648",
"status": 200,
"result":
{
"orderListId": 2,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "cKPMnDCbcLQILtDYM4f4fX",
"transactionTime": 1711062760648,
"symbol": "LTCBNB",
"orders":
[
{
"symbol": "LTCBNB",
"orderId": 2,
"clientOrderId": "0m6I4wfxvTUrOBSMUl0OPU"
},
{
"symbol": "LTCBNB",
"orderId": 3,
"clientOrderId": "Z2IMlR79XNY5LU0tOxrWyW"
}
],
"orderReports":
[
{
"symbol": "LTCBNB",
"orderId": 2,
"orderListId": 2,
"clientOrderId": "0m6I4wfxvTUrOBSMUl0OPU",
"transactTime": 1711062760648,
"price": "1.50000000",
"origQty": "1.000000",
"executedQty": "0.000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "STOP_LOSS_LIMIT",
"side": "BUY",
"stopPrice": "1.50000001",
"workingTime": -1,
"selfTradePreventionMode": "NONE"
},
{
"symbol": "LTCBNB",
"orderId": 3,
"orderListId": 2,
"clientOrderId": "Z2IMlR79XNY5LU0tOxrWyW",
"transactTime": 1711062760648,
"price": "1.49999999",
"origQty": "1.000000",
"executedQty": "0.000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "BUY",
"workingTime": 1711062760648,
"selfTradePreventionMode": "NONE"
}
]
},
"rateLimits":
[
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 2
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 2
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

发送新订单列表 - OTO (TRADE)

{
"id": "1712544395950",
"method": "orderList.place.oto",
"params": {
"signature": "3e1e5ac8690b0caf9a2afd5c5de881ceba69939cc9d817daead5386bf65d0cbb",
"apiKey": "Rf07JlnL9PHVxjs27O5CvKNyOsV4qJ5gXdrRfpvlOdvMZbGZbPO5Ce2nIwfRP0iA",
"pendingQuantity": 1,
"pendingSide": "BUY",
"pendingType": "MARKET",
"symbol": "LTCBNB",
"recvWindow": "5000",
"timestamp": "1712544395951",
"workingPrice": 1,
"workingQuantity": 1,
"workingSide": "SELL",
"workingTimeInForce": "GTC",
"workingType": "LIMIT"
}
}

发送一个新的 OTO 订单。

  • 一个 OTO 订单(One-Triggers-the-Other)是一个包含了两个订单的订单列表.
  • 第一个订单被称为生效订单,必须为 LIMITLIMIT_MAKER 类型的订单。最初,订单簿上只有生效订单。
  • 第二个订单被称为待处理订单。它可以是任何订单类型,但不包括使用参数 quoteOrderQtyMARKET 订单。只有当生效订单完全成交时,待处理订单才会被自动下单。
  • 如果生效订单或者待处理订单中的任意一个被单独取消,订单列表中剩余的那个订单也会被随之取消或过期。
  • 如果生效订单在下订单列表后立即完全成交,则可能会得到订单响应。其中,生效订单的状态为 FILLED ,但待处理订单的状态为 PENDING_NEW。针对这类情况,如果需要检查当前状态,您可以查询相关的待处理订单。
  • OTO 订单将2 个订单添加到未成交订单计数,EXCHANGE_MAX_NUM_ORDERS 过滤器和 MAX_NUM_ORDERS 过滤器中。

权重: 1

参数:

名称类型是否必需描述
symbolSTRINGYES
listClientOrderIdSTRINGNO整个订单列表的唯一ID。 如果未发送则自动生成。
仅当前一个订单列表已填满或完全过期时,才会接受含有相同 listClientOrderId 值的新订单列表。
listClientOrderIdworkingClientOrderIdpendingClientOrderId 不同。
newOrderRespTypeENUMNO用于设置JSON响应的格式。 支持的数值: 订单返回类型
selfTradePreventionModeENUMNO允许的数值取决于交易对上的配置。参考 STP 模式
workingTypeENUMYES支持的数值: LIMITLIMIT_MAKER
workingSideENUMYES支持的数值: 订单方向
workingClientOrderIdSTRINGNO用于标识生效订单的唯一ID。
如果未发送则自动生成。
workingPriceDECIMALYES
workingQuantityDECIMALYES用于设置生效订单的数量。
workingIcebergQtyDECIMALNO只有当 workingTimeInForceGTC 时才能使用。
workingTimeInForceENUMNO支持的数值: 生效时间
workingStrategyIdLONGNO订单策略中用于标识生效订单的 ID。
workingStrategyTypeINTNO用于标识生效订单策略的任意数值。
小于 1000000 的值被保留,无法使用。
pendingTypeENUMYES支持的数值: 订单类型
请注意,系统不支持使用 quoteOrderQtyMARKET 订单。
pendingSideENUMYES支持的数值: 订单方向
pendingClientOrderIdSTRINGNO用于标识待处理订单的唯一ID。
如果未发送则自动生成。
pendingPriceDECIMALNO
pendingStopPriceDECIMALNO
pendingTrailingDeltaDECIMALNO
pendingQuantityDECIMALYES用于设置待处理订单的数量。
pendingIcebergQtyDECIMALNO只有当 pendingTimeInForceGTC 时才能使用。
pendingTimeInForceENUMNO支持的数值: 生效时间
pendingStrategyIdLONGNO订单策略中用于标识待处理订单的 ID。
pendingStrategyTypeINTNO用于标识待处理订单策略的任意数值。
小于 1000000 的值被保留,无法使用。
recvWindowLONGNO不能大于 60000
timestampLONGYES
signatureSTRINGYES

根据 pendingType 或者 workingType 的不同值,对于某些参数的强制要求

根据 pendingType 或者workingType的不同值,对于某些可选参数有强制要求,具体如下:

类型强制要求的参数其他信息
workingType = LIMITworkingTimeInForce
pendingType = LIMITpendingPricependingTimeInForce
pendingType = STOP_LOSSTAKE_PROFITpendingStopPrice 与/或 pendingTrailingDelta
pendingType = STOP_LOSS_LIMITTAKE_PROFIT_LIMITpendingPricependingStopPrice 与/或 pendingTrailingDeltapendingTimeInForce

数据源: 撮合引擎

响应:

{
"id": "1712544395950",
"status": 200,
"result": {
"orderListId": 626,
"contingencyType": "OTO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "KA4EBjGnzvSwSCQsDdTrlf",
"transactionTime": 1712544395981,
"symbol": "1712544378871",
"orders": [
{
"symbol": "LTCBNB",
"orderId": 13,
"clientOrderId": "YiAUtM9yJjl1a2jXHSp9Ny"
},
{
"symbol": "LTCBNB",
"orderId": 14,
"clientOrderId": "9MxJSE1TYkmyx5lbGLve7R"
}
],
"orderReports": [
{
"symbol": "LTCBNB",
"orderId": 13,
"orderListId": 626,
"clientOrderId": "YiAUtM9yJjl1a2jXHSp9Ny",
"transactTime": 1712544395981,
"price": "1.000000",
"origQty": "1.000000",
"executedQty": "0.000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"workingTime": 1712544395981,
"selfTradePreventionMode": "NONE"
},
{
"symbol": "LTCBNB",
"orderId": 14,
"orderListId": 626,
"clientOrderId": "9MxJSE1TYkmyx5lbGLve7R",
"transactTime": 1712544395981,
"price": "0.000000",
"origQty": "1.000000",
"executedQty": "0.000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "PENDING_NEW",
"timeInForce": "GTC",
"type": "MARKET",
"side": "BUY",
"workingTime": -1,
"selfTradePreventionMode": "NONE"
}
]
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 10000000,
"count": 10
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 1000,
"count": 38
}
]
}

注意: 上面的 payload 没有显示所有可以出现的字段,更多请看 订单响应中的特定条件时才会出现的字段 部分。

发送新订单列表 - OTOCO (TRADE)

{
"id": "1712544408508",
"method": "orderList.place.otoco",
"params": {
"signature": "c094473304374e1b9c5f7e2558358066cfa99df69f50f63d09cfee755136cb07",
"apiKey": "Rf07JlnL9PHVxjs27O5CvKNyOsV4qJ5gXdrRfpvlOdvMZbGZbPO5Ce2nIwfRP0iA",
"pendingQuantity": 5,
"pendingSide": "SELL",
"pendingBelowPrice": 5,
"pendingBelowType": "LIMIT_MAKER",
"pendingAboveStopPrice": 0.5,
"pendingAboveType": "STOP_LOSS",
"symbol": "LTCBNB",
"recvWindow": "5000",
"timestamp": "1712544408509",
"workingPrice": 1.5,
"workingQuantity": 1,
"workingSide": "BUY",
"workingTimeInForce": "GTC",
"workingType": "LIMIT"
}
}

发送一个新的 OTOCO 订单。

  • 一个 OTOCO 订单(One-Triggers-One-Cancels-the-Other)是一个包含了三个订单的订单列表。
  • 第一个订单被称为生效订单,必须为 LIMITLIMIT_MAKER 类型的订单。最初,订单簿上只有生效订单。
    • 生效订单的行为与此一致 OTO
  • 一个OTOCO订单有两个待处理订单(pending above 和 pending below),它们构成了一个 OCO 订单列表。只有当生效订单完全成交时,待处理订单们才会被自动下单。
    • 待处理上方(pending above)订单和待处理下方(pending below)订单都遵循与 OCO 订单列表相同的规则 Order List OCO
  • OTOCO 在未成交订单计数,EXCHANGE_MAX_NUM_ORDERS 过滤器和 MAX_NUM_ORDERS 过滤器的基础上添加3个订单

权重: 1

参数:

名称类型是否必需描述
symbolSTRINGYES
listClientOrderIdSTRINGNO整个订单列表的唯一ID。 如果未发送则自动生成。
仅当前一个订单列表已填满或完全过期时,才会接受含有相同 listClientOrderId 值的新订单列表。
listClientOrderIdworkingClientOrderIdpendingAboveClientOrderId 以及 pendingBelowClientOrderId 不同。
newOrderRespTypeENUMNO用于设置JSON响应的格式。 支持的数值: 订单返回类型
selfTradePreventionModeENUMNO允许的数值取决于交易对上的配置。参考 STP 模式
workingTypeENUMYES支持的数值: LIMITLIMIT_MAKER
workingSideENUMYES支持的数值: 订单方向
workingClientOrderIdSTRINGNO用于标识生效订单的唯一ID。
如果未发送则自动生成。
workingPriceDECIMALYES
workingQuantityDECIMALYES
workingIcebergQtyDECIMALNO只有当 workingTimeInForceGTC 时才能使用。
workingTimeInForceENUMNO支持的数值: 生效时间
workingStrategyIdLONGNO订单策略中用于标识生效订单的 ID。
workingStrategyTypeINTNO用于标识生效订单策略的任意数值。
小于 1000000 的值被保留,无法使用。
pendingSideENUMYES支持的数值: 订单方向
pendingQuantityDECIMALYES
pendingAboveTypeENUMYES支持的数值: STOP_LOSS_LIMIT, STOP_LOSS, LIMIT_MAKER, TAKE_PROFIT, TAKE_PROFIT_LIMIT
pendingAboveClientOrderIdSTRINGNO用于标识待处理上方订单的唯一ID。
如果未发送则自动生成。
pendingAbovePriceDECIMALNOpendingAboveTypeSTOP_LOSS_LIMIT, LIMIT_MAKERTAKE_PROFIT_LIMIT 时,可用以指定限价。
pendingAboveStopPriceDECIMALNO如果 pendingAboveTypeSTOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT 才能使用。
pendingAboveTrailingDeltaDECIMALNO参见 追踪止盈止损(Trailing Stop)订单常见问题
pendingAboveIcebergQtyDECIMALNO只有当 pendingAboveTimeInForceGTC 时才能使用。
pendingAboveTimeInForceENUMNO
pendingAboveStrategyIdLONGNO订单策略中用于标识待处理上方订单的 ID。
pendingAboveStrategyTypeINTNO用于标识待处理上方订单策略的任意数值。
小于 1000000 的值被保留,无法使用。
pendingBelowTypeENUMNO支持的数值: STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
pendingBelowClientOrderIdSTRINGNO用于标识待处理下方订单的唯一ID。
如果未发送则自动生成。
pendingBelowPriceDECIMALNOpendingBelowTypeSTOP_LOSS_LIMITTAKE_PROFIT_LIMIT 时,可用以指定限价。
pendingBelowStopPriceDECIMALNO如果 pendingBelowTypeSTOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT 才能使用。
必须指定 pendingBelowStopPricependingBelowTrailingDelta 或两者。
pendingBelowTrailingDeltaDECIMALNO
pendingBelowIcebergQtyDECIMALNO只有当 pendingBelowTimeInForceGTC 时才能使用。
pendingBelowTimeInForceENUMNO支持的数值: 生效时间
pendingBelowStrategyIdLONGNO订单策略中用于标识待处理下方订单的 ID。
pendingBelowStrategyTypeINTNO用于标识待处理下方订单策略的任意数值。
小于 1000000 的值被保留,无法使用。
recvWindowLONGNO不能大于 60000
timestampLONGYES
signatureSTRINGYES

根据 pendingAboveTypependingBelowType 或者workingType的不同值,对于某些参数的强制要求

根据 pendingAboveTypependingBelowType 或者workingType的不同值,对于某些可选参数有强制要求,具体如下:

类型强制要求的参数其他信息
workingType = LIMITworkingTimeInForce
pendingAboveType = STOP_LOSS/TAKE_PROFITpendingAboveStopPrice 与/或 pendingAboveTrailingDelta
pendingAboveType = STOP_LOSS_LIMIT/TAKE_PROFIT_LIMITpendingAbovePricependingAboveStopPrice 与/或 pendingAboveTrailingDeltapendingAboveTimeInForce
pendingAboveType = LIMIT_MAKERpendingAbovePrice
pendingBelowType = STOP_LOSS/TAKE_PROFITpendingBelowStopPrice 与/或 pendingBelowTrailingDelta
pendingBelowType = STOP_LOSS_LIMIT/TAKE_PROFIT_LIMITpendingBelowPricependingBelowStopPrice 与/或 pendingBelowTrailingDeltapendingBelowTimeInForce
pendingBelowType = LIMIT_MAKERpendingBelowPrice

数据源: 撮合引擎

响应:

{
"id": "1712544408508",
"status": 200,
"result": {
"orderListId": 629,
"contingencyType": "OTO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "GaeJHjZPasPItFj4x7Mqm6",
"transactionTime": 1712544408537,
"symbol": "1712544378871",
"orders": [
{
"symbol": "1712544378871",
"orderId": 23,
"clientOrderId": "OVQOpKwfmPCfaBTD0n7e7H"
},
{
"symbol": "1712544378871",
"orderId": 24,
"clientOrderId": "YcCPKCDMQIjNvLtNswt82X"
},
{
"symbol": "1712544378871",
"orderId": 25,
"clientOrderId": "ilpIoShcFZ1ZGgSASKxMPt"
}
],
"orderReports": [
{
"symbol": "LTCBNB",
"orderId": 23,
"orderListId": 629,
"clientOrderId": "OVQOpKwfmPCfaBTD0n7e7H",
"transactTime": 1712544408537,
"price": "1.500000",
"origQty": "1.000000",
"executedQty": "0.000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"workingTime": 1712544408537,
"selfTradePreventionMode": "NONE"
},
{
"symbol": "LTCBNB",
"orderId": 24,
"orderListId": 629,
"clientOrderId": "YcCPKCDMQIjNvLtNswt82X",
"transactTime": 1712544408537,
"price": "0.000000",
"origQty": "5.000000",
"executedQty": "0.000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "PENDING_NEW",
"timeInForce": "GTC",
"type": "STOP_LOSS",
"side": "SELL",
"stopPrice": "0.500000",
"workingTime": -1,
"selfTradePreventionMode": "NONE"
},
{
"symbol": "LTCBNB",
"orderId": 25,
"orderListId": 629,
"clientOrderId": "ilpIoShcFZ1ZGgSASKxMPt",
"transactTime": 1712544408537,
"price": "5.000000",
"origQty": "5.000000",
"executedQty": "0.000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "PENDING_NEW",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "SELL",
"workingTime": -1,
"selfTradePreventionMode": "NONE"
}
]
},
"rateLimits": [
{
"rateLimitType": "ORDERS",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 10000000,
"count": 18
},
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 1000,
"count": 65
}
]
}

注意: 上面的 payload 没有显示所有可以出现的字段,更多请看 订单响应中的特定条件时才会出现的字段 部分。

查询订单列表 (USER_DATA)

{
"id": "b53fd5ff-82c7-4a04-bd64-5f9dc42c2100",
"method": "orderList.status",
"params": {
"origClientOrderId": "08985fedd9ea2cf6b28996"
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "d12f4e8892d46c0ddfbd43d556ff6d818581b3be22a02810c2c20cb719aed6a4",
"timestamp": 1660801713965
}
}

检查订单列表的执行状态。

对于单个订单的执行状态,使用 order.status

权重: 4

Parameters:

名称 类型 是否必需 描述
origClientOrderId STRING YES 通过 listClientOrderId 获取订单列表
orderListId INT 通过 orderListId 获取订单列表
apiKey STRING YES
recvWindow INT NO 值不能大于 60000
signature STRING YES
timestamp INT YES

备注:

  • origClientOrderId 指的是订单列表本身的 listClientOrderId

  • 如果同时指定了 origClientOrderIdorderListId 参数,仅使用 origClientOrderId 并忽略 orderListId

数据源: 数据库

响应:

{
"id": "b53fd5ff-82c7-4a04-bd64-5f9dc42c2100",
"status": 200,
"result": {
"orderListId": 1274512,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "08985fedd9ea2cf6b28996",
"transactionTime": 1660801713793,
"symbol": "BTCUSDT",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 12569138901,
"clientOrderId": "BqtFCj5odMoWtSqGk2X9tU"
},
{
"symbol": "BTCUSDT",
"orderId": 12569138902,
"clientOrderId": "jLnZpj5enfMXTuhKB1d0us"
}
]
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 4
}
]
}

撤销订单列表订单(TRADE)

{
"id": "c5899911-d3f4-47ae-8835-97da553d27d0",
"method": "orderList.cancel",
"params": {
"symbol": "BTCUSDT",
"orderListId": 1274512,
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "4973f4b2fee30bf6d45e4a973e941cc60fdd53c8dd5a25edeac96f5733c0ccee",
"timestamp": 1660801720210
}
}

取消整个订单列表。

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderListId INT YES 通过 orderListId 撤销订单列表
listClientOrderId STRING 通过 listClientId 撤销订单列表
newClientOrderId STRING NO 已取消订单列表的新 ID。如果未发送,则自动生成
apiKey STRING YES
recvWindow INT NO 值不能大于 60000
signature STRING YES
timestamp INT YES

备注:

  • 如果同时指定了 orderListIdlistClientOrderId 参数,仅使用 orderListId 并忽略 listClientOrderId

  • 使用 order.cancel 撤销订单列表内的某个订单,则整个订单列表将被撤销。

数据源: 撮合引擎

响应:

{
"id": "c5899911-d3f4-47ae-8835-97da553d27d0",
"status": 200,
"result": {
"orderListId": 1274512,
"contingencyType": "OCO",
"listStatusType": "ALL_DONE",
"listOrderStatus": "ALL_DONE",
"listClientOrderId": "6023531d7edaad348f5aff",
"transactionTime": 1660801720215,
"symbol": "BTCUSDT",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 12569138901,
"clientOrderId": "BqtFCj5odMoWtSqGk2X9tU"
},
{
"symbol": "BTCUSDT",
"orderId": 12569138902,
"clientOrderId": "jLnZpj5enfMXTuhKB1d0us"
}
],
"orderReports": [
{
"symbol": "BTCUSDT",
"orderId": 12569138901,
"orderListId": 1274512,
"clientOrderId": "BqtFCj5odMoWtSqGk2X9tU",
"transactTime": 1660801720215,
"price": "23410.00000000",
"origQty": "0.00650000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "STOP_LOSS_LIMIT",
"side": "SELL",
"stopPrice": "23405.00000000",
"selfTradePreventionMode": "NONE"
},
{
"symbol": "BTCUSDT",
"orderId": 12569138902,
"orderListId": 1274512,
"clientOrderId": "jLnZpj5enfMXTuhKB1d0us",
"transactTime": 1660801720215,
"price": "23420.00000000",
"origQty": "0.00650000",
"executedQty": "0.00000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "SELL",
"selfTradePreventionMode": "NONE"
}
]
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

查询订单列表挂单 (USER_DATA)

{
"id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6",
"method": "openOrderLists.status",
"params": {
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "1bea8b157dd78c3da30359bddcd999e4049749fe50b828e620e12f64e8b433c9",
"timestamp": 1660801713831
}
}

查询所有订单列表挂单的执行状态。

如果您需要持续监控订单状态更新,请考虑使用 WebSocket Streams:

权重: 6

参数:

名称类型是否必需描述
apiKeySTRINGYES
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

数据源: 数据库

响应:

{
"id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6",
"status": 200,
"result": [
{
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "08985fedd9ea2cf6b28996",
"transactionTime": 1660801713793,
"symbol": "BTCUSDT",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 4,
"clientOrderId": "CUhLgTXnX5n2c0gWiLpV4d"
},
{
"symbol": "BTCUSDT",
"orderId": 5,
"clientOrderId": "1ZqG7bBuYwaF4SU8CwnwHm"
}
]
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 6
}
]
}

下 SOR 订单 (TRADE)

{
"id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6",
"method": "sor.order.place",
"params":
{
"symbol": "BTCUSDT",
"side": "BUY",
"type": "LIMIT",
"quantity": 0.5,
"timeInForce": "GTC",
"price": 31000,
"timestamp": 1687485436575,
"apiKey": "u5lgqJb97QWXWfgeV4cROuHbReSJM9rgQL0IvYcYc7BVeA5lpAqqc3a5p2OARIFk",
"signature": "fd301899567bc9472ce023392160cdc265ad8fcbbb67e0ea1b2af70a4b0cd9c7"
}
}

下使用智能订单路由 (SOR) 的新订单。

权重: 1

参数:

名称类型是否必需描述
symbolSTRINGYES
sideENUMYESBUYSELL
typeENUMYES
timeInForceENUMNO只适用于限价订单类型
priceDECIMALNO只适用于限价订单类型
quantityDECIMALYES
newClientOrderIdSTRINGNO用户自定义的任意唯一值orderid,如空缺系统会自动赋值
newOrderRespTypeENUMNO

可选的响应格式: ACKRESULTFULL Select response format: ACK, RESULT, FULL.

市场限价单默认使用FULL

icebergQtyDECIMALNO
strategyIdLONGNO用于标识订单策略中订单的任意数字值。
strategyTypeINTNO

用于标识订单策略的任意数字值。

小于 1000000 是保留值,应此不能被使用。

selfTradePreventionModeENUMNO允许的 ENUM 取决于交易对的配置。支持的值有:STP 模式
apiKeySTRINGYES
timestampINTYES
recvWindowINTNO赋值不能大于 60000
signatureSTRINGYES

注意: sor.order.place 只支持 限价市场 单, 并不支持 quoteOrderQty

数据源: 撮合引擎

响应:*

{
"id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6",
"status": 200,
"result": [
{
"symbol": "BTCUSDT",
"orderId": 2,
"orderListId": -1,
"clientOrderId": "sBI1KM6nNtOfj5tccZSKly",
"transactTime": 1689149087774,
"price": "31000.00000000",
"origQty": "0.50000000",
"executedQty": "0.50000000",
"origQuoteOrderQty": "0.000000",
"cummulativeQuoteQty": "14000.00000000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"workingTime": 1689149087774,
"fills": [
{
"matchType": "ONE_PARTY_TRADE_REPORT",
"price": "28000.00000000",
"qty": "0.50000000",
"commission": "0.00000000",
"commissionAsset": "BTC",
"tradeId": -1,
"allocId": 0
}
],
"workingFloor": "SOR",
"selfTradePreventionMode": "NONE",
"usedSor": true
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

测试 SOR 下单接口 (TRADE)

{
"id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6",
"method": "sor.order.test",
"params":
{
"symbol": "BTCUSDT",
"side": "BUY",
"type": "LIMIT",
"quantity": 0.1,
"timeInForce": "GTC",
"price": 0.1,
"timestamp": 1687485436575,
"apiKey": "u5lgqJb97QWXWfgeV4cROuHbReSJM9rgQL0IvYcYc7BVeA5lpAqqc3a5p2OARIFk",
"signature": "fd301899567bc9472ce023392160cdc265ad8fcbbb67e0ea1b2af70a4b0cd9c7"
}
}

用于测试使用智能订单路由 (SOR) 的订单请求,但不会提交到撮合引擎。

权重:

条件请求权重
没有 computeCommissionRates1
computeCommissionRates20

参数:

除了 sor.order.place 所有参数, 下面参数也有效:

参数名类型是否必需描述
computeCommissionRatesBOOLEANNO默认: false

数据源: 缓存

响应:

没有 computeCommissionRates:

{
"id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6",
"status": 200,
"result": {},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 1
}
]
}

computeCommissionRates:

{
"id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6",
"status": 200,
"result": {
"standardCommissionForOrder": { // 订单交易的标准佣金率。
"maker": "0.00000112",
"taker": "0.00000114"
},
"taxCommissionForOrder": { // 订单交易的税率。
"maker": "0.00000112",
"taker": "0.00000114"
},
"discount": { // 以BNB支付时的标准佣金折扣。
"enabledForAccount": true,
"enabledForSymbol": true,
"discountAsset": "BNB",
"discount": "0.25000000" // 当用BNB支付佣金时,在标准佣金上按此比率打折。
}
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}