Navbar
简体中文

更新日志

重要文档通知

Binance 推出了全新的 API 文档门户。现有的 GitHub API 文档 已废弃(2024-06-17),并将在用户迁移完成后的几个月内下线;具体日期将在适当时候确定并通知。

在此过渡阶段,两者网站将同时维持。然而,任何新服务将只会在新的门户上发布。

下面是当前和新 API 文档的链接的参考表:

功能 当前文档 新文档
现货交易 当前文档 新文档
现货Websocket API 当前文档 新文档
杠杆交易 当前文档 新文档
U本位合约 当前文档 新文档
币本位合约 当前文档 新文档
欧式期权 当前文档 新文档
统一账户 当前文档 新文档
钱包 当前文档 新文档
子母账户 当前文档 新文档
赚币 当前文档 新文档
双币投资 当前文档 新文档
定投 当前文档 新文档
ETH质押 当前文档 新文档
矿池接口 当前文档 新文档
策略交易 当前文档 新文档
跟单交易 当前文档 新文档
统一账户专业版 当前文档 新文档
法币 当前文档 新文档
C2C 当前文档 新文档
VIP借币 当前文档 新文档
质押借币 当前文档 新文档
Pay 当前文档 新文档
闪兑 当前文档 新文档
返佣 当前文档 新文档
NFT 当前文档 新文档
礼品卡 当前文档 新文档

2024-04-09


2024-01-19


2024-01-11


2023-09-04


2023-09-04

2023-09-07发布


2023-08-18


2023-07-28


POST /papi/v1/asset-collection

2023-07-20


2023-07-18


2023-07-13


2023-07-11

REST


2023-06-19

REST


2023-06-01

REST


2023-05-04


基本信息

Rest 基本信息

HTTP 返回代码

接口错误代码

异常响应格式如下:

{
  "code": -1121,
  "msg": "Invalid symbol."
}

接口的基本信息

访问限制

IP 访问限制

下单频率限制

接口鉴权类型

鉴权类型 描述
NONE 不需要鉴权的接口
TRADE 需要有效的API-KEY和签名
USER_DATA 需要有效的API-KEY和签名
USER_STREAM 需要有效的API-KEY
MARKET_DATA 需要有效的API-KEY

需要签名的接口 (TRADE 与 USER_DATA)

时间同步安全

逻辑伪代码:

  if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
    // process request
  } else {
    // reject request
  }

关于交易时效性 互联网状况并不100%可靠,不可完全依赖,因此你的程序本地到币安服务器的时延会有抖动. 这是我们设置recvWindow的目的所在,如果你从事高频交易,对交易时效性有较高的要求,可以灵活设置recvWindow以达到你的要求。

POST /papi/v1/um/order 的示例 - HMAC Keys

以下是在linux bash环境下使用 echo openssl 和curl工具实现的一个调用接口下单的示例 apikey、secret仅供示范

Key Value
apiKey dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83
secretKey 2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9
参数 取值
symbol BTCUSDT
side BUY
type LIMIT
timeInForce GTC
quantity 1
price 9000
recvWindow 5000
timestamp 1591702613943

示例 1: 所有参数通过 query string 发送

示例1:

HMAC SHA256 签名:

    $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000&timestamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG"
    (stdin)= 3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9

curl 调用:

    (HMAC SHA256)
    $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://papi.binance.com/papi/v1/order' -d 'symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000&timestamp=1611825601400&signature=7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7'

示例 2: 所有参数通过 request body 发送

示例2:

HMAC SHA256 签名:

    $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000&timestamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG"
    (stdin)= 7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7

curl 调用:

    (HMAC SHA256)
   $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://papi.binance.com/papi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000&timestamp=1611825601400&signature=7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7'

示例 3: 混合使用 query string 与 request body

示例3:

HMAC SHA256 签名:

   $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTCquantity=0.01&price=2000&recvWindow=5000&timestamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG"
    (stdin)= fa6045c54fb02912b766442be1f66fab619217e551a4fb4f8a1ee000df914d8e 

curl 调用:

    (HMAC SHA256)
    $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://papi.binance.com/papi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=0.01&price=2000&recvWindow=5000&timestamp=1611825601400&signature=fa6045c54fb02912b766442be1f66fab619217e551a4fb4f8a1ee000df914d8e'

symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC

quantity=1&price=9000&recvWindow=5000&timestamp= 1591702613943

请注意,示例3中的签名有些许不同,在"GTC"和"quantity=1"之间没有"&"字符。

POST /papi/v1/um/order 的示例 - RSA Keys

对于这个例子,Private Key 将被引用为test-prv-key.pem

Key Value
apiKey vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2
参数 取值
symbol BTCUSDT
side SELL
type MARKET
quantity 1.23
recvWindow 9999999
timestamp 1671090801999

有列出参数的签名 payload:

timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23

第1步: Payload

将参数列表排列成一个 string。 用 & 分隔每个参数。对于上述参数,签名 payload 如右所示。

第2步: 计算签名

2.1 - 将签名有效负载编码为 ASCII 数据。

第2.2步

 $ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem

2.2 - 使用带有 SHA-256 hash 函数的 RSASSA-PKCS1-v1_5 算法对 payload 进行签名。

第2.3步

$ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem | openssl enc -base64
aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D

2.3 - 将输出编码为 base64 string。

第2.4步

$  echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem | openssl enc -base64 | tr -d '\n'
aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D

2.4 - 删除签名中的所有 \n

第2.5步

aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D

2.5 - 由于签名可能包含 /=,这可能会导致发送请求时出现问题。 所以签名必须是 URL 编码的。

第2.6步

 curl -H "X-MBX-APIKEY: vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2" -X POST 'https://papi.binance.com/papi/v1/um/order?timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23&signature=aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D'

2.6 - curl 命令

Bash 脚本

#!/usr/bin/env bash
# 设置身份验证:
apiKey="vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2"   ### 替换成您的 API Key
# 设置您的请求:
apiMethod="POST"
apiCall="v1/order"
apiParams="timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23"
function rawurlencode {
    local value="$1"
    local len=${#value}
    local encoded=""
    local pos c o
    for (( pos=0 ; pos<len ; pos++ ))
    do
        c=${value:$pos:1}
        case "$c" in
            [-_.~a-zA-Z0-9] ) o="${c}" ;;
            * )   printf -v o '%%%02x' "'$c"
        esac
        encoded+="$o"
    done
    echo "$encoded"
}
ts=$(date +%s000)
paramsWithTs="$apiParams&timestamp=$ts"
rawSignature=$(echo -n "$paramsWithTs" \
               | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem \  ### 替换成您的 Private Key。不要与任何人共享此文件。
               | openssl enc -base64 \
               | tr -d '\n')
signature=$(rawurlencode "$rawSignature")
curl -H "X-MBX-APIKEY: $apiKey" -X $apiMethod \
    "https://fapi.binance.com/fapi/$apiCall?$paramsWithTs&signature=$signature"

右边有示例 Bash 脚本执行上述类似的步骤.


公开API参数

术语解释

枚举定义

订单方向 (side):

合约持仓方向:

有效方式 (timeInForce):

响应类型 (newOrderRespType)

订单种类 (orderTypes, type):

条件订单类型(type):

合约条件单价格触发类型 (workingType)

条件单状态 (strategyStatus)

合约类型 (contractType):

合约状态 (contractStatus, status):

订单状态 (status):

限制种类 (rateLimitType)

REQUEST_权重

  {
    "rateLimitType": "REQUEST_权重",
    "interval": "MINUTE",
    "intervalNum": 1,
    "limit": 6000
  }

ORDERS

  {
    "rateLimitType": "ORDERS",
    "interval": "MINUTE",
    "intervalNum": 1,
    "limit": 1200
   }

限制间隔

过滤器

过滤器,即Filter,定义了一系列交易规则。 共有两类,分别是针对交易对的过滤器symbol filters,和针对整个交易所的过滤器exchange filters(暂不支持)

交易对过滤器

PRICE_FILTER 价格过滤器

/exchangeInfo 响应中的格式:

  {
    "filterType": "PRICE_FILTER",
    "minPrice": "0.00000100",
    "maxPrice": "100000.00000000",
    "tickSize": "0.00000100"
  }

价格过滤器用于检测order订单中price参数的合法性

逻辑伪代码如下:

LOT_SIZE 订单尺寸

/exchangeInfo 响应中的格式:*

  {
    "filterType": "LOT_SIZE",
    "minQty": "0.00100000",
    "maxQty": "100000.00000000",
    "stepSize": "0.00100000"
  }

lots是拍卖术语,这个过滤器对订单中的quantity也就是数量参数进行合法性检查。包含三个部分:

逻辑伪代码如下:

MARKET_LOT_SIZE 市价订单尺寸

参考LOT_SIZE,区别仅在于对市价单还是限价单生效

MAX_NUM_ORDERS 最多订单数

/exchangeInfo 响应中的格式:

  {
    "filterType": "MAX_NUM_ORDERS",
    "limit": 200
  }

定义了某个交易对最多允许的挂单数量(不包括已关闭的订单)

普通订单与条件订单均计算在内

MAX_NUM_ALGO_ORDERS 最多条件订单数

/exchangeInfo format:

  {
    "filterType": "MAX_NUM_ALGO_ORDERS",
    "limit": 100
  }

定义了某个交易对最多允许的条件订单的挂单数量(不包括已关闭的订单)。

条件订单目前包括STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, 和 TRAILING_STOP_MARKET

PERCENT_PRICE 价格振幅过滤器

/exchangeInfo 响应中的格式:

  {
    "filterType": "PERCENT_PRICE",
    "multiplierUp": "1.1500",
    "multiplierDown": "0.8500",
    "multiplierDecimal": 4
  }

PERCENT_PRICE 定义了基于标记价格计算的挂单价格的可接受区间.

挂单价格必须同时满足以下条件:

MIN_NOTIONAL 最小名义价值

/exchangeInfo 响应中的格式:

  {
    "filterType": "MIN_NOTIONAL",
    "notioanl": "5.0"
  }

MIN_NOTIONAL过滤器定义了交易对订单所允许的最小名义价值(成交额)。 订单的名义价值是价格*数量。 由于MARKET订单没有价格,因此会使用 mark price 计算。

行情接口

测试服务器连通性 PING

响应:

{}

GET /papi/v1/ping

测试能否联通

权重: 1

参数: NONE

下单接口

UM下单 (TRADE)

响应:

{
    "clientOrderId": "testOrder",
    "cumQty": "0",
    "cumQuote": "0",
    "executedQty": "0",
    "orderId": 22542179,
    "avgPrice": "0.00000",
    "origQty": "10",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "symbol": "BTCUSDT",
    "timeInForce": "GTD",
    "type": "MARKET",
    "selfTradePreventionMode": "NONE", ////订单自成交保护模式
    "goodTillDate": 1693207680000,      //订单TIF为GTD时的自动取消时间 
    "updateTime": 1566818724722
}

POST /papi/v1/um/order (HMAC SHA256)

权重(order): 1

参数:

名称 类型 是否必需 描述
symbol STRING YES 交易对
side ENUM YES 方向
positionSide ENUM NO 持仓方向,单向持仓模式下非必填,默认且仅可填BOTH;在双向持仓模式下必填,且仅可选择 LONGSHORT
type ENUM YES LIMIT, MARKET
timeInForce ENUM NO 有效方法
quantity DECIMAL NO 下单数量
reduceOnly STRING NO truefalse; 非双开模式下默认false;双开模式下不接受此参数
price DECIMAL NO 委托价格
newClientOrderId STRING NO 用户自定义的订单号,不可以重复出现在挂单中。如空缺系统会自动赋值。必须满足正则规则: ^[\.A-Z\:/a-z0-9_-]{1,32}$
newOrderRespType ENUM NO ACKRESULT,默认 ACK
selfTradePreventionMode ENUM NO NONE / EXPIRE_TAKER/ EXPIRE_MAKER/ EXPIRE_BOTH; 默认NONE
goodTillDate LONG NO TIF为GTD时订单的自动取消时间, 当timeInforce为GTD时必传;传入的时间戳仅保留秒级精度,毫秒级部分会被自动忽略,时间戳需大于当前时间+600s且小于253402300799000
recvWindow LONG NO
timestamp LONG YES

根据 order type的不同,某些参数强制要求,具体如下:

类型 强制要求的参数
LIMIT timeInForce, quantity, price
MARKET quantity

CM下单 (TRADE)

响应:

{
    "clientOrderId": "testOrder",
    "cumQty": "0",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 22542179,
    "avgPrice": "0.0",
    "origQty": "10",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT", 
    "status": "NEW",
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "timeInForce": "GTC",
    "type": "MARKET",
    "updateTime": 1566818724722
}

POST /papi/v1/cm/order (HMAC SHA256)

权重(order): 1

参数:

名称 类型 是否必需 描述
symbol STRING YES 交易对
side ENUM YES 方向
positionSide ENUM NO 持仓方向,单向持仓模式下非必填,默认且仅可填BOTH;在双向持仓模式下必填,且仅可选择 LONGSHORT
type ENUM YES LIMIT, MARKET
timeInForce ENUM NO 有效方法
quantity DECIMAL NO 下单数量
reduceOnly STRING NO truefalse; 非双开模式下默认false;双开模式下不接受此参数
price DECIMAL NO 委托价格
newClientOrderId STRING NO 用户自定义的订单号,不可以重复出现在挂单中。如空缺系统会自动赋值。必须满足正则规则: ^[\.A-Z\:/a-z0-9_-]{1,32}$
newOrderRespType ENUM NO ACKRESULT,默认 ACK
recvWindow LONG NO
timestamp LONG YES

根据 order type的不同,某些参数强制要求,具体如下:

类型 强制要求的参数
LIMIT timeInForce, quantity, price
MARKET quantity

杠杆账户下单(TRADE)

响应:

{
  "symbol": "BTCUSDT",
  "orderId": 28,
  "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
  "transactTime": 1507725176595,
  "price": "1.00000000",
  "selfTradePreventionMode": "NONE", 
  "origQty": "10.00000000",
  "executedQty": "10.00000000",
  "cummulativeQuoteQty": "10.00000000",
  "status": "FILLED",
  "timeInForce": "GTC",
  "type": "MARKET",
  "side": "SELL",
  "marginBuyBorrowAmount": 5,       // 下单后没有发生借款则不返回该字段
  "marginBuyBorrowAsset": "BTC",    // 下单后没有发生借款则不返回该字段
  "fills": [
    {
      "price": "4000.00000000",
      "qty": "1.00000000",
      "commission": "4.00000000",
      "commissionAsset": "USDT"
    },
    {
      "price": "3999.00000000",
      "qty": "5.00000000",
      "commission": "19.99500000",
      "commissionAsset": "USDT"
    }
  ]
}

POST /papi/v1/margin/order

权重(order): 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
side ENUM YES BUY ; SELL
type ENUM YES 详见枚举定义:订单类型
quantity DECIMAL NO
quoteOrderQty DECIMAL NO
price DECIMAL NO
stopPrice DECIMAL NO STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT,和 TAKE_PROFIT_LIMIT 订单一起使用
newClientOrderId STRING NO 客户自定义的唯一订单ID。若未发送自动生成。
newOrderRespType ENUM NO 设置响应: JSON。 ACKRESULT, 或 FULL; MARKETLIMIT 订单类型默认为 FULL, 所有其他订单默认为 ACK
icebergQty DECIMAL NO LIMITSTOP_LOSS_LIMIT,和 TAKE_PROFIT_LIMIT 一起使用创建 iceberg 订单
sideEffectType ENUM NO NO_SIDE_EFFECTMARGIN_BUYAUTO_REPAY,AUTO_BORROW_REPAY;默认为 NO_SIDE_EFFECT
timeInForce ENUM NO GTCIOCFOK
selfTradePreventionMode ENUM NO 允许的 ENUM 取决于交易对的配置。支持的值有 EXPIRE_TAKER,EXPIRE_MAKER,EXPIRE_BOTH,NONE
autoRepayAtCancel BOOLEAN NO Only when MARGIN_BUY or AUTO_BORROW_REPAY order takes effect, true means that the debt generated by the order needs to be repay after the order is cancelled. The default is true
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

杠杆账户借贷 (MARGIN)

响应:

{
    //transaction id
    "tranId": 100000001
}

申请借贷。

POST /papi/v1/marginLoan

权重: 100

参数:

名称 类型 是否必需 描述
asset STRING YES
amount DECIMAL YES
recvWindow LONG NO 赋值不能超过60000
timestamp LONG YES

杠杆账户归还借贷 (MARGIN)

响应:

{
    "tranId": 100000001     //transaction id
}

获取杠杆账户归还借贷

POST /papi/v1/repayLoan

权重: 100

参数:

名称 类型 是否必需 描述
asset STRING YES
amount DECIMAL YES
recvWindow LONG NO 赋值不能超过60000
timestamp LONG YES

杠杆账户 OCO 下单 (TRADE)

响应:

{
  "orderListId": 0,
  "contingencyType": "OCO",
  "listStatusType": "EXEC_STARTED",
  "listOrderStatus": "EXECUTING",
  "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
  "transactionTime": 1563417480525,
  "symbol": "LTCBTC",
  "marginBuyBorrowAmount": "5",       // 下单后没有发生借款则不返回该字段
  "marginBuyBorrowAsset": "BTC",    // 下单后没有发生借款则不返回该字段
  "orders": [
    {
      "symbol": "LTCBTC",
      "orderId": 2,
      "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos"
    },
    {
      "symbol": "LTCBTC",
      "orderId": 3,
      "clientOrderId": "xTXKaGYd4bluPVp78IVRvl"
    }
  ],
  "orderReports": [
    {
      "symbol": "LTCBTC",
      "orderId": 2,
      "orderListId": 0,
      "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos",
      "transactTime": 1563417480525,
      "price": "0.000000",
      "origQty": "0.624363",
      "executedQty": "0.000000",
      "cummulativeQuoteQty": "0.000000",
      "status": "NEW",
      "timeInForce": "GTC",
      "type": "STOP_LOSS",
      "side": "BUY",
      "stopPrice": "0.960664"
      "selfTradePreventionMode": "EXPIRE_BOTH"
    },
    {
      "symbol": "LTCBTC",
      "orderId": 3,
      "orderListId": 0,
      "clientOrderId": "xTXKaGYd4bluPVp78IVRvl",
      "transactTime": 1563417480525,
      "price": "0.036435",
      "origQty": "0.624363",
      "executedQty": "0.000000",
      "cummulativeQuoteQty": "0.000000",
      "status": "NEW",
      "timeInForce": "GTC",
      "type": "LIMIT_MAKER",
      "side": "BUY"
      "selfTradePreventionMode": "EXPIRE_BOTH"
    }
  ]
}

POST /papi/v1/margin/order/oco

杠杆账户发送新 OCO 订单

权重(order): 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
listClientOrderId STRING NO 整个orderList的唯一ID
side ENUM YES 详见枚举定义:订单方向
quantity DECIMAL YES
limitClientOrderId STRING NO 限价单的唯一ID
price DECIMAL YES
limitIcebergQty DECIMAL NO
stopClientOrderId STRING NO 止损/止损限价单的唯一ID
stopPrice DECIMAL YES
stopLimitPrice DECIMAL NO 如果提供,须配合提交stopLimitTimeInForce
stopIcebergQty DECIMAL NO
stopLimitTimeInForce ENUM NO 有效值 GTC/FOK/IOC
newOrderRespType ENUM NO 详见枚举定义:订单返回类型
sideEffectType ENUM NO NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY,AUTO_BORROW_REPAY; 默认为 NO_SIDE_EFFECT
selfTradePreventionMode ENUM NO 允许的 ENUM 取决于交易对的配置。支持的值有 EXPIRE_TAKER,EXPIRE_MAKER,EXPIRE_BOTH,NONE
autoRepayAtCancel BOOLEAN NO Only when MARGIN_BUY or AUTO_BORROW_REPAY order takes effect, true means that the debt generated by the order needs to be repay after the order is cancelled. The default is true
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

Other Info: * 价格限制: * SELL: 限价 > 最新成交价 >触发价 * BUY: 限价 < 最新成交价 < 触发价 * 数量限制: * 两个 legs 必须具有同样的数量 * ICEBERG 数量不必相同 * 下单rate: * 一个OCO订单被算成2个普通订单

UM条件单下单 (TRADE)

响应:

{
    "newClientStrategyId": "testOrder",
    "strategyId":123445,
    "strategyStatus":"NEW",
    "strategyType": "TRAILING_STOP_MARKET", 
    "origQty": "10",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",        
    "symbol": "BTCUSDT",
    "timeInForce": "GTD",
    "activatePrice": "9020",    
    "priceRate": "0.3",         
    "bookTime": 1566818724710,  //条件单下单时间  
    "updateTime": 1566818724722
    "workingType": "CONTRACT_PRICE",
      "priceProtect": false, 
    "selfTradePreventionMode": "NONE", ////订单自成交保护模式
    "goodTillDate": 1693207680000      //订单TIF为GTD时的自动取消时间           
}

POST/papi/v1/um/conditional/order

权重(Order): 1

参数:

名称 类型 是否必需 描述
symbol STRING YES 交易对
side ENUM YES 方向
positionSide ENUM NO 持仓方向,单向持仓模式下非必填,默认且仅可填BOTH;在双向持仓模式下必填,且仅可选择 LONGSHORT
strategyType ENUM YES 条件单类型"STOP", "STOP_MARKET", "TAKE_PROFIT", "TAKE_PROFIT_MARKET"或"TRAILING_STOP_MARKET"
timeInForce ENUM NO
quantity DECIMAL NO
reduceOnly STRING NO truefalse; 非双开模式下默认false;双开模式下不接受此参数
price DECIMAL NO
workingType ENUM NO stopPrice 触发类型: MARK_PRICE(标记价格), CONTRACT_PRICE(合约最新价). 默认 CONTRACT_PRICE
priceProtect STRING NO 条件单触发保护:"TRUE","FALSE", 默认"FALSE". 仅 STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET 需要此参数
newClientStrategyId STRING NO 用户自定义的订单号,不可以重复出现在挂单中。如空缺系统会自动赋值。必须满足正则规则: ^[\.A-Z\:/a-z0-9_-]{1,32}$
stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders.
activationPrice DECIMAL NO TRAILING_STOP_MARKET 单使用,默认标记价格
callbackRate DECIMAL NO TRAILING_STOP_MARKET 单使用, 最小0.1, 最大5,1代表1%
selfTradePreventionMode ENUM NO NONE / EXPIRE_TAKER/ EXPIRE_MAKER/ EXPIRE_BOTH; 默认NONE
goodTillDate LONG NO TIF为GTD时订单的自动取消时间, 当timeInforce为GTD时必传;传入的时间戳仅保留秒级精度,毫秒级部分会被自动忽略,时间戳需大于当前时间+600s且小于253402300799000
recvWindow LONG NO
timestamp LONG YES

根据 order type 的不同,某些参数强制要求,具体如下:

类型 强制要求的参数
STOP/TAKE_PROFIT quantity, price, stopPrice
STOP_MARKET/TAKE_PROFIT_MARKET stopPrice
TRAILING_STOP_MARKET callbackRate

CM条件单下单 (TRADE)

响应:

{
    "newClientStrategyId": "testOrder",
    "strategyId":123445,
    "strategyStatus":"NEW",
    "strategyType": "TRAILING_STOP_MARKET", 
    "origQty": "10",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",        
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "timeInForce": "GTC",
    "activatePrice": "9020",   
    "priceRate": "0.3",         
    "bookTime": 1566818724710, //条件单下单时间  
    "updateTime": 1566818724722,
    "workingType":"CONTRACT_PRICE",
    "priceProtect": false   
}

POST /papi/v1/cm/conditional/order (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES 交易对
side ENUM YES 方向
positionSide ENUM NO 持仓方向,单向持仓模式下非必填,默认且仅可填BOTH;在双向持仓模式下必填,且仅可选择 LONGSHORT
strategyType ENUM YES 条件单类型"STOP", "STOP_MARKET", "TAKE_PROFIT", "TAKE_PROFIT_MARKET"或"TRAILING_STOP_MARKET"
timeInForce ENUM NO
quantity DECIMAL NO
reduceOnly STRING NO truefalse; 非双开模式下默认false;双开模式下不接受此参数
price DECIMAL NO
workingType ENUM NO stopPrice 触发类型: MARK_PRICE, CONTRACT_PRICE. 默认 CONTRACT_PRICE
priceProtect STRING NO 条件单触发保护:"TRUE" or "FALSE", 默认 "FALSE". STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET 需要此参数
newClientStrategyId STRING NO 用户自定义的订单号,不可以重复出现在挂单中。如空缺系统会自动赋值。必须满足正则规则: ^[\.A-Z\:/a-z0-9_-]{1,32}$
stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders.
activationPrice DECIMAL NO TRAILING_STOP_MARKET 单使用,默认标记价格
callbackRate DECIMAL NO TRAILING_STOP_MARKET 单使用, 最小0.1, 最大5,1代表1%
recvWindow LONG NO
timestamp LONG YES

根据 order type 的不同,某些参数强制要求,具体如下:

类型 强制要求的参数
STOP/TAKE_PROFIT quantity, price, stopPrice
STOP_MARKET/TAKE_PROFIT_MARKET stopPrice
TRAILING_STOP_MARKET callbackRate

修改UM订单 (TRADE)

响应:

{
    "orderId": 20072994037,
    "symbol": "BTCUSDT",
    "status": "NEW",
    "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW",
    "price": "30005",
    "avgPrice": "0.0",
    "origQty": "1",
    "executedQty": "0",
    "cumQty": "0",
    "cumQuote": "0",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "LONG",
    "origType": "LIMIT",
    "selfTradePreventionMode": "NONE", //self trading preventation mode
    "goodTillDate": 0      //order pre-set auot cancel time for TIF GTD order
    "updateTime": 1629182711600
}

PUT /papi/v1/um/order (HMAC SHA256)

修改UM订单功能,当前只支持限价(LIMIT)订单修改,修改后会在撮合队列里重新排序

权重(order): 1

参数:

名称 类型 是否必需 描述
orderId LONG NO 系统订单号
origClientOrderId STRING NO 用户自定义的订单号
symbol STRING YES 交易对
side ENUM YES 买卖方向 SELL, BUY; side需要和原订单相同
quantity DECIMAL YES 下单数量
price DECIMAL YES 委托价格
recvWindow LONG NO
timestamp LONG YES

原订单被部分执行且新订单quantity <= executedQty 原订单是GTX,新订单的价格会导致订单立刻执行 同一订单修改次数最多10000次 改单会保留该单原有的selfTradePreventionMode

修改CM订单 (TRADE)

响应:


{
    "orderId": 20072994037,
    "symbol": "BTCUSD_PERP",
    "pair": "BTCUSD",
    "status": "NEW",
    "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW",
    "price": "30005",
    "avgPrice": "0.0",
    "origQty": "1",
    "executedQty": "0",
    "cumQty": "0",
    "cumBase": "0",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "LONG",
    "origType": "LIMIT",
    "updateTime": 1629182711600
}

PUT/papi/v1/cm/order (HMAC SHA256)

修改CM订单功能,当前只支持限价(LIMIT)订单修改,修改后会在撮合队列里重新排序

权重(order): 1

参数:

名称 类型 是否必需 描述
orderId LONG NO 系统订单号
origClientOrderId STRING NO 用户自定义的订单号
symbol STRING YES 交易对
side ENUM YES 买卖方向 SELL, BUY
quantity DECIMAL YES 下单数量
price DECIMAL YES 委托价格
recvWindow LONG NO
timestamp LONG YES

撤单接口

取消活跃订单。

撤销UM订单 (TRADE)

响应:

{
    "avgPrice": "0.00000",
    "clientOrderId": "myOrder1",
    "cumQty": "0",
    "cumQuote": "0",
    "executedQty": "0",
    "orderId": 4611875134427365377,
    "origQty": "0.40",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "CANCELED",
    "symbol": "BTCUSDT",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1571110484038,
    "selfTradePreventionMode": "NONE", 
    "goodTillDate": 0  
}

DELETE /papi/v1/um/order (HMAC SHA256)

撤销UM订单

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
recvWindow LONG NO
timestamp LONG YES

撤销全部UM订单 (TRADE)

响应:

{
    "code": 200, 
    "msg": "The operation of cancel all open order is done."
}

撤销特定交易对全部UM订单

DELETE /papi/v1/um/allOpenOrders (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
recvWindow LONG NO
timestamp LONG YES

撤销CM订单 (TRADE)

响应:

{
    "avgPrice": "0.0",
    "clientOrderId": "myOrder1",
    "cumQty": "0",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 283194212,
    "origQty": "2",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",  
    "status": "CANCELED",          
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1571110484038,
}

DELETE /papi/v1/cm/order (HMAC SHA256)

撤销CM订单

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
recvWindow LONG NO
timestamp LONG YES

撤销全部CM订单 (TRADE)

响应:

{
    "code": 200, 
    "msg": "The operation of cancel all open order is done."
}

撤销特定交易对全部CM订单

DELETE /papi/v1/cm/allOpenOrders (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
recvWindow LONG NO
timestamp LONG YES

杠杆账户撤销订单 (TRADE)

响应:

{
  "symbol": "LTCBTC",
  "orderId": 28,
  "origClientOrderId": "myOrder1",
  "clientOrderId": "cancelMyOrder1",
  "price": "1.00000000",
  "origQty": "10.00000000",
  "executedQty": "8.00000000",
  "cummulativeQuoteQty": "8.00000000",
  "status": "CANCELED",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "side": "SELL"
  "selfTradePreventionMode": "EXPIRE_TAKER"
}

DELETE /papi/v1/margin/order (HMAC SHA256)

权重: 2

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
newClientOrderId STRING NO 用于唯一识别此撤销订单,默认自动生成。
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

杠杆账户撤销单一交易对的所有挂单 (TRADE)

响应:

[
  {
    "symbol": "BTCUSDT",
    "origClientOrderId": "E6APeyTJvkMvLMYMqu1KQ4",
    "orderId": 11,
    "orderListId": -1,
    "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx",
    "price": "0.089853",
    "origQty": "0.178622",
    "executedQty": "0.000000",
    "cummulativeQuoteQty": "0.000000",
    "status": "CANCELED",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY"
  },
  {
    "orderListId": 1929,
    "contingencyType": "OCO",
    "listStatusType": "ALL_DONE",
    "listOrderStatus": "ALL_DONE",
    "listClientOrderId": "2inzWQdDvZLHbbAmAozX2N",
    "transactionTime": 1585230948299,
    "symbol": "BTCUSDT",
    "orders": [
      {
        "symbol": "BTCUSDT",
        "orderId": 20,
        "clientOrderId": "CwOOIPHSmYywx6jZX77TdL"
      },
      {
        "symbol": "BTCUSDT",
        "orderId": 21,
        "clientOrderId": "461cPg51vQjV3zIMOXNz39"
      }
    ],
    "orderReports": [
      {
        "symbol": "BTCUSDT",
        "origClientOrderId": "CwOOIPHSmYywx6jZX77TdL",
        "orderId": 20,
        "orderListId": 1929,
        "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx",
        "price": "0.668611",
        "origQty": "0.690354",
        "executedQty": "0.000000",
        "cummulativeQuoteQty": "0.000000",
        "status": "CANCELED",
        "timeInForce": "GTC",
        "type": "STOP_LOSS_LIMIT",
        "side": "BUY",
        "stopPrice": "0.378131",
        "icebergQty": "0.017083"
        "selfTradePreventionMode": "EXPIRE_TAKER"
      },
      {
        "symbol": "BTCUSDT",
        "origClientOrderId": "461cPg51vQjV3zIMOXNz39",
        "orderId": 21,
        "orderListId": 1929,
        "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx",
        "price": "0.008791",
        "origQty": "0.690354",
        "executedQty": "0.000000",
        "cummulativeQuoteQty": "0.000000",
        "status": "CANCELED",
        "timeInForce": "GTC",
        "type": "LIMIT_MAKER",
        "side": "BUY",
        "icebergQty": "0.639962"
        "selfTradePreventionMode": "EXPIRE_TAKER"
      }
    ]
  }
]

DELETE /papi/v1/margin/allOpenOrders (HMAC SHA256)

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING YES
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

取消杠杆账户OCO订单 (TRADE)

响应:

{
  "orderListId": 0,
  "contingencyType": "OCO",
  "listStatusType": "ALL_DONE",
  "listOrderStatus": "ALL_DONE",
  "listClientOrderId": "C3wyj4WVEktd7u9aVBRXcN",
  "transactionTime": 1574040868128,
  "symbol": "LTCBTC",
  "orders": [
    {
      "symbol": "LTCBTC",
      "orderId": 2,
      "clientOrderId": "pO9ufTiFGg3nw2fOdgeOXa"
    },
    {
      "symbol": "LTCBTC",
      "orderId": 3,
      "clientOrderId": "TXOvglzXuaubXAaENpaRCB"
    }
  ],
  "orderReports": [
    {
      "symbol": "LTCBTC",
      "origClientOrderId": "pO9ufTiFGg3nw2fOdgeOXa",
      "orderId": 2,
      "orderListId": 0,
      "clientOrderId": "unfWT8ig8i0uj6lPuYLez6",
      "price": "1.00000000",
      "origQty": "10.00000000",
      "executedQty": "0.00000000",
      "cummulativeQuoteQty": "0.00000000",
      "status": "CANCELED",
      "timeInForce": "GTC",
      "type": "STOP_LOSS_LIMIT",
      "side": "SELL",
      "stopPrice": "1.00000000"
      "selfTradePreventionMode": "EXPIRE_BOTH"
    },
    {
      "symbol": "LTCBTC",
      "origClientOrderId": "TXOvglzXuaubXAaENpaRCB",
      "orderId": 3,
      "orderListId": 0,
      "clientOrderId": "unfWT8ig8i0uj6lPuYLez6",
      "price": "3.00000000",
      "origQty": "10.00000000",
      "executedQty": "0.00000000",
      "cummulativeQuoteQty": "0.00000000",
      "status": "CANCELED",
      "timeInForce": "GTC",
      "type": "LIMIT_MAKER",
      "side": "SELL"
      "selfTradePreventionMode": "EXPIRE_BOTH"
    }
  ]
}

DELETE /papi/v1/margin/orderList (HMAC SHA256)

取消杠杆账户订单。

权重: 2

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderListId LONG NO orderListIdlistClientOrderId 必须被提供
listClientOrderId STRING NO orderListIdlistClientOrderId 必须被提供
newClientOrderId STRING NO 用户自定义的本次撤销操作的ID(注意不是被撤销的订单的自定义ID)。如无指定会自动赋值
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

取消UM条件订单 (TRADE)

响应:

{
    "newClientStrategyId": "myOrder1",
    "strategyId":123445,
    "strategyStatus":"CANCELED",
    "strategyType": "TRAILING_STOP_MARKET",  
    "origQty": "11",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",                
    "symbol": "BTCUSDT",
    "timeInForce": "GTC",
    "activatePrice": "9020",            
    "priceRate": "0.3",                
    "bookTime": 1566818724710, //条件单下单时间  
    "updateTime": 1566818724722,
    "workingType":"CONTRACT_PRICE",
    "priceProtect": false,
    "selfTradePreventionMode": "NONE", 
    "goodTillDate": 0    
}

DELETE /papi/v1/um/conditional/order (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
strategyId LONG NO
newClientStrategyId STRING NO
recvWindow LONG NO
timestamp LONG YES

取消全部UM条件单 (TRADE)

响应:

{
    "code": "200", 
    "msg": "The operation of cancel all conditional open order is done."
}

DELETE /papi/v1/um/conditional/allOpenOrders (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
recvWindow LONG NO
timestamp LONG YES

取消CM条件订单 (TRADE)

响应:

{
    "newClientStrategyId": "myOrder1",
    "strategyId":123445,
    "strategyStatus":"CANCELED",
    "strategyType": "TRAILING_STOP_MARKET",  
    "origQty": "11",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",               
    "symbol": "BTCUSD",
    "timeInForce": "GTC",
    "activatePrice": "9020",           
    "priceRate": "0.3",                 
    "updateTime": 1566818724722,
    "workingType":"CONTRACT_PRICE",
    "priceProtect": false   
}

DELETE /papi/v1/cm/conditional/order

权重(Order): 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
strategyId LONG NO
newClientStrategyId STRING NO
recvWindow LONG NO
timestamp LONG YES

取消全部CM条件单 (TRADE)

响应:

{
    "code": "200", 
    "msg": "The operation of cancel all conditional open order is done."
}

DELETE /papi/v1/cm/conditional/allOpenOrders (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
recvWindow LONG NO
timestamp LONG YES

查询订单

查询UM订单 (USER_DATA)

响应:

{
    "avgPrice": "0.00000",
    "clientOrderId": "abc",
    "cumQuote": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "LIMIT",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "symbol": "BTCUSDT",
    "time": 1579276756075,              // order time
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1579276756075,        // update time
    "selfTradePreventionMode": "NONE", 
    "goodTillDate": 0  
}

GET /papi/v1/um/order (HMAC SHA256)

查询UM订单状态

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * orderIdorigClientOrderId 必须至少发送一个 * 请注意,如果订单满足如下条件,不会被查询到: * 订单的最终状态为 CANCELEDEXPIRED,并且 * 订单没有任何的成交记录,并且 * 订单生成时间 + 3天 < 当前时间

查询当前UM挂单 (USER_DATA)

响应:

{
    "avgPrice": "0.00000",              
    "clientOrderId": "abc",             
    "cumQuote": "0",                        
    "executedQty": "0",                 
    "orderId": 1917641,                 
    "origQty": "0.40",                      
    "origType": "LIMIT",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "symbol": "BTCUSDT",
    "time": 1579276756075,              // order time
    "timeInForce": "GTC",
    "type": "LIMIT",             
    "updateTime": 1579276756075
    "selfTradePreventionMode": "NONE", 
    "goodTillDate": 0             
}

GET /papi/v1/um/openOrder (HMAC SHA256)

查询当前UM挂单

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * orderIdorigClientOrderId 必须至少发送一个 * 查询的订单如果已经成交或取消,将返回报错 "Order does not exist"

查看当前全部UM挂单 (USER_DATA)

响应:

[
  {
    "avgPrice": "0.00000",
    "clientOrderId": "abc",
    "cumQuote": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "LIMIT",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "symbol": "BTCUSDT",
    "time": 1579276756075,            
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1579276756075
    "selfTradePreventionMode": "NONE", 
    "goodTillDate": 0        
  }
]

GET /papi/v1/um/openOrders (HMAC SHA256)

查看当前全部UM挂单,请小心使用不带symbol参数的调用

权重: 带symbol 1 - 不带 40

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * 不带symbol参数,会返回所有交易对的挂单

查询所有UM订单(包括历史订单) (USER_DATA)

响应:

[
  {
    "avgPrice": "0.00000",
    "clientOrderId": "abc",
    "cumQuote": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "LIMIT",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "symbol": "BTCUSDT",
    "time": 1579276756075,              
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1579276756075
    "selfTradePreventionMode": "NONE", 
    "goodTillDate": 0          
  }
]

GET /papi/v1/um/allOrders (HMAC SHA256)

查询所有UM订单

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 1000.
recvWindow LONG NO
timestamp LONG YES

注意: * orderIdorigClientOrderId 必须至少发送一个 * 请注意,如果订单满足如下条件,不会被查询到: * 订单的最终状态为 CANCELEDEXPIRED,并且 * 订单没有任何的成交记录,并且 * 订单生成时间 + 3天 < 当前时间 * 查询时间范围最大不得超过7天 * 默认查询最近7天内的数据

查询CM订单 (USER_DATA)

响应:

{
    "avgPrice": "0.0",
    "clientOrderId": "abc",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "LIMIT",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "status": "NEW",
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "positionSide": "SHORT",
    "time": 1579276756075,             
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1579276756075        
}

GET /papi/v1/cm/order (HMAC SHA256)

查询CM订单状态

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * orderIdorigClientOrderId 必须至少发送一个 * 请注意,如果订单满足如下条件,不会被查询到: * 订单的最终状态为 CANCELEDEXPIRED, AND * 订单没有任何的成交记录,并且 * 订单生成时间 + 3天 < 当前时间

查看当前全部CM挂单 (USER_DATA)

响应:

{
    "avgPrice": "0.0",              
    "clientOrderId": "abc",             
    "cumBase": "0",                     
    "executedQty": "0",                 
    "orderId": 1917641,                 
    "origQty": "0.40",                      
    "origType": "LIMIT",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD"
    "time": 1579276756075,              // order time
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1579276756075        // update time
}

GET /papi/v1/cm/openOrder (HMAC SHA256)

查看当前全部CM挂单,请小心使用不带symbol参数的调用

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * orderIdorigClientOrderId 必须至少发送一个 * 查询的订单如果已经成交或取消,将返回报错 "Order does not exist"

查看当前全部CM挂单 (USER_DATA)

响应:

[
  {
    "avgPrice": "0.0",
    "clientOrderId": "abc",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "LIMIT",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "symbol": "BTCUSD_200925",
    pair:"BTCUSD",
    "time": 1579276756075,              
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1579276756075      
  }
]

GET /papi/v1/cm/openOrders (HMAC SHA256)

查看当前全部CM挂单,请小心使用不带symbol参数的调用

权重:

带symbol 1 - 不带 40

参数:

名称 类型 是否必需 描述
symbol STRING NO
pair STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * 不带symbol参数,会返回所有交易对的挂单

查询所有CM订单(包括历史订单) (USER_DATA)

响应:

[
  {
    "avgPrice": "0.0",
    "clientOrderId": "abc",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "LIMIT",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "time": 1579276756075,              // order time
    "timeInForce": "GTC",
    "type": "LIMIT",
    "updateTime": 1579276756075       // update time
  }
]

GET /papi/v1/cm/allOrders (HMAC SHA256)

权重:

传symbol 20 传pairs 40

参数:

名称 类型 是否必需 描述
symbol STRING YES
pair STRING NO
orderId LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO 返回的结果集数量 默认值:50 最大值:100
recvWindow LONG NO
timestamp LONG YES

查询UM当前条件挂单 (USER_DATA)

响应:

{            
    "newClientStrategyId": "abc", 
    "strategyId":123445,
    "strategyStatus":"NEW",
    "strategyType": "TRAILING_STOP_MARKET",                                
    "origQty": "0.40",                      
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",               
    "symbol": "BTCUSDT",
    "bookTime": 1566818724710,       //条件单下单时间        
    "updateTime": 1566818724722,
    "timeInForce": "GTC",
    "activatePrice": "9020",           
    "priceRate": "0.3",
    "selfTradePreventionMode": "NONE", //self trading preventation mode
    "goodTillDate": 0                           
}

GET /papi/v1/um/conditional/openOrder (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
strategyId LONG NO
newClientStrategyId STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * strategyIdnewClientStrategyId 中的一个为必填参数. * 如果查询的条件单已经为CANCELEDTRIGGEREDEXPIRED,会报错"Order does not exist"

查看UM当前全部条件挂单 (USER_DATA)

响应:

[
  {
    "newClientStrategyId": "abc", 
    "strategyId":123445,
    "strategyStatus":"NEW",
    "strategyType": "TRAILING_STOP_MARKET",    
    "origQty": "0.40",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",               
    "symbol": "BTCUSDT", 
    "bookTime": 1566818724710,   //条件单下单时间             
    "updateTime": 1566818724722,
    "timeInForce": "GTC",
    "activatePrice": "9020",           
    "priceRate": "0.3",
    "selfTradePreventionMode": "NONE", //self trading preventation mode
    "goodTillDate": 0                
  }
]

GET /papi/v1/um/conditional/openOrders (HMAC SHA256)

查看UM当前全部条件挂单。 请小心使用不带symbol参数的调用

权重: 带symbol 1 ; 不带40

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * 不带symbol参数,会返回所有交易对的条件挂单

查询UM条件单历史 (USER_DATA)

响应:

{
    "newClientStrategyId": "abc", 
    "strategyId":123445,
    "strategyStatus":"TRIGGERED",
    "strategyType": "TRAILING_STOP_MARKET",  
    "origQty": "0.40",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",               
    "symbol": "BTCUSDT", 
    "orderId":12132343435,   //条件单触发后普通单id,当条件单被触发后才有
    "status": "NEW",     //条件单触发后普通单状态, 当条件单被触发后才有    
    "bookTime": 1566818724710,    //条件单下单时间            
    "updateTime": 1566818724722,
    "triggerTime": 1566818724750,  
    "timeInForce": "GTC",
    "type": "MARKET",   //条件单触发后普通订单类型
    "activatePrice": "9020",           
    "priceRate": "0.3",    
    "workingType":"CONTRACT_PRICE",
    "priceProtect": false,
    "selfTradePreventionMode": "NONE", //self trading preventation mode
    "goodTillDate": 0                
}

GET /papi/v1/um/conditional/orderHistory (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
strategyId LONG NO
newClientStrategyId STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * strategyIdnewClientStrategyId 中的一个为必填参数. * NEW 状态的条件订单不会返回 * 请注意,如果订单满足如下条件,不会被查询到: * 订单的最终状态为 CANCELED 或者 EXPIRED, 并且 * 订单没有任何的成交记录, 并且 * 订单生成时间 + 3天 < 当前时间

查询UM所有条件订单(包括历史订单) (USER_DATA)

响应:

[
  {
    "newClientStrategyId": "abc", 
    "strategyId":123445,
    "strategyStatus":"TRIGGERED",
    "strategyType": "TRAILING_STOP_MARKET",  
    "origQty": "0.40",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",                
    "symbol": "BTCUSDT", 
    "orderId":12132343435,  //条件单触发后普通单id,当条件单被触发后才有   
    "status": "NEW",      //条件单触发后普通单状态, 当条件单被触发后才有       
    "bookTime": 1566818724710,      //条件单下单时间        
    "updateTime": 1566818724722,
    "triggerTime": 1566818724750,  
    "timeInForce": "GTC",
    "type": "MARKET",    //条件单触发后普通订单类型
    "activatePrice": "9020",            
    "priceRate": "0.3",
    "selfTradePreventionMode": "NONE", //self trading preventation mode
    "goodTillDate": 0                 
  }
]

GET /papi/v1/um/conditional/allOrders (HMAC SHA256)

权重: 带symbol 1 ; 不带40

参数:

名称 类型 是否必需 描述
symbol STRING NO
strategyId LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 1000.
recvWindow LONG NO
timestamp LONG YES

注意: * 请注意,如果订单满足如下条件,不会被查询到: * 订单的最终状态为 CANCELED 或者 EXPIRED, 并且 * 订单没有任何的成交记录, 并且 * 订单生成时间 + 3天 < 当前时间 * 查询时间范围最大不得超过7天(默认查询最近7天内的数据).

查询CM当前条件挂单 (USER_DATA)

响应:

{            
    "newClientStrategyId": "abc", 
    "strategyId":123445,
    "strategyStatus":"NEW",
    "strategyType": "TRAILING_STOP_MARKET",                                
    "origQty": "0.40",                      
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",             
    "symbol": "BTCUSD",
    "bookTime": 1566818724710,   //条件单下单时间          
    "updateTime": 1566818724722,
    "timeInForce": "GTC",
    "activatePrice": "9020",           
    "priceRate": "0.3"                   
}

GET /papi/v1/cm/conditional/openOrder (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
strategyId LONG NO
newClientStrategyId STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * strategyIdnewClientStrategyId 中的一个为必填参数. * 如果查询的条件单已经为CANCELEDTRIGGEREDEXPIRED,会报错"Order does not exist"

查看CM当前全部条件挂单 (USER_DATA)

响应:

[
  {
    "newClientStrategyId": "abc", 
    "strategyId":123445,
    "strategyStatus":"NEW",
    "strategyType": "TRAILING_STOP_MARKET",    
    "origQty": "0.40",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",                
    "symbol": "BTCUSD", 
    "bookTime": 1566818724710,              
    "updateTime": 1566818724722,  //条件单下单时间  
    "timeInForce": "GTC",
    "activatePrice": "9020",           
    "priceRate": "0.3"               
  }
]

GET /papi/v1/cm/conditional/openOrders (HMAC SHA256)

查看CM当前全部条件挂单。 请小心使用不带symbol参数的调用

权重: 带symbol 1 ; 不带40

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * 不带symbol参数,会返回所有交易对的条件挂单

查询CM条件单历史 (USER_DATA)

响应:

{
    "newClientStrategyId": "abc", 
    "strategyId":123445,
    "strategyStatus":"TRIGGERED",
    "strategyType": "TRAILING_STOP_MARKET",  
    "origQty": "0.40",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",                
    "symbol": "BTCUSD", 
    "orderId": 12123343534,  //条件单触发后普通单id,当条件单被触发后才有
    "status": "NEW",   //条件单触发后普通单状态, 当条件单被触发后才有
    "bookTime": 1566818724710,   //条件单下单时间      
    "updateTime": 1566818724722,
    "triggerTime": 1566818724750,  
    "timeInForce": "GTC",
    "type": "MARKET",     //条件单触发后普通订单类型
    "activatePrice": "9020",           
    "priceRate": "0.3",
    "workingType":"CONTRACT_PRICE",
    "priceProtect": false                   
}

GET /papi/v1/cm/conditional/orderHistory (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
strategyId LONG NO
newClientStrategyId STRING NO
recvWindow LONG NO
timestamp LONG YES  

注意: * strategyIdnewClientStrategyId 中的一个为必填参数. * NEW 状态的条件订单不会返回 * 请注意,如果订单满足如下条件,不会被查询到: * 订单的最终状态为 CANCELED 或者 EXPIRED, 并且 * 订单没有任何的成交记录, 并且 * 订单生成时间 + 3天 < 当前时间

查询CM所有条件订单(包括历史订单)(USER_DATA)

响应:

[
  {
    "newClientStrategyId": "abc", 
    "strategyId":123445,
    "strategyStatus":"TRIGGERED",
    "strategyType": "TRAILING_STOP_MARKET",  
    "origQty": "0.40",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "stopPrice": "9300",               
    "symbol": "BTCUSD", 
    "orderId": 12123343534,    //条件单触发后普通单id,当条件单被触发后才有
    "status": "NEW",     //条件单触发后普通单状态, 当条件单被触发后才有
    "bookTime": 1566818724710,        //条件单下单时间  
    "updateTime": 1566818724722,
    "triggerTime": 1566818724750,  
    "timeInForce": "GTC",
    "type": "MARKET",    //条件单触发后普通订单类型
    "activatePrice": "9020",            
    "priceRate": "0.3"                
  }
]

GET /papi/v1/cm/conditional/allOrders

权重: 带symbol 1 ; 不带40

参数:

名称 类型 是否必需 描述
symbol STRING NO
strategyId LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 1000.
recvWindow LONG NO
timestamp LONG YES  

注意: * 请注意,如果订单满足如下条件,不会被查询到: * 订单的最终状态为 CANCELED 或者 EXPIRED, 并且 * 订单没有任何的成交记录, 并且 * 订单生成时间 + 3天 < 当前时间 * 查询时间范围最大不得超过7天(默认查询最近7天内的数据).

查询杠杆账户订单 (USER_DATA)

响应

{
   "clientOrderId": "ZwfQzuDIGpceVhKW5DvCmO",
   "cummulativeQuoteQty": "0.00000000",
   "executedQty": "0.00000000",
   "icebergQty": "0.00000000",
   "isWorking": true,
   "orderId": 213205622,
   "origQty": "0.30000000",
   "price": "0.00493630",
   "side": "SELL",
   "status": "NEW",
   "stopPrice": "0.00000000",
   "symbol": "BNBBTC",
   "time": 1562133008725,
   "timeInForce": "GTC",
   "type": "LIMIT",
   "updateTime": 1562133008725
   "accountId": 152950866,
   "selfTradePreventionMode": "EXPIRE_TAKER",
   "preventedMatchId": null,
   "preventedQuantity": null
}

GET /papi/v1/margin/order

权重(IP): 5

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

查询杠杆账户挂单记录 (USER_DATA)

响应

[
   {
       "clientOrderId": "qhcZw71gAkCCTv0t0k8LUK",
       "cummulativeQuoteQty": "0.00000000",
       "executedQty": "0.00000000",
       "icebergQty": "0.00000000",
       "isWorking": true,
       "orderId": 211842552,
       "origQty": "0.30000000",
       "price": "0.00475010",
       "side": "SELL",
       "status": "NEW",
       "stopPrice": "0.00000000",
       "symbol": "BNBBTC",
       "time": 1562040170089,
       "timeInForce": "GTC",
       "type": "LIMIT",
       "updateTime": 1562040170089
       "accountId": 152950866,
       "selfTradePreventionMode": "EXPIRE_TAKER",
       "preventedMatchId": null,
       "preventedQuantity": null
    }
]

GET /papi/v1/margin/openOrders (HMAC SHA256)

权重(IP): 5

参数:

名称 类型 是否必需 描述
symbol STRING NO
isIsolated STRING NO 是否逐仓杠杆,"TRUE", "FALSE", 默认 "FALSE"
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

查询杠杆账户的所有订单 (USER_DATA)

响应:

[
      {
          "clientOrderId": "D2KDy4DIeS56PvkM13f8cP",
          "cummulativeQuoteQty": "0.00000000",
          "executedQty": "0.00000000",
          "icebergQty": "0.00000000",
          "isWorking": false,
          "orderId": 41295,
          "origQty": "5.31000000",
          "price": "0.22500000",
          "side": "SELL",
          "status": "CANCELED",
          "stopPrice": "0.18000000",
          "symbol": "BNBBTC",
          "time": 1565769338806,
          "timeInForce": "GTC",
          "type": "TAKE_PROFIT_LIMIT",
          "updateTime": 1565769342148 
          "accountId": 152950866,
          "selfTradePreventionMode": "EXPIRE_TAKER",
          "preventedMatchId": null,
          "preventedQuantity": null
      }
]

GET /papi/v1/margin/allOrders (HMAC SHA256)

权重(IP): 100

访问限制
60次/分钟/IP

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO 默认 500;最大500.
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

查询杠杆账户 OCO (USER_DATA)

响应

{
  "orderListId": 27,
  "contingencyType": "OCO",
  "listStatusType": "EXEC_STARTED",
  "listOrderStatus": "EXECUTING",
  "listClientOrderId": "h2USkA5YQpaXHPIrkd96xE",
  "transactionTime": 1565245656253,
  "symbol": "LTCBTC",
  "orders": [
    {
      "symbol": "LTCBTC",
      "orderId": 4,
      "clientOrderId": "qD1gy3kc3Gx0rihm9Y3xwS"
    },
    {
      "symbol": "LTCBTC",
      "orderId": 5,
      "clientOrderId": "ARzZ9I00CPM8i3NhmU9Ega"
    }
  ]
}

GET /papi/v1/margin/orderList (HMAC SHA256)

根据提供的可选参数检索特定的杠杆账户 OCO 订单。

权重: 5

参数

名称 类型 是否必需 描述
orderListId LONG NO orderListIdlistClientOrderId 必须被提供
listClientOrderId STRING NO orderListIdlistClientOrderId 必须被提供
newClientOrderId STRING NO 用户自定义的本次撤销操作的ID(注意不是被撤销的订单的自定义ID)。如无指定会自动赋值。
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

查询特定杠杆账户所有 OCO(USER_DATA)

响应:


[
  {
    "orderListId": 29,
    "contingencyType": "OCO",
    "listStatusType": "EXEC_STARTED",
    "listOrderStatus": "EXECUTING",
    "listClientOrderId": "amEEAXryFzFwYF1FeRpUoZ",
    "transactionTime": 1565245913483,
    "symbol": "LTCBTC",
    "orders": [
      {
        "symbol": "LTCBTC",
        "orderId": 4,
        "clientOrderId": "oD7aesZqjEGlZrbtRpy5zB"
      },
      {
        "symbol": "LTCBTC",
        "orderId": 5,
        "clientOrderId": "Jr1h6xirOxgeJOUuYQS7V3"
      }
    ]
  },
  {
    "orderListId": 28,
    "contingencyType": "OCO",
    "listStatusType": "EXEC_STARTED",
    "listOrderStatus": "EXECUTING",
    "listClientOrderId": "hG7hFNxJV6cZy3Ze4AUT4d",
    "transactionTime": 1565245913407,
    "symbol": "LTCBTC",
    "orders": [
      {
        "symbol": "LTCBTC",
        "orderId": 2,
        "clientOrderId": "j6lFOfbmFMRjTYA7rRJ0LP"
      },
      {
        "symbol": "LTCBTC",
        "orderId": 3,
        "clientOrderId": "z0KCjOdditiLS5ekAFtK81"
      }
    ]
  }
]

GET /papi/v1/margin/allOrderList (HMAC SHA256)

根据提供的可选参数检索特定杠杆账户所有的 OCO 订单。

权重: 100

参数

名称 类型 是否必需 描述
fromId LONG NO 提供该项后, startTimeendTime 都不可提供
startTime LONG NO
endTime LONG NO
limit INT NO 默认值: 500; 最大值: 1000
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

查询杠杆账户 OCO 挂单 (USER_DATA)

响应:

[
  {
    "orderListId": 31,
    "contingencyType": "OCO",
    "listStatusType": "EXEC_STARTED",
    "listOrderStatus": "EXECUTING",
    "listClientOrderId": "wuB13fmulKj3YjdqWEcsnp",
    "transactionTime": 1565246080644,
    "symbol": "LTCBTC",
    "orders": [
      {
        "symbol": "LTCBTC",
        "orderId": 4,
        "clientOrderId": "r3EH2N76dHfLoSZWIUw1bT"
      },
      {
        "symbol": "LTCBTC",
        "orderId": 5,
        "clientOrderId": "Cv1SnyPD3qhqpbjpYEHbd2"
      }
    ]
  }
]

GET /papi/v1/margin/openOrderList (HMAC SHA256)

权重(IP): 5

参数

名称 类型 是否必需 描述
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

查询杠杆账户交易历史 (USER_DATA)

响应:

[
    {
        "commission": "0.00006000",
        "commissionAsset": "BTC",
        "id": 34,
        "isBestMatch": true,
        "isBuyer": false,
        "isMaker": false,
        "orderId": 39324,
        "price": "0.02000000",
        "qty": "3.00000000",
        "symbol": "BNBBTC",
        "time": 1561973357171
    }
]

GET /papi/v1/margin/myTrades (HMAC SHA256)

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING YES
orderId LONG NO
startTime LONG NO
endTime LONG NO
fromId LONG NO 获取TradeId,默认获取近期交易历史。
limit INT NO 默认 500; 最大 1000.
recvWindow LONG NO 默认值不能大于 60000
timestamp LONG YES

查询UM订单修改历史 (USER_DATA)

响应:

[
    {
        "amendmentId": 5363,    // 修改记录号
        "symbol": "BTCUSDT",
        "pair": "BTCUSDT",
        "orderId": 20072994037,
        "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW",
        "time": 1629184560899,  // 修改时间
        "amendment": {
            "price": {
                "before": "30004",
                "after": "30003.2"
            },
            "origQty": {
                "before": "1",
                "after": "1"
            },
            "count": 3  // 修改记数,代表该修改记录是这笔订单第几次修改
        }
    },
    {
        "amendmentId": 5361,
        "symbol": "BTCUSDT",
        "pair": "BTCUSDT",
        "orderId": 20072994037,
        "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW",
        "time": 1629184533946,
        "amendment": {
            "price": {
                "before": "30005",
                "after": "30004"
            },
            "origQty": {
                "before": "1",
                "after": "1"
            },
            "count": 2
        }
    },
    {
        "amendmentId": 5325,
        "symbol": "BTCUSDT",
        "pair": "BTCUSDT",
        "orderId": 20072994037,
        "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW",
        "time": 1629182711787,
        "amendment": {
            "price": {
                "before": "30002",
                "after": "30005"
            },
            "origQty": {
                "before": "1",
                "after": "1"
            },
            "count": 1
        }
    }
]

GET /papi/v1/um/orderAmendment (HMAC SHA256)

查询UM订单修改历史

权重(order): 1

参数:

名称 类型 类型 描述
symbol STRING YES 交易对
orderId LONG NO 系统订单号
origClientOrderId STRING NO 用户自定义的订单号
startTime LONG NO 起始时间
endTime LONG NO 结束时间
limit INT NO 默认值 500, 最大值 1000
recvWindow LONG NO
timestamp LONG YES

注意:

查询CM订单修改历史 (USER_DATA)

响应:


[
    {
        "amendmentId": 5363,    // 修改记录号
        "symbol": "BTCUSD_PERP",
        "pair": "BTCUSD",
        "orderId": 20072994037,
        "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW",
        "time": 1629184560899,  // 修改时间
        "amendment": {
            "price": {
                "before": "30004",
                "after": "30003.2"
            },
            "origQty": {
                "before": "1",
                "after": "1"
            },
            "count": 3  // 修改记数,代表该修改记录是这笔订单第几次修改
        }
    },
    {
        "amendmentId": 5361,
        "symbol": "BTCUSD_PERP",
        "pair": "BTCUSD",
        "orderId": 20072994037,
        "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW",
        "time": 1629184533946,
        "amendment": {
            "price": {
                "before": "30005",
                "after": "30004"
            },
            "origQty": {
                "before": "1",
                "after": "1"
            },
            "count": 2
        }
    },
    {
        "amendmentId": 5325,
        "symbol": "BTCUSD_PERP",
        "pair": "BTCUSD",
        "orderId": 20072994037,
        "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW",
        "time": 1629182711787,
        "amendment": {
            "price": {
                "before": "30002",
                "after": "30005"
            },
            "origQty": {
                "before": "1",
                "after": "1"
            },
            "count": 1
        }
    }
]

GET /papi/v1/cm/orderAmendment (HMAC SHA256)

查询CM订单修改历史

权重(order): 1

参数:

名称 类型 类型 描述
symbol STRING YES 交易对
orderId LONG NO 系统订单号
origClientOrderId STRING NO 用户自定义的订单号
startTime LONG NO 起始时间
endTime LONG NO 结束时间
limit INT NO 默认值 50, 最大值 100
recvWindow LONG NO
timestamp LONG YES

注意:

账户信息

查询账户余额(USER_DATA)

响应:


[
    {
        "asset": "USDT",    // 资产
        "totalWalletBalance": "122607.35137903", // 钱包余额 =  全仓杠杆未锁定 + 全仓杠杆锁定 + u本位合约钱包余额 + 币本位合约钱包余额
        "crossMarginAsset": "92.27530794", // 全仓资产 = 全仓杠杆未锁定 + 全仓杠杆锁定
        "crossMarginBorrowed": "10.00000000", // 全仓杠杆借贷
        "crossMarginFree": "100.00000000", // 全仓杠杆未锁定
        "crossMarginInterest": "0.72469206", // 全仓杠杆利息
        "crossMarginLocked": "3.00000000", //全仓杠杆锁定 
        "umWalletBalance": "0.00000000",  // u本位合约钱包余额
        "umUnrealizedPNL": "23.72469206",     // u本位未实现盈亏
        "cmWalletBalance": "23.72469206",       // 币本位合约钱包余额
        "cmUnrealizedPNL": "",    // 币本位未实现盈亏
        "updateTime": 1617939110373,
        "negativeBalance": "0"
    }
]

**OR (when symbol sent)**
{
    "asset": "USDT",    
    "totalWalletBalance": "122607.35137903", 
    "crossMarginBorrowed": "10.00000000", 
    "crossMarginFree": "100.00000000", 
    "crossMarginInterest": "0.72469206", 
    "crossMarginLocked": "3.00000000",
    "umWalletBalance": "0.00000000",  
    "umUnrealizedPNL": "23.72469206",     
    "cmWalletBalance": "23.72469206",      
    "cmUnrealizedPNL": "",   
    "updateTime": 1617939110373
    "negativeBalance": "0"
}

GET /papi/v1/balance (HMAC SHA256)

权重: 20

参数:

名称 类型 是否必需 描述
asset STRING NO
recvWindow LONG NO
timestamp LONG YES

查询账户信息 (USER_DATA)

响应:

{
        "uniMMR": "5167.92171923",   // 统一账户维持保证金率
        "accountEquity": "122607.35137903",   // 以USD计价的账户权益
        "actualEquity": "73.47428058",   // 不考虑质押率后的以USD计价账户权益
        "accountInitialMargin": "23.72469206", 
        "accountMaintMargin": "23.72469206", // 以USD计价统一账户维持保证金
        "accountStatus": "NORMAL"   // 统一账户账户状态:"NORMAL", "MARGIN_CALL", "SUPPLY_MARGIN", "REDUCE_ONLY", "ACTIVE_LIQUIDATION", "FORCE_LIQUIDATION", "BANKRUPTED"
        "virtualMaxWithdrawAmount": "1627523.32459208"  // 以USD计价的最大可转出
        "totalAvailableBalance":"",
        "totalMarginOpenLoss":"", 
        "updateTime": 1657707212154 // 更新时间 
}

GET /papi/v1/account (HMAC SHA256)

权重: 20

参数:

名称 类型 是否必需 描述
recvWindow LONG NO
timestamp LONG YES

查询账户最大可借贷额度 (USER_DATA)

响应:

{
  "amount": 125 // 系统可借充足情况下用户账户当前最大可借额度
  "borrowLimit": 60 // 平台限制的用户当前等级可以借的额度
}

GET /papi/v1/margin/maxBorrowable (HMAC SHA256)

查询账户最大可借贷额度

权重: 5

参数:

名称 类型 是否必需 描述
asset STRING YES
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

查询账户最大可转出额度(USER_DATA)

响应:

{ 
  "amount": "60" 
}

GET /papi/v1/margin/maxWithdraw (HMAC SHA256)

权重: 5

参数:

名称 类型 是否必需 描述
asset STRING YES
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

用户UM持仓风险(USER_DATA)

响应:

* 单向持仓模式下(存在持仓才会返回):
 [
    {
        "entryPrice": "0.00000", // 开仓均价
        "leverage": "10", // 当前杠杆倍数
        "markPrice": "6679.50671178",   // 当前标记价格
        "maxNotionalValue": "20000000", // 当前杠杆倍数允许的名义价值上限
        "positionAmt": "0.000", // 头寸数量,符号代表多空方向, 正数为多,负数为空
        "notional": "0",
        "symbol": "BTCUSDT", // 交易对
        "unRealizedProfit": "0.00000000", // 持仓未实现盈亏
        "liquidationPrice": "6170.20509059",
        "positionSide": "BOTH", // 持仓方向
        "updateTime": 1625474304765   // 更新时间
        "breakEvenPrice": "0.00000" 
    }
]

* 双向持仓模式下(存在持仓才会返回):
[
    {
        "symbol": "BTCUSDT",
        "positionAmt": "0.001",
        "entryPrice": "22185.2",
        "markPrice": "21123.05052574",
        "unRealizedProfit": "-1.06214947",
        "liquidationPrice": "6170.20509059",
        "leverage": "4",
        "maxNotionalValue": "100000000",
        "positionSide": "LONG",
        "notional": "21.12305052",
        "updateTime": 1655217461579
        "breakEvenPrice": "0.00000"  
    },
    {
        "symbol": "BTCUSDT",
        "positionAmt": "0.001",
        "entryPrice": "0.0",
        "markPrice": "21123.05052574",
        "unRealizedProfit": "0.00000000",
        "liquidationPrice": "6170.20509059",
        "leverage": "4",
        "maxNotionalValue": "100000000",
        "positionSide": "SHORT",
        "notional": "0",
        "updateTime": 0
         "breakEvenPrice": "0.00000"
    }
]

GET /papi/v1/um/positionRisk

获取用户UM持仓风险

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: 请与账户推送信息ACCOUNT_UPDATE配合使用,以满足您的及时性和准确性需求。

用户CM持仓风险(USER_DATA)

响应:

* 单向持仓模式下:
 [
    {
        "symbol": "BTCUSD_201225", // 交易对
        "positionAmt": "0", // 头寸数量, 符号代表多空方向, 正数为多, 负数为空
        "entryPrice": "0.0", // 开仓均价
        "markPrice": "0.00000000", // 当前标记价格
        "unRealizedProfit": "0.00000000", // 持仓未实现盈亏
        "liquidationPrice": "6170.20509059", // 爆仓价
        "leverage": "125", // 当前杠杆倍数
        "positionSide": "BOTH", // 持仓方向
        "updateTime": 0, // 最新更新时间
        "maxQty": "50",  // 当前杠杆倍数允许的数量上限(标的数量)
        "notionalValue": "0.00084827"
        "breakEvenPrice": "0.00000"
    }
]

* 双向持仓模式下(存在持仓才会返回):
[
    {
        "symbol": "BTCUSD_201225",
        "positionAmt": "1",
        "entryPrice": "11707.70000003",
        "markPrice": "11788.66626667",
        "unRealizedProfit": "0.00005866",
        "liquidationPrice": "6170.20509059",
        "leverage": "125",
        "positionSide": "LONG",
        "updateTime": 1627026881327,
        "maxQty": "50",
        "notionalValue": "0.00084827"
        "breakEvenPrice": "0.00000" 
    },
    {
        "symbol": "BTCUSD_201225",
        "positionAmt": "1",
        "entryPrice": "11707.70000003",
        "markPrice": "11788.66626667",
        "unRealizedProfit": "0.00005866",
        "liquidationPrice": "6170.20509059",
        "leverage": "125",
        "positionSide": "LONG",
        "updateTime": 1627026881327,
        "maxQty": "50",
        "notionalValue": "0.00084827"
        "breakEvenPrice": "0.00000" 
    }
] 

获取用户CM持仓风险

GET /papi/v1/cm/positionRisk (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
marginAsset STRING NO
pair STRING NO
recvWindow LONG NO
timestamp LONG YES

注意: * marginAssetpair 不要同时提供 * marginAssetpair 均不提供则返回所有上市状态和结算中的symbol * 对于单向持仓模式,仅会展示BOTH方向的持仓 * 对于双向持仓模式,会展示所有BOTHLONG,和SHORT方向的持仓 * 请与账户推送信息ACCOUNT_UPDATE配合使用,以满足您的及时性和准确性需求。

调整UM开仓杠杆 (TRADE)

响应:

{
    "leverage": 21,
    "maxNotionalValue": "1000000",
    "symbol": "BTCUSDT"
}

POST /papi/v1/um/leverage (HMAC SHA256)

调整用户在指定UM symbol合约的开仓杠杆。不同持仓方向上使用相同杠杆倍数,共享允许的最大交易标的资产数量

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
leverage INT YES target initial leverage: int from 1 to 125
recvWindow LONG NO
timestamp LONG YES

调整CM开仓杠杆 (TRADE)

响应:

{
    "leverage": 21,
    "maxQty": "1000",
    "symbol": "BTCUSD_200925"
}

POST /papi/v1/cm/leverage (HMAC SHA256)

调整用户在指定CM symbol合约的开仓杠杆。不同持仓方向上使用相同杠杆倍数,共享允许的最大交易标的资产数量

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
leverage INT YES target initial leverage: int from 1 to 125
recvWindow LONG NO
timestamp LONG YES

更改UM持仓模式(TRADE)

响应:

{
    "code": 200,
    "msg": "success"
}

POST /papi/v1/um/positionSide/dual (HMAC SHA256)

变换用户在UM所有symbol合约上的持仓模式:双向持仓或单向持仓。

权重: 1

参数:

名称 类型 是否必需 描述
dualSidePosition STRING YES "true": 双向持仓模式;"false": 单向持仓模式
recvWindow LONG NO
timestamp LONG YES

更改CM持仓模式(TRADE)

响应:

{
    "code": 200,
    "msg": "success"
}

POST /papi/v1/cm/positionSide/dual (HMAC SHA256)

变换用户在CM所有symbol合约上的持仓模式:双向持仓或单向持仓。

权重: 1

参数:

名称 类型 是否必需 描述
dualSidePosition STRING YES "true": 双向持仓模式;"false": 单向持仓模式
recvWindow LONG NO
timestamp LONG YES

查询UM持仓模式(USER_DATA)

响应:

{
    "dualSidePosition": true // "true": 双向持仓模式;"false": 单向持仓模式
}

GET /papi/v1/um/positionSide/dual (HMAC SHA256)

查询用户目前在UM所有symbol合约上的持仓模式: 双向持仓或单向持仓。

权重: 30

参数:

名称 类型 是否必需 描述
recvWindow LONG NO
timestamp LONG YES

查询CM持仓模式(USER_DATA)

响应:

{
    "dualSidePosition": true // "true": 双向持仓模式;"false": 单向持仓模式
}

GET /papi/v1/cm/positionSide/dual (HMAC SHA256)

查询用户目前在CM所有symbol合约上的持仓模式: 双向持仓或单向持仓。

权重: 30

参数:

名称 类型 是否必需 描述
recvWindow LONG NO
timestamp LONG YES

UM账户成交历史 (USER_DATA)

响应:

[
    {
        "symbol": "BTCUSDT",
        "id": 67880589,
        "orderId": 270093109,
        "side": "SELL",
        "price": "28511.00",
        "qty": "0.010",
        "realizedPnl": "2.58500000",
        "marginAsset": "USDT",
        "quoteQty": "285.11000",
        "commission": "-0.11404400",
        "commissionAsset": "USDT",
        "time": 1680688557875,
        "buyer": false,
        "maker": false,
        "positionSide": "BOTH"
    }
] 

GET /papi/v1/um/userTrades (HMAC SHA256)

获取UM某交易对的成交历史

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING YES 交易对
orderId INT NO
startTime LONG NO
endTime LONG NO
fromId LONG NO 返回该fromId及之后的成交,缺省返回最近的成交
limit INT NO 返回的结果集数量 默认值:50 最大值:1000
recvWindow LONG NO
timestamp LONG YES

CM账户成交历史 (USER_DATA)

响应:

[
    {
        'symbol': 'BTCUSD_200626',
        'id': 6,
        'orderId': 28,
        'pair': 'BTCUSD',
        'side': 'SELL',
        'price': '8800',
        'qty': '1',
        'realizedPnl': '0',
        'marginAsset': 'BTC',
        'baseQty': '0.01136364',
        'commission': '0.00000454',
        'commissionAsset': 'BTC',
        'time': 1590743483586,
        'positionSide': 'BOTH',
        'buyer': false,
        'maker': false
    }
]

GET /papi/v1/cm/userTrades (HMAC SHA256)

获取CM成交历史

权重:

传symbol 20 传pairs 40

参数:

名称 类型 是否必需 描述
symbol STRING NO
pair STRING NO
startTime LONG NO
endTime LONG NO
fromId LONG NO 返回该fromId及之后的成交,缺省返回最近的成交,仅支持配合symbol使用
limit INT NO 返回的结果集数量 默认值:50 最大值:1000
recvWindow LONG NO
timestamp LONG YES

查询UM杠杆分层标准 (USER_DATA)

响应:

[
    {
        "symbol": "ETHUSDT",
        "notionalCoef": "4.0",
        "brackets": [
            {
                "bracket": 1,   // 层级
                "initialLeverage": 75,  // 该层允许的最高初始杠杆倍数
                "notionalCap": 10000,  // 该层对应的数量上限
                "notionalFloor": 0,  // 该层对应的数量下限 
                "maintMarginRatio": 0.0065, // 该层对应的维持保证金率
                "cum":0 // 速算数

            },
        ]
    }
]

GET /papi/v1/um/leverageBracket

查询UM杠杆分层标准

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

查询CM杠杆分层标准 (USER_DATA)

响应:

[
    {
        "symbol": "BTCUSD_PERP",
        "notionalCoef": "4.0",
        "brackets": [
            {
                "bracket": 1,   // 层级
                "initialLeverage": 125,  // 该层允许的最高初始杠杆倍数
                "qtyCap": 50,  // 该层对应的数量上限
                "qtyFloor": 0,  //  该层对应的数量下限 
                "maintMarginRatio": 0.004, // 该层对应的维持保证金率
                "cum": 0.0 // 速算数
            },
        ]
    }
]

GET /papi/v1/cm/leverageBracket

查询CM杠杆分层标准

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

获取账户杠杆强制平仓记录 (USER_DATA)

响应:

{
    "rows": [
        {
            "avgPrice": "0.00388359",
            "executedQty": "31.39000000",
            "orderId": 180015097,
            "price": "0.00388110",
            "qty": "31.39000000",
            "side": "SELL",
            "symbol": "BNBBTC",
            "timeInForce": "GTC",
            "updatedTime": 1558941374745
        }
    ],
    "total": 1
}

GET /papi/v1/margin/forceOrders (HMAC SHA256)

获取账户杠杆强制平仓记录

权重: 1

参数:

名称 类型 是否必需 描述
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。 开始值 1. 默认:1
size LONG NO 默认:10 最大:100
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

用户强平单历史(USER_DATA)

[
  {
    "orderId": 6071832819, 
    "symbol": "BTCUSDT", 
    "status": "FILLED", 
    "clientOrderId": "autoclose-1596107620040000020", 
    "price": "10871.09", 
    "avgPrice": "10913.21000", 
    "origQty": "0.001", 
    "executedQty": "0.001", 
    "cumQuote": "10.91321", 
    "timeInForce": "IOC", 
    "type": "LIMIT", 
    "reduceOnly": false, 
    "side": "SELL", 
    "positionSide": "BOTH", 
    "origType": "LIMIT", 
    "time": 1596107620044, 
    "updateTime": 1596107620087
  }
]

GET /papi/v1/um/forceOrders (HMAC SHA256)

查询用户UM强平单历史

权重: 带symbol 20, 不带symbol 50

参数:

名称 类型 是否必需 描述
symbol STRING NO
autoCloseType ENUM NO LIQUIDATION: 强平单, ADL: ADL减仓单.
startTime LONG NO
endTime LONG NO
limit INT NO 默认50;最大100.
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

响应:

用户CM强平单历史 (USER_DATA)

响应:

[
  {
    "orderId": 165123080,
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "status": "FILLED",
    "clientOrderId": "autoclose-1596542005017000006",
    "price": "11326.9",
    "avgPrice": "11326.9",
    "origQty": "1",
    "executedQty": "1",
    "cumBase": "0.00882854",
    "timeInForce": "IOC",
    "type": "LIMIT",
    "reduceOnly": false,
    "side": "SELL",
    "positionSide": "BOTH",
    "origType": "LIMIT",
    "time": 1596542005019,
    "updateTime": 1596542005050
  }
]

GET /papi/v1/cm/forceOrders (HMAC SHA256)

查询用户CM强平单历史

权重:

带symbol 20, 不带symbol 50

参数:

名称 类型 是否必需 描述
symbol STRING NO
autoCloseType ENUM NO LIQUIDATION: 强平单, ADL: ADL减仓单.
startTime LONG NO
endTime LONG NO
limit INT NO 默认50;最大100.
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

统一账户UM合约交易量化规则指标 (USER_DATA)

响应:

{
    "indicators": { // indicator:风控指标名, value:用户在该市场的风控指标数值, triggerValue:阈值, 对于没有达到记录阈值的则不返回数据。
        "BTCUSDT": [
            {
                "isLocked": true, //用户该品种交易是否被风控禁用
                "plannedRecoverTime": 1545741270000,
                "indicator": "UFR",  // Unfilled Ratio (UFR)
                "value": 0.05,  // Current value
                "triggerValue": 0.995  // Trigger value
            },
            {
                "isLocked": true,
                "plannedRecoverTime": 1545741270000,
                "indicator": "IFER",  // IOC/FOK Expiration Ratio (IFER)
                "value": 0.99,  // Current value
                "triggerValue": 0.99  // Trigger value
            },
            {
                "isLocked": true,
                "plannedRecoverTime": 1545741270000,
                "indicator": "GCR",  // GTC Cancellation Ratio (GCR)
                "value": 0.99,  // Current value
                "triggerValue": 0.99  // Trigger value
            },
            {
                "isLocked": true,
                "plannedRecoverTime": 1545741270000,
                "indicator": "DR",  // Dust Ratio (DR)
                "value": 0.99,  // Current value
                "triggerValue": 0.99  // Trigger value
            }
        ]
    },
    "updateTime": 1545741270000
}

Or (account violation triggered)

{
    "indicators":{
        "ACCOUNT":[
            {
                "indicator":"TMV",  //  Too many violations 多交易对触发账号层级违规
                "value":10,
                "triggerValue":1,
                "plannedRecoverTime":1644919865000,
                "isLocked":true
            }
        ]
    },
    "updateTime":1644913304748
}

GET /papi/v1/um/apiTradingStatus

查询合约交易量化规则指标

权重: 1 for a single symbol 10 when the symbol parameter is omitted

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

查询用户UM手续费率 (USER_DATA)

响应:

{
    "symbol": "BTCUSDT",
    "makerCommissionRate": "0.0002",  // 0.02%
    "takerCommissionRate": "0.0004"   // 0.04%
}

GET /papi/v1/um/commissionRate (HMAC SHA256)

查询用户UM手续费率

权重: 20

参数:

名称 类型 是否必需 描述
symbol STRING YES
recvWindow LONG NO
timestamp LONG YES

查询用户CM手续费率 (USER_DATA)

响应:

{
    "symbol": "BTCUSD_PERP",
    "makerCommissionRate": "0.00015",  // 0.015%
    "takerCommissionRate": "0.00040"   // 0.040%
}

GET /papi/v1/cm/commissionRate (HMAC SHA256)

查询用户CM手续费率

权重: 20

参数:

名称 类型 是否必需 描述
symbol STRING YES
recvWindow LONG NO
timestamp LONG YES

查询杠杆借贷记录 (USER_DATA)

响应:

{
  "rows": [
    {
        "txId": 12807067523,
        "asset": "BNB",
        "principal": "0.84624403",
        "timestamp": 1555056425000,
        "status": "CONFIRMED"  //状态: PENDING (等待执行), CONFIRMED (成功借贷), FAILED (执行失败);
    }
  ],
  "total": 1
}

GET /papi/v1/margin/marginLoan

查询杠杆借贷记录

权重: 10

参数:

名称 类型 是否必需 描述
asset STRING YES
txId LONG NO tranId in POST/papi/v1/marginLoan
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。 开始值 1。 默认:1
size LONG NO Default:10 Max:100
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

查询杠杆还贷记录(USER_DATA)

响应:

{
     "rows": [
         {
                "amount": "14.00000000",   //还款总额
                "asset": "BNB",   
                "interest": "0.01866667",    //支付的利息
                "principal": "13.98133333",   //支付的本金
                "status": "CONFIRMED",   //状态: PENDING (等待执行), CONFIRMED (成功还款), FAILED (执行失败);
                "timestamp": 1563438204000,
                "txId": 2970933056
         }
     ],
     "total": 1
}

GET /papi/v1/margin/repayLoan

查询杠杆还贷记录

权重: 10

参数:

名称 类型 是否必需 描述
asset STRING YES
txId LONG NO the tranId in POST/papi/v1/repayLoan
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。 开始值 1。 默认:1
size LONG NO Default:10 Max:100
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

获取杠杆利息历史 (USER_DATA)

响应:

{
  "rows": [
    {            
      "txId": 1352286576452864727,           
      "interestAccuredTime": 1672160400000,            
      "asset": "USDT", 
      "rawAsset": USDT,           
      "principal": "45.3313",            
      "interest": "0.00024995",            
      "interestRate": "0.00013233",            
      "type": "ON_BORROW"          
    }
  ],
  "total": 1
}

GET/papi/v1/margin/marginInterestHistory (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。 开始值 1. 默认:1
size LONG NO 默认:10 最大:100
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

查询统一账户期货负余额收息历史(USER_DATA)

响应:


[
    {
        "asset": "USDT",    
        "interest": "24.4440",               //利息金额
        "interestAccuredTime": 1670227200000,
        "interestRate": "0.0001164",         //日利率 
        "principal": "210000"
    }
]

GET /papi/v1/portfolio/interest-history

查询统一账户期货负余额收息历史

权重: 50

参数:

名称 类型 是否必需 描述
asset STRING NO
startTime LONG NO
endTime LONG NO
size LONG NO Default:10 Max:100
recvWindow LONG NO
timestamp LONG YES

统一账户资金归集(TRADE)

响应:

{
    "msg": "success"
}

POST /papi/v1/auto-collection

资金归集到统一账户钱包

权重: 750

参数:

名称 类型 是否必需 描述
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

特定资产资金归集(TRADE)

响应:

{
    "msg": "success"
}

POST /papi/v1/asset-collection

特定资产账户资金归集,从合约账户划转到杠杆账户

权重(IP):

30

参数:

名称 类型 是否必需 描述
asset STRING YES
recvWindow LONG NO
timestamp LONG YES

BNB划转(TRADE)

响应:

{
    //transaction id
    "tranId": 100000001
}  

POST /papi/v1/bnb-transfer

从PM钱包划转BNB到UM钱包

权重: 750

参数:

名称 类型 是否必需 描述
amount DECIMAL YES
transferSide STRING YES "TO_UM","FROM_UM"
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

获取UM损益资金流水 (USER_DATA)

响应:


[
    {
        "symbol": "",               // 交易对,仅针对涉及交易对的资金流
        "incomeType": "TRANSFER",   // 资金流类型
        "income": "-0.37500000",    // 资金流数量,正数代表流入,负数代表流出
        "asset": "USDT",            // 资产内容
        "info":"TRANSFER",          // 备注信息,取决于流水类型
        "time": 1570608000000,      
        "tranId":"9689322392",      // 划转ID
        "tradeId":""                // 引起流水产生的原始交易ID 
    },
    {
        "symbol": "BTCUSDT",
        "incomeType": "COMMISSION", 
        "income": "-0.01000000",
        "asset": "USDT",
        "info":"COMMISSION",
        "time": 1570636800000,
        "tranId":"9689322392",
        "tradeId":"2059192"
    }
]

GET /papi/v1/um/income (HMAC SHA256)

权重: 30

参数:

名称 类型 是否必需 描述
symbol STRING NO
incomeType STRING NO TRANSFER, WELCOME_BONUS, REALIZED_PNL, FUNDING_FEE, COMMISSION, INSURANCE_CLEAR, REFERRAL_KICKBACK, COMMISSION_REBATE, API_REBATE, CONTEST_REWARD, CROSS_COLLATERAL_TRANSFER, OPTIONS_PREMIUM_FEE, OPTIONS_SETTLE_PROFIT, INTERNAL_TRANSFER, AUTO_EXCHANGE, DELIVERED_SETTELMENT, COIN_SWAP_DEPOSIT, COIN_SWAP_WITHDRAW, POSITION_LIMIT_INCREASE_FEE
startTime LONG NO 起始时间
endTime LONG NO 结束时间
limit INT NO 默认 100; 最大 1000
recvWindow LONG NO
timestamp LONG YES

获取CM损益资金流水(USER_DATA)

响应:


[
    {
        "symbol": "",               // 交易对,仅针对涉及交易对的资金流
        "incomeType": "TRANSFER",   // 资金流类型
        "income": "-0.37500000",    // 资金流数量,正数代表流入,负数代表流出
        "asset": "BTC",             // 资产内容
        "info":"WITHDRAW",          // 备注信息,取决于流水类型
        "time": 1570608000000,
        "tranId":"9689322392",      // 划转ID
        "tradeId":""                // 引起流水产生的原始交易ID
    },
    {
        "symbol": "BTCUSD_200925",
        "incomeType": "COMMISSION", 
        "income": "-0.01000000",
        "asset": "BTC",
        "info":"",
        "time": 1570636800000,
        "tranId":"9689322392",
        "tradeId":"2059192"
    }
]

GET /papi/v1/cm/income (HMAC SHA256)

权重: 30

参数:

名称 类型 是否必需 描述
symbol STRING NO
incomeType STRING NO "TRANSFER","WELCOME_BONUS", "FUNDING_FEE", "REALIZED_PNL", "COMMISSION", "INSURANCE_CLEAR", and "DELIVERED_SETTELMENT"
startTime LONG NO 起始时间
endTime LONG NO 结束时间
limit INT NO 默认 100; 最大 1000
recvWindow LONG NO
timestamp LONG YES

获取UM账户信息 (USER_DATA)

响应:

{   
    "tradeGroupId": -1
    "assets": [
        {
            "asset": "USDT",            // 资产
            "crossWalletBalance": "23.72469206",      // 全仓账户余额
            "crossUnPnl": "0.00000000",    // 全仓持仓未实现盈亏
            "maintMargin": "0.00000000",   // 维持保证金
            "initialMargin": "0.00000000", // 当前所需起始保证金
            "positionInitialMargin": "0.00000000",  //持仓所需起始保证金(基于最新标记价格)
            "openOrderInitialMargin": "0.00000000", //当前挂单所需起始保证金(基于最新标记价格)
            "updateTime": 1625474304765 // 更新时间
        }
    ],
    "positions": [  // 头寸,将返回所有市场symbol。
        //根据用户持仓模式展示持仓方向,即单向模式下只返回BOTH持仓情况,双向模式下只返回 LONG 和 SHORT 持仓情况
        {
            "symbol": "BTCUSDT",    // 交易对
            "initialMargin": "0",   // 当前所需起始保证金(基于最新标记价格)
            "maintMargin": "0",     // 维持保证金
            "unrealizedProfit": "0.00000000",  // 持仓未实现盈亏
            "positionInitialMargin": "0",      //持仓所需起始保证金(基于最新标记价格)
            "openOrderInitialMargin": "0",     // 当前挂单所需起始保证金(基于最新标记价格)
            "leverage": "100",      // 杠杆倍率
            "entryPrice": "0.00000",    // 持仓成本价
            "maxNotional": "250000",    // 当前杠杆下用户可用的最大名义价值
            "bidNotional": "0",  // 买单净值,忽略
            "askNotional": "0",  // 卖单净值,忽略
            "positionSide": "BOTH",     // 持仓方向
            "positionAmt": "0",         //  持仓数量
            "updateTime": 0           // 更新时间
            "breakEvenPrice": "0.0"
        }
    ]
}

GET /papi/v1/um/account (HMAC SHA256)

现有UM账户资产和仓位信息

权重: 5

参数:

名称 类型 是否必需 描述
recvWindow LONG NO
timestamp LONG YES

获取CM账户信息 (USER_DATA)

响应:

{
    "assets": [
        {
            "asset": "BTC",  // 资产
            "crossWalletBalance": "0.00241969",  // 全仓账户余额
            "crossUnPnl": "0.00000000",  // 全仓持仓未实现盈亏
            "maintMargin": "0.00000000",    // 维持保证金
            "initialMargin": "0.00000000",  // 当前所需起始保证金
            "positionInitialMargin": "0.00000000",  // 持仓所需起始保证金(基于最新标记价格)
            "openOrderInitialMargin": "0.00000000",  // 当前挂单所需起始保证金(基于最新标记价格)e
            "updateTime": 1625474304765 // 更新时间
         }
     ],
     "positions": [
         {
            "symbol": "BTCUSD_201225",
            "positionAmt":"0",  
            "initialMargin": "0",
            "maintMargin": "0",
            "unrealizedProfit": "0.00000000",
            "positionInitialMargin": "0",
            "openOrderInitialMargin": "0",
            "leverage": "125",
            "positionSide": "BOTH",
            "entryPrice": "0.0",
            "maxQty": "50",  
            "updateTime": 0
            "breakEvenPrice": "0.0"
        }
     ]
 }

GET /papi/v1/cm/account (HMAC SHA256)

现有CM账户资产和仓位信息

权重: 5

参数:

名称 类型 是否必需 描述
recvWindow LONG NO
timestamp LONG YES

更改自动清还合约负余额模式(TRADE)

响应:

{
    "msg": "success"
}

POST /papi/v1/repay-futures-switch (HMAC SHA256)

更改自动支付合约负余额模式 (HMAC SHA256)

权重(IP):

750

参数:

名称 类型 是否必需 描述
autoRepay STRING YES 默认为true; false代表关闭自动清还合约负余额
recvWindow LONG NO
timestamp LONG YES

查询自动清还合约负余额模式(USER_DATA)

响应:

{
    "autoRepay": true  //  `true`代表自动清还合约负余额; `false`代表关闭自动清还合约负余额
}

GET /papi/v1/repay-futures-switch (HMAC SHA256)

查询自动清还合约负余额模式

权重(IP):

30

参数:

名称 类型 是否必需 描述
recvWindow LONG NO
timestamp LONG YES

清还合约负余额(USER_DATA)

响应:

{
    "msg": "success"
}

POST /papi/v1/repay-futures-negative-balance (HMAC SHA256)

清还合约负余额

权重(IP):

750

参数:

名称 类型 是否必需 描述
recvWindow LONG NO
timestamp LONG YES

UM持仓ADL队列估算 (USER_DATA)

响应:

[
    {
        "symbol": "ETHUSDT", 
        "adlQuantile": 
            {
                // 对于全仓状态下的双向持仓模式的交易对,会返回 "LONG", "SHORT" 和 "HEDGE", 其中"HEDGE"的存在仅作为标记;如果多空均有持仓的情况下,"LONG"和"SHORT"应返回共同计算后相同的队列分数。
                "LONG": 3,  
                "SHORT": 3, 
                "HEDGE": 0   // HEDGE 仅作为指示出现,请忽略数值
            }
        },
    {
        "symbol": "BTCUSDT", 
        "adlQuantile": 
            {
                // 对于单向持仓模式或者是逐仓状态下的双向持仓模式的交易对,会返回 "LONG", "SHORT" 和 "BOTH" 分别表示不同持仓方向上持仓的adl队列分数
                "LONG": 1,  // 双开模式下多头持仓的ADL队列估算分
                "SHORT": 2,     // 双开模式下空头持仓的ADL队列估算分
                "BOTH": 0       // 单开模式下持仓的ADL队列估算分
            }
    }
 ]

GET /papi/v1/um/adlQuantile

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

CM持仓ADL队列估算 (USER_DATA)

响应:

[
    {
        "symbol": "BTCUSD_201225", 
        "adlQuantile": 
            {
                // 对于全仓状态下的双向持仓模式的交易对,会返回 "LONG", "SHORT" 和 "HEDGE", 其中"HEDGE"的存在仅作为标记;如果多空均有持仓的情况下,"LONG"和"SHORT"应返回共同计算后相同的队列分数。
                "LONG": 3,  
                "SHORT": 3, 
                "HEDGE": 0   // HEDGE 仅作为指示出现,请忽略数值
            }
    },
  {
    "symbol": "BTCUSD_201225", 
    "adlQuantile": 
      {
        // 对于单向持仓模式或者是逐仓状态下的双向持仓模式的交易对,会返回 "LONG", "SHORT" 和 "BOTH" 分别表示不同持仓方向上持仓的adl队列分数
        "LONG": 1,  // 双开模式下多头持仓的ADL队列估算分
        "SHORT": 2,     // 双开模式下空头持仓的ADL队列估算分
        "BOTH": 0       // 单开模式下持仓的ADL队列估算分
      }
  }
]

GET /papi/v1/cm/adlQuantile

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

Websocket 账户信息推送

生成listenKey (USER_STREAM)

响应:

{
  "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
}

POST /papi/v1/listenKey

创建一个新的user data stream,返回值为一个listenKey,即websocket订阅的stream名称。如果该帐户具有有效的listenKey,则将返回该listenKey并将其有效期延长60分钟。

权重: 1

延长listenKey有效期 (USER_STREAM)

响应:

{}

PUT /papi/v1/listenKey

有效期延长至本次调用后60分钟

权重: 1

参数:

None

关闭listenKey (USER_STREAM)

响应:

{}

DELETE /papi/v1/listenKey

关闭某账户数据流

权重: 1

参数:

None

listenKey 过期推送

Payload:

{
    'e': 'listenKeyExpired',      // 事件类型
    'E': 1576653824250              // 事件时间
}

当前连接使用的有效listenKey过期时,user data stream 将会推送此事件。

注意:

合约Balance和Position更新推送

Payload:

{
  "e": "ACCOUNT_UPDATE",                // Event Type
  "fs": "UM",                           // Event business unit. 'UM' for USDS-M futures and 'CM' for COIN-M futures
  "E": 1564745798939,                   // Event Time
  "T": 1564745798938 ,                  // Transaction
  "i":"",                           // Account Alias, ignore for UM
  "a":                                  // Update Data
    {
      "m":"ORDER",                      // Event reason type
      "B":[                             // Balances
        {
          "a":"USDT",                   // Asset
          "wb":"122624.12345678",       // Wallet Balance
          "cw":"100.12345678",          // Cross Wallet Balance
          "bc":"50.12345678"            // Balance Change except PnL and Commission
        },
        {
          "a":"BUSD",          
          "wb":"1.00000000",
          "cw":"0.00000000",        
          "bc":"-49.12345678"
        }
      ],
      "P":[
        {
          "s":"BTCUSDT",            // Symbol
          "pa":"0",                 // Position Amount
          "ep":"0.00000",            // Entry Price
          "cr":"200",               // (Pre-fee) Accumulated Realized
          "up":"0",                     // Unrealized PnL
          "ps":"BOTH",                   // Position Side
          "bep":"0.00000"            // breakeven price},
        {
            "s":"BTCUSDT",
            "pa":"20",
            "ep":"6563.66500",
            "cr":"0",
            "up":"2850.21200",
            "ps":"LONG",
            "bep":"0.00000"            // breakeven price
         }
      ]
    }
}

合约订单/交易更新推送

Payload:

{

  "e":"ORDER_TRADE_UPDATE",         // 事件类型
  "E":1568879465651,                // 事件时间
  "T":1568879465650,                // 撮合时间
  "fs": "UM",                   // 事件业务线:'UM'代表U本位合约,'CM'代表币本位合约
  "o":{                             
    "s":"BTCUSDT",                  // 交易对
    "c":"TEST",                     // 客户端自定订单ID
      // 特殊的自定义订单ID:
      // "autoclose-"开头的字符串: 系统强平订单
      // "adl_autoclose": ADL自动减仓订单
      // "settlement_autoclose-": 下架或交割的结算订单
    "S":"SELL",                     // 订单方向
    "o":"TRAILING_STOP_MARKET", // 订单类型
    "f":"GTC",                      // 有效方式
    "q":"0.001",                    // 订单原始数量
    "p":"0",                        // 订单原始价格
    "ap":"0",                       // 订单平均价格
    "sp":"7103.04",             // 忽略
    "x":"NEW",                      // 本次事件的具体执行类型
    "X":"NEW",                      // 订单的当前状态
    "i":8886774,                    // 订单ID
    "l":"0",                        // 订单末次成交量
    "z":"0",                        // 订单累计已成交量
    "L":"0",                        // 订单末次成交价格
    "N": "USDT",           // 手续费资产类型
    "n": "0",              // 手续费数量
    "T":1568879465650,       // 成交时间
    "t":0,                             // 成交ID
    "b":"0",                           // 买单净值
    "a":"9.91",                      // 卖单净值
    "m": false,                    // 该成交是作为挂单成交吗?
    "R":false   ,                    // 是否是只减仓单
    "ps":"LONG"                      // 持仓方向
    "rp":"0",                        // 该交易实现盈亏   
    "st":"C_TAKE_PROFIT",  // 策略单类型,仅在条件订单触发后会推送此字段
    "si":12893,                    // 该交易实现盈亏,仅在条件订单触发后会推送此字段 
    "V":"EXPIRE_TAKER",         // STP mode
    "gtd":0    
  }
}

当有新订单创建、订单有新成交或者新的状态变化时会推送此类事件 事件类型统一为 ORDER_TRADE_UPDATE

订单方向

订单类型

本次事件的具体执行类型

订单状态

有效方式:

强平和ADL:

合约条件订单/交易更新推送

Payload:

{
    "e": "CONDITIONAL_ORDER_TRADE_UPDATE", // 时间类型
    "T": 1669262908216,                    // 交易时间
    "E": 1669262908218,                    // 事件时间
    "fs": "UM",                            // 业务线
    "so": {             
            "s": "BTCUSDT",                // 交易对
            "c":"TEST",                    // 用户自定义策略Id
            "si": 176057039,               // 策略Id
            "S":"SELL",                    // 方向
            "st": "TRAILING_STOP_MARKET",  // 策略类型
            "f":"GTC",                     // 生效时间
            "q":"0.001",                   // 数量
            "p":"0",                       // 价格
            "sp":"7103.04",                // TPSL触发价
            "os":"NEW",                    // 策略订单状态
            "T":1568879465650,             // 订单
            "ut": 1669262908216,           // Order update Time 
            "R":false,                     // 仅减仓
            "wt":"MARK_PRICE",             // TPSL触发价格类型
            "ps":"LONG",                   // 仓位方向
            "cp":false,                    // 是否为触发平仓单; 仅在条件订单情况下会推送此字段
            "AP":"7476.89",                // 追踪止损激活价格, 仅在追踪止损单时会推送此字段
            "cr":"5.0",                    // 追踪止损回调比例, 仅在追踪止损单时会推送此字段
            "i":8886774,                   // 订单Id
            "V":"EXPIRE_TAKER",         // STP mode
            "gtd":0
        }
}

当有新订单创建、订单有新成交或者新的状态变化时会推送此类事件 事件类型统一为 CONDITIONAL_ORDER_TRADE_UPDATE

订单方向

条件订单类型

本次事件的具体执行类型

订单状态

有效方式:

追加保证金通知

Payload:

{
    "e":"riskLevelChange",  // 事件类型  
    "E":1587727187525,      // 事件时间
    "u":"1.99999999",       // uniMMR
    "s":"MARGIN_CALL",      //MARGIN_CALL, SUPPLY_MARGIN, REDUCE_ONLY, FORCE_LIQUIDATION 
    "eq":"30.23416728",     // 账号美元保证金
    "ae":"30.23416728",     // actual equity without collateral rate in USD value
    "m":"15.11708371"       // 美元计价维持保证金
}  

合约杠杆倍数等账户配置 更新推送

Payload:

{
    "e":"ACCOUNT_CONFIG_UPDATE",       // 事件类型    
    "fs": "UM",                       // 事件业务线
    "E":1611646737479,                 // 事件时间
    "T":1611646737476,                 // 撮合时间
    "ac":{                             
    "s":"BTCUSD_PERP",                     // 交易对
    "l":25                             // 杠杆倍数
    }
}

当账户配置发生变化时会推送此类事件类型统一为ACCOUNT_CONFIG_UPDATE 当交易对杠杆倍数发生变化时推送消息体会包含对象ac表示交易对账户配置,其中s代表具体的交易对,l代表杠杆倍数 当用户联合保证金状态发生变化时推送消息体会包含对象ai表示用户账户配置,其中j代表用户联合保证金状态

杠杆账户全仓挂单占用事件

Payload:

{
    "e": "openOrderLoss",      //Event Type
    "E": 1678710578788,        // Event Time
    "O": [{                    // Update Data
        "a": "BUSD",
        "o": "-0.1232313"       // Amount
    }, {
        "a": "BNB",
        "o": "-12.1232313"
    }]
}

杠杆账户负债更新

Payload:

{
  "e": "liabilityChange",         //Event Type
  "E": 1573200697110,           //Event Time
  "a": "BTC",                   //Asset
  "t": BORROW                  //Type
  "tx": 1352286576452864727,     //Transaction ID
  "p": "1.03453430",             //Principal
  "i": "0",             //Interest
  "l": "1.03476851"              //Total Liability
}

杠杆账户更新事件

Payload:

{
  "e": "outboundAccountPosition", // 事件类型
  "E": 1564034571105,             // 事件时间
  "u": 1564034571073,             // 账户末次更新时间戳
  "U": 1027053479517,             // 时间更新ID
  "B": [                          // 余额
    {
      "a": "ETH",                 // 资产名称
      "f": "10000.000000",        // 可用余额
      "l": "0.000000"             // 冻结余额
    }
  ]
}

每当帐户余额发生更改时,都会发送一个事件outboundAccountPosition,其中包含可能由生成余额变动的事件而变动的资产。

杠杆账户余额更新事件

Payload:

{
  "e": "balanceUpdate",         //时间类型
  "E": 1573200697110,           //事件时间
  "a": "BTC",                   //资产
  "d": "100.00000000",          //变动数量
  "U": 1027053479517            //事件更新ID
  "T": 1573200697068            //Time
}

杠杆账户订单事件

Payload:

{
  "e": "executionReport",        // 事件类型
  "E": 1499405658658,            // 事件时间
  "s": "ETHBTC",                 // 交易对
  "c": "mUvoqJxFIILMdfAW5iGSOW", // clientOrderId
  "S": "BUY",                    // 订单方向
  "o": "LIMIT",                  // 订单类型
  "f": "GTC",                    // 有效方式
  "q": "1.00000000",             // 订单原始数量
  "p": "0.10264410",             // 订单原始价格
  "P": "0.00000000",             // 止盈止损单触发价格
  "F": "0.00000000",             // 冰山订单数量
  "g": -1,                       // OCO订单 OrderListId
  "C": "",                       // 原始订单自定义ID(原始订单,指撤单操作的对象。撤单本身被视为另一个订单)
  "x": "NEW",                    // 本次事件的具体执行类型
  "X": "NEW",                    // 订单的当前状态
  "r": "NONE",                   // 订单被拒绝的原因
  "i": 4293153,                  // orderId
  "l": "0.00000000",             // 订单末次成交量
  "z": "0.00000000",             // 订单累计已成交量
  "L": "0.00000000",             // 订单末次成交价格
  "n": "0",                      // 手续费数量
  "N": null,                     // 手续费资产类别
  "T": 1499405658657,            // 成交时间
  "t": -1,                       // 成交ID
  "v": 3,                        // 被阻止撮合交易的ID; 这仅在订单因 STP 触发而过期时可见
  "I": 8641984,                  // 请忽略
  "w": true,                     // 订单是否在订单簿上?
  "m": false,                    // 该成交是作为挂单成交吗?
  "M": false,                    // 请忽略
  "O": 1499405658657,            // 订单创建时间
  "Z": "0.00000000",             // 订单累计已成交金额
  "Y": "0.00000000",             // 订单末次成交金额
  "Q": "0.00000000",             // Quote Order Quantity
  "W": 1499405658657,            // Working Time; 订单被添加到 order book 的时间
  "V": "NONE"                    // SelfTradePreventionMode
}

杠杆账户订单由executionReport事件推出

执行类型:

错误代码

error JSON payload:

{
  "code":-1121,
  "msg":"Invalid symbol."
}

错误由两部分组成:错误代码和消息。 代码是通用的,但是消息可能会有所不同。

10xx - 常规服务器或网络问题

-1000 UNKNOWN

-1001 DISCONNECTED

-1002 UNAUTHORIZED

-1003 TOO_MANY_REQUESTS

-1004 DUPLICATE_IP

-1005 NO_SUCH_IP

-1006 UNEXPECTED_RESP

-1007 TIMEOUT

-1014 UNKNOWN_ORDER_COMPOSITION

-1015 TOO_MANY_ORDERS

-1016 SERVICE_SHUTTING_DOWN

-1020 UNSUPPORTED_OPERATION

-1021 INVALID_TIMESTAMP

-1022 INVALID_SIGNATURE

-1023 START_TIME_GREATER_THAN_END_TIME

11xx - Request issues

-1100 ILLEGAL_CHARS

-1101 TOO_MANY_参数

-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED

-1103 UNKNOWN_PARAM

-1104 UNREAD_参数

-1105 PARAM_EMPTY

-1106 PARAM_NOT_REQUIRED

-1111 BAD_PRECISION

-1112 NO_DEPTH

-1114 TIF_NOT_REQUIRED

-1115 INVALID_TIF

-1116 INVALID_ORDER_TYPE

-1117 INVALID_SIDE

-1118 EMPTY_NEW_CL_ORD_ID

-1119 EMPTY_ORG_CL_ORD_ID

-1120 BAD_INTERVAL

-1121 BAD_SYMBOL

-1125 INVALID_LISTEN_KEY

-1127 MORE_THAN_XX_HOURS

-1128 OPTIONAL_PARAMS_BAD_COMBO

-1130 INVALID_PARAMETER

-1136 INVALID_NEW_ORDER_RESP_TYPE

20xx - Processing Issues

-2010 NEW_ORDER_REJECTED

-2011 CANCEL_REJECTED

-2013 NO_SUCH_ORDER

-2014 BAD_API_KEY_FMT

-2015 REJECTED_MBX_KEY

-2016 NO_TRADING_WINDOW

-2018 BALANCE_NOT_SUFFICIENT

-2019 MARGIN_NOT_SUFFICIEN

-2020 UNABLE_TO_FILL

-2021 ORDER_WOULD_IMMEDIATELY_TRIGGER

-2022 REDUCE_ONLY_REJECT

-2023 USER_IN_LIQUIDATION

-2024 POSITION_NOT_SUFFICIENT

-2025 MAX_OPEN_ORDER_EXCEEDED

-2026 REDUCE_ONLY_ORDER_TYPE_NOT_SUPPORTED

-2027 MAX_LEVERAGE_RATIO

-2028 MIN_LEVERAGE_RATIO

40xx - Filters and other Issues

-4000 INVALID_ORDER_STATUS

-4001 PRICE_LESS_THAN_ZERO

-4002 PRICE_GREATER_THAN_MAX_PRICE

-4003 QTY_LESS_THAN_ZERO

-4004 QTY_LESS_THAN_MIN_QTY

-4005 QTY_GREATER_THAN_MAX_QTY

-4006 STOP_PRICE_LESS_THAN_ZERO

-4007 STOP_PRICE_GREATER_THAN_MAX_PRICE

-4008 TICK_SIZE_LESS_THAN_ZERO

-4009 MAX_PRICE_LESS_THAN_MIN_PRICE

-4010 MAX_QTY_LESS_THAN_MIN_QTY

-4011 STEP_SIZE_LESS_THAN_ZERO

-4012 MAX_NUM_ORDERS_LESS_THAN_ZERO

-4013 PRICE_LESS_THAN_MIN_PRICE

-4014 PRICE_NOT_INCREASED_BY_TICK_SIZE

-4015 INVALID_CL_ORD_ID_LEN

-4016 PRICE_HIGHTER_THAN_MULTIPLIER_UP

-4017 MULTIPLIER_UP_LESS_THAN_ZERO

-4018 MULTIPLIER_DOWN_LESS_THAN_ZERO

-4019 COMPOSITE_SCALE_OVERFLOW

-4020 TARGET_STRATEGY_INVALID

-4021 INVALID_DEPTH_LIMIT

-4022 WRONG_MARKET_STATUS

-4023 QTY_NOT_INCREASED_BY_STEP_SIZE

-4024 PRICE_LOWER_THAN_MULTIPLIER_DOWN

-4025 MULTIPLIER_DECIMAL_LESS_THAN_ZERO

-4026 COMMISSION_INVALID

-4027 INVALID_ACCOUNT_TYPE

-4028 INVALID_LEVERAGE

-4029 INVALID_TICK_SIZE_PRECISION

-4030 INVALID_STEP_SIZE_PRECISION

-4031 INVALID_WORKING_TYPE

-4032 EXCEED_MAX_CANCEL_ORDER_SIZE

-4033 INSURANCE_ACCOUNT_NOT_FOUND

-4044 INVALID_BALANCE_TYPE

-4045 MAX_STOP_ORDER_EXCEEDED

-4046 NO_NEED_TO_CHANGE_MARGIN_TYPE

-4047 THERE_EXISTS_OPEN_ORDERS

-4048 THERE_EXISTS_QUANTITY

-4049 ADD_ISOLATED_MARGIN_REJECT

-4050 CROSS_BALANCE_INSUFFICIENT

-4051 ISOLATED_BALANCE_INSUFFICIENT

-4052 NO_NEED_TO_CHANGE_AUTO_ADD_MARGIN

-4053 AUTO_ADD_CROSSED_MARGIN_REJECT

-4054 ADD_ISOLATED_MARGIN_NO_POSITION_REJECT

-4055 AMOUNT_MUST_BE_POSITIVE

-4056 INVALID_API_KEY_TYPE

-4057 INVALID_RSA_PUBLIC_KEY

-4058 MAX_PRICE_TOO_LARGE

-4059 NO_NEED_TO_CHANGE_POSITION_SIDE

-4060 INVALID_POSITION_SIDE

-4061 POSITION_SIDE_NOT_MATCH

-4062 REDUCE_ONLY_CONFLICT

-4063 INVALID_OPTIONS_REQUEST_TYPE

-4064 INVALID_OPTIONS_TIME_FRAME

-4065 INVALID_OPTIONS_AMOUNT

-4066 INVALID_OPTIONS_EVENT_TYPE

-4067 POSITION_SIDE_CHANGE_EXISTS_OPEN_ORDERS

-4068 POSITION_SIDE_CHANGE_EXISTS_QUANTITY

-4069 INVALID_OPTIONS_PREMIUM_FEE

-4070 INVALID_CL_OPTIONS_ID_LEN

-4071 INVALID_OPTIONS_DIRECTION

-4072 OPTIONS_PREMIUM_NOT_UPDATE

-4073 OPTIONS_PREMIUM_INPUT_LESS_THAN_ZERO

-4074 OPTIONS_AMOUNT_BIGGER_THAN_UPPER

-4075 OPTIONS_PREMIUM_OUTPUT_ZERO

-4076 OPTIONS_PREMIUM_TOO_DIFF

-4077 OPTIONS_PREMIUM_REACH_LIMIT

-4078 OPTIONS_COMMON_ERROR

-4079 INVALID_OPTIONS_ID

-4080 OPTIONS_USER_NOT_FOUND

-4081 OPTIONS_NOT_FOUND

-4082 INVALID_BATCH_PLACE_ORDER_SIZE

-4083 PLACE_BATCH_ORDERS_FAIL

-4084 UPCOMING_METHOD

-4085 INVALID_NOTIONAL_LIMIT_COEF

-4086 INVALID_PRICE_SPREAD_THRESHOLD

-4087 REDUCE_ONLY_ORDER_PERMISSION

-4088 NO_PLACE_ORDER_PERMISSION

-4104 INVALID_CONTRACT_TYPE

-4114 INVALID_CLIENT_TRAN_ID_LEN

-4115 DUPLICATED_CLIENT_TRAN_ID

-4118 REDUCE_ONLY_MARGIN_CHECK_FAILED

-4131 MARKET_ORDER_REJECT

-4135 INVALID_ACTIVATION_PRICE

-4137 QUANTITY_EXISTS_WITH_CLOSE_POSITION

-4138 REDUCE_ONLY_MUST_BE_TRUE

-4139 ORDER_TYPE_CANNOT_BE_MKT

-4140 INVALID_OPENING_POSITION_STATUS

-4141 SYMBOL_ALREADY_CLOSED

-4142 STRATEGY_INVALID_TRIGGER_PRICE

-4144 INVALID_PAIR

-4161 ISOLATED_LEVERAGE_REJECT_WITH_POSITION

-4164 MIN_NOTIONAL

-4165 INVALID_TIME_INTERVAL

-4183 PRICE_HIGHTER_THAN_STOP_MULTIPLIER_UP

-4184 PRICE_LOWER_THAN_STOP_MULTIPLIER_DOWN

50xx - Order Execution Issues

-5021 FOK_ORDER_REJECT

-5022 GTX_ORDER_REJECT

-5028 ME_RECVWINDOW_REJECT