Navbar
简体中文

更新日志

2020-11-27

为了优化性能,除了当前的api.binance.com,新加了一些API的集群。如果访问api.binance.com有性能问题,也可以尝试访问:


2020-11-16


2020-11-13


2020-11-10


2020-11-09


2020-11-03


2020-10-14


2020-10-10


2020-09-30


2020-09-28


2020-09-23


2020-09-16


2020-09-09

用户数据 STREAM


2020-09-03


2020-09-01


2020-08-27


2020-08-26


2020-07-28

逐仓杠杆相关接口


2020-07-20


2020-07-17


2020-07-13


2020-06-28


2020-05-06


2020-05-03


2020-05-01


2020-04-25

现货 API

用户数据 STREAM


2020-04-23

WEB SOCKET 连接限制


2020-04-16


2020-04-02


2020-03-24


2020-03-13


2020-02-05


2020-01-15


2019-12-25

2019-12-18


2019-11-30


2019-11-28


2019-11-22


2019-11-19


2019-11-13

Rest API

    {
      "code": -1128,
      "msg": "Combination of optional parameters invalid. Recommendation: 'stopLimitTimeInForce' should also be sent."
    }

v1 接口将被弃用:

2020年一季度末,以下接口将被移除。目前文档已经将这些接口更新为v3版本。

以下接口将不会移植到v3版本,请使用新接口予以替换

旧的 V1 接口 新的 V3 接口
GET api/v1/ticker/allPrices GET api/v3/ticker/price
GET api/v1/ticker/allBookTickers GET api/v3/ticker/bookTicker

USER DATA STREAM

WEB SOCKET STREAM


2019-11-08


2019-11-04


2019-10-29


2019-10-14


2019-10-11


2019-09-09


2019-09-03


2019-08-16


2019-09-15

Rest API

用户数据流

新的错误码

新的-2011错误内容


2019-03-12

Rest API

Websocket 流

系统改进


2018-11-13

Rest API

平均价格的计算规则解释:

  1. 前5分钟的所有交易/数量交易的(数量*价格)。

  2. 如果最近5分钟内没有交易,则以5分钟窗口外发生的第一笔交易为准。     例如,如果最后一次交易是在20分钟前,则该交易的价格为5分钟的平均值。

  3. 如果代码上没有交易,则没有平均价格,因此无法下达市价单。对于在MIN_NOTIONAL过滤器上启用了applyToMarket的新交易对,除非有至少一笔交易,才能下达市价单。

  4. 当前的平均价格可以在这里查看:https://api.binance.com/api/v3/avgPrice?symbol=<symbol> 例如: https://api.binance.com/api/v3/avgPrice?symbol=BNBUSDT

用户数据流


2018-07-18

Rest API

用户数据流


2018-01-23


2018-01-20


2018-01-14

介绍

API Key 设置

API Key 权限设置

账户

现货账户

新注册的币安账号都会有一个现货(SPOT)账号。

杠杆账户

为了开设杠杆(MARGIN)账户, 可以参考Binance杠杆交易账户设置指南

现货测试网

用户可以使用现货的测试网来体验SPOT交易. 现在只能通过API来交易。

更多信息请参考现货测试网

Postman Collections

现在你可以通过Postman collection来快速体验、使用API接口。
如果想了解更多如果使用Postman,请访问Binance API Postman

联系我们

基本信息

API 基本信息

HTTP 返回代码

错误代码

API 与 SAPI 的错误代码返回形式如下:

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

WAPI 的错误代码返回形式如下:

{
  "success": false,
  "msg": "Invalid symbol."
}

接口的基本信息


访问限制

访问限制基本信息

IP 访问限制

下单频率限制

WEB SOCKET 连接限制


接口鉴权类型

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

SIGNED (TRADE、USER_DATA AND MARGIN) Endpoint security

时间同步安全

逻辑伪代码如下:

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

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

POST /api/v3/order 的示例

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

Key Value
apiKey vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A
secretKey NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j
参数 取值
symbol LTCBTC
side BUY
type LIMIT
timeInForce GTC
quantity 1
price 0.1
recvWindow 5000
timestamp 1499827319559

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

Example 1

HMAC SHA256 signature:

    $ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
    (stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71

curl command:

    (HMAC SHA256)
    $ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order' -d 'symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'

symbol=LTCBTC
&side=BUY
&type=LIMIT
&timeInForce=GTC
&quantity=1
&price=0.1
&recvWindow=5000
&timestamp=1499827319559

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

Example 2

HMAC SHA256 signature:

    $ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
    (stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71

curl command:

    (HMAC SHA256)
   $ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'

symbol=LTCBTC
&side=BUY
&type=LIMIT
&timeInForce=GTC
&quantity=1
&price=0.1
&recvWindow=5000
&timestamp=1499827319559

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

Example 3

HMAC SHA256 signature:

   $ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
    (stdin)= 0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77

curl command:

    (HMAC SHA256)
    $ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559&signature=0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77'

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

quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559

请注意,签名与示例3不同。 "GTC"和"quantity = 1"之间没有&。

POST的签名接口示例/wapi/v3/withdraw.html

这是一个分步示例,说明如何从 使用echoopensslcurl的Linux命令行。

Key Value
apiKey vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A
secretKey NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j
参数 取值
asset ETH
address 0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b
addressTag 1 (Secondary address identifier for coins like XRP,XMR etc.)
amount 1
recvWindow 5000
name addressName (Description of the address)
timestamp 1508396497000
signature 157fb937ec848b5f802daa4d9f62bea08becbf4f311203bda2bd34cd9853e320

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

HMAC SHA256 signature:

    $ echo -n "asset=ETH&address=0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b&amount=1&recvWindow=5000&name=test&timestamp=1510903211000" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
    (stdin)= 157fb937ec848b5f802daa4d9f62bea08becbf4f311203bda2bd34cd9853e320

curl command:

    (HMAC SHA256)
    $ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/wapi/v3/withdraw.html?asset=ETH&address=0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b&amount=1&recvWindow=5000&name=test&timestamp=1510903211000&signature=157fb937ec848b5f802daa4d9f62bea08becbf4f311203bda2bd34cd9853e320'

asset=ETH
&address=0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b &amount=1&recvWindow=5000&name=test&timestamp=1510903211000

注意,对于wapi,参数必须以查询字符串的形式发送。


公开 API 参数

术语

这里的术语适用于全部文档,建议特别是新手熟读,也便于理解。

枚举定义

交易对状态 (状态):

交易对类型:

订单状态 (状态):

状态 描述
NEW 订单被交易引擎接受
PARTIALLY_FILLED 部分订单被成交
FILLED 订单完全成交
CANCELED 用户撤销了订单
PENDING_CANCEL 撤销中(目前并未使用)
REJECTED 订单没有被交易引擎接受,也没被处理
EXPIRED 订单被交易引擎取消, 比如
LIMIT FOK 订单没有成交
市价单没有完全成交
强平期间被取消的订单
交易所维护期间被取消的订单

OCO 状态 (状态类型集):

状态 描述
RESPONSE 当ListStatus响应失败的操作时使用。 (订单完成或取消订单)
EXEC_STARTED 当已经下单或者订单有更新时
ALL_DONE 当订单执行结束或者不在激活状态

OCO 订单状态 (订单状态集):

状态 描述
EXECUTING 当已经下单或者订单有更新时
ALL_DONE 当订单执行结束或者不在激活状态
REJECT 当订单状态响应失败(订单完成或取消订单)

指定订单的类型

订单类型 (orderTypes, type):

关于订单类型的类型,可以参考这里详细说明

订单返回类型:

订单方向 (方向):

有效方式 (timeInForce):

这里定义了订单多久能够变成失效

Status Description
GTC 成交为止
订单会一直有效,直到被成交或者取消。
IOC 无法立即成交的部分就撤销
订单在失效前会尽量多的成交。
FOK 无法全部立即成交就撤销
如果无法全部成交,订单会失效。

K线间隔:

m -> 分钟; h -> 小时; d -> 天; w -> 周; M -> 月

限制种类 (rateLimitType)

REQUEST_WEIGHT

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

ORDERS

    {
      "rateLimitType": "ORDERS",
      "interval": "SECOND",
      "intervalNum": 10,
      "limit": 100
    },
    {
      "rateLimitType": "ORDERS",
      "interval": "DAY",
      "intervalNum": 1,
      "limit": 200000
    }

RAW_REQUESTS

    {
      "rateLimitType": "RAW_REQUESTS",
      "interval": "MINUTE",
      "intervalNum": 5,
      "limit": 5000
    }

限制间隔 (interval)


过滤器

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

交易对过滤器

PRICE_FILTER 价格过滤器

/exchangeInfo 响应中的格式:

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

价格过滤器 用于检测订单中 price 参数的合法性。包含以下三个部分:

以上每一项均可为0,为0时代表这一项不再做限制。

逻辑伪代码如下:

PERCENT_PRICE 价格振幅过滤器

/exchangeInfo 响应中的格式:

  {
    "filterType": "PERCENT_PRICE",
    "multiplierUp": "5",
    "multiplierDown": "0.2",
    "avgPriceMins": 5
  }

PERCENT_PRICE过滤器基于先前交易的平均值来定义价格的有效范围。
avgPriceMins是计算平均价格的分钟数。 0表示使用最后的价格。

为了通过"价格百分比","价格"必须符合以下条件:

LOT_SIZE 订单尺寸

/exchangeInfo 响应中的格式:

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

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

逻辑伪代码如下:

MIN_NOTIONAL 最小名义价值(成交额)

/exchangeInfo 响应中的格式:

  {
    "filterType": "MIN_NOTIONAL",
    "minNotional": "0.00100000",
    "applyToMarket": true,
    "avgPriceMins": 5
  }

MIN_NOTIONAL过滤器定义了交易对订单所允许的最小名义价值(成交额)。 订单的名义价值是价格*数量。 如果是高级订单(比如止盈止损订单STOP_LOSS_LIMIT),名义价值会按照stopPrice * quantity来计算。 如果是冰山订单,名义价值会按照price * icebergQty来计算。 applyToMarket确定 MIN_NOTIONAL过滤器是否也将应用于MARKET订单。
由于MARKET订单没有价格,因此会在最后avgPriceMins分钟内使用平均价格。
avgPriceMins是计算平均价格的分钟数。 0表示使用最后的价格。

ICEBERG_PARTS 冰山订单拆分数

/exchangeInfo 响应中的格式:

  {
    "filterType": "ICEBERG_PARTS",
    "limit": 10
  }

ICEBERG_PARTS 代表冰山订单最多可以拆分成多少个小订单。
计算方法为 向上取整(qty / icebergQty)

MARKET_LOT_SIZE 市价订单尺寸

**/exchangeInfo 响应中的格式:*

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

MARKET_LOT_SIZE过滤器为交易对上的MARKET订单定义了数量(即拍卖中的"手数")规则。 共有3部分:

为了通过market lot sizequantity必须满足以下条件:

MAX_NUM_ORDERS 最多订单数

/exchangeInfo 响应中的格式:

  {
    "filterType": "MAX_NUM_ORDERS",
    "maxNumOrders": 25
  }

定义了某个交易对最多允许的挂单数量(不包括已关闭的订单)
普通订单与条件订单均计算在内

MAX_NUM_ALGO_ORDERS 最多条件单数

/exchangeInfo 响应中的格式:

  {
    "filterType": "MAX_NUM_ALGO_ORDERS",
    "maxNumAlgoOrders": 5
  }

MAX_NUM_ALGO_ORDERS过滤器定义允许账户在交易对上开设的"algo"订单的最大数量。
"Algo"订单是STOP_LOSSSTOP_LOSS_LIMITTAKE_PROFITTAKE_PROFIT_LIMIT止盈止损单。

MAX_NUM_ICEBERG_ORDERS 最多冰山单数

MAX_NUM_ICEBERG_ORDERS过滤器定义了允许在交易对上开设账户的ICEBERG订单的最大数量。
ICEBERG订单是icebergQty大于0的任何订单。.

/exchangeInfo 响应中的格式:

  {
    "filterType": "MAX_NUM_ICEBERG_ORDERS",
    "maxNumIcebergOrders": 5
  }

MAX_POSITION 过滤器

这个过滤器定义账户允许的基于base asset的最大仓位。一个用户的仓位可以定义为如下资产的总和: 1. base asset的可用余额 1. base asset的锁定余额 1. 所有处于open的买单的数量总和

如果用户的仓位大于最大的允许仓位,买单会被拒绝。

/exchangeInfo 响应中的格式:

{
  "filterType": "MAX_POSITION",
  "maxPosition": "10.00000000"
}

交易所级别过滤器

EXCHANGE_MAX_NUM_ORDERS 最多订单数

/exchangeInfo 响应中的格式:

  {
    "filterType": "EXCHANGE_MAX_NUM_ORDERS",
    "maxNumOrders": 1000
  }

MAX_NUM_ORDERS过滤器定义了允许在交易对上开设账户的最大订单数。
请注意,此过滤器同时计算"algo"订单和常规订单。

EXCHANGE_MAX_NUM_ALGO_ORDERS 交易最大ALGO订单数

/exchangeInfo 响应中的格式:

  {
    "filterType": "EXCHANGE_MAX_ALGO_ORDERS",
    "maxNumAlgoOrders": 200
  }

MAX_ALGO_ORDERS过滤器定义了允许在交易上开设账户的"algo"订单的最大数量。
"Algo"订单是STOP_LOSSSTOP_LOSS_LIMITTAKE_PROFITTAKE_PROFIT_LIMIT订单。


钱包接口

系统状态 (System)

响应

{ 
    "status": 0,              // 0: 正常,1:系统维护
    "msg": "normal"           // normal|system maintenance
}

GET /wapi/v3/systemStatus.html

获取系统状态。

获取所有币信息 (USER_DATA)

获取针对用户的所有(Binance支持充提操作的)币种信息。

响应

[
    {
        "coin": "BTC",
        "depositAllEnable": true,
        "free": "0.08074558",
        "freeze": "0.00000000",
        "ipoable": "0.00000000",
        "ipoing": "0.00000000",
        "isLegalMoney": false,
        "locked": "0.00000000",
        "name": "Bitcoin",
        "networkList": [
            {
                "addressRegex": "^(bnb1)[0-9a-z]{38}$",
                "coin": "BTC",
                "depositDesc": "Wallet Maintenance, Deposit Suspended", // 仅在充值关闭时返回
                "depositEnable": false,
                "isDefault": false,        
                "memoRegex": "^[0-9A-Za-z\\-_]{1,120}$",
                "minConfirm": 1,  // 上账所需的最小确认数
                "name": "BEP2",
                "network": "BNB",            
                "resetAddressStatus": false,
                "specialTips": "Both a MEMO and an Address are required to successfully deposit your BEP2-BTCB tokens to Binance.",
                "unLockConfirm": 0,  // 解锁需要的确认数 
                "withdrawDesc": "Wallet Maintenance, Withdrawal Suspended", // 仅在提现关闭时返回
                "withdrawEnable": false,
                "withdrawFee": "0.00000220",
                "withdrawMin": "0.00000440"
            },
            {
                "addressRegex": "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[0-9A-Za-z]{39,59}$",
                "coin": "BTC",
                "depositEnable": true,
                "insertTime": 1563532929000,
                "isDefault": true,
                "memoRegex": "",
                "minConfirm": 1,  // 上账所需的最小确认数
                "name": "BTC",
                "network": "BTC",
                "resetAddressStatus": false,
                "specialTips": "",
                "unLockConfirm": 0,  // 解锁需要的确认数 
                "updateTime": 1571014804000, 
                "withdrawEnable": true,
                "withdrawFee": "0.00050000",
                "withdrawIntegerMultiple": "0.00000001",
                "withdrawMin": "0.00100000"
            }
        ],
        "storage": "0.00000000",
        "trading": true,
        "withdrawAllEnable": true,
        "withdrawing": "0.00000000"
    }
]

GET /sapi/v1/capital/config/getall (HMAC SHA256)

权重: 1

参数:

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

查询每日资产快照 (USER_DATA)

响应

{
   "code":200, // 200表示返回正确,否则即为错误码
   "msg":"", // 与错误码对应的报错信息
   "snapshotVos":[
      {
         "data":{
            "balances":[
               {
                  "asset":"BTC",
                  "free":"0.09905021",
                  "locked":"0.00000000"
               },
               {
                  "asset":"USDT",
                  "free":"1.89109409",
                  "locked":"0.00000000"
               }
            ],
            "totalAssetOfBtc":"0.09942700"
         },
         "type":"spot",
         "updateTime":1576281599000
      }
   ]
}

{
   "code":200, // 200表示返回正确,否则即为错误码
   "msg":"", // 与错误码对应的报错信息
   "snapshotVos":[
      {
         "data":{
            "marginLevel":"2748.02909813",
            "totalAssetOfBtc":"0.00274803",
            "totalLiabilityOfBtc":"0.00000100",
            "totalNetAssetOfBtc":"0.00274750",
            "userAssets":[
               {
                  "asset":"XRP",
                  "borrowed":"0.00000000",
                  "free":"1.00000000",
                  "interest":"0.00000000",
                  "locked":"0.00000000",
                  "netAsset":"1.00000000"
               }
            ]
         },
         "type":"margin",
         "updateTime":1576281599000
      }
   ]
}

{
   "code":200, // 200表示返回正确,否则即为错误码
   "msg":"", // 与错误码对应的报错信息
   "snapshotVos":[
      {
         "data":{
            "assets":[
               {
                  "asset":"USDT",
                  "marginBalance":"118.99782335",
                  "walletBalance":"120.23811389"
               }
            ],
            "position":[
               {
                  "entryPrice":"7130.41000000",
                  "markPrice":"7257.66239673",
                  "positionAmt":"0.01000000",
                  "symbol":"BTCUSDT",
                  "unRealizedProfit":"1.24029054"
               }
            ]
         },
         "type":"futures",
         "updateTime":1576281599000
      }
   ]
}

GET /sapi/v1/accountSnapshot (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
type STRING YES "SPOT", "MARGIN", "FUTURES"
startTime LONG NO
endTime LONG NO
limit INT NO min 5, max 30, default 5
recvWindow LONG NO
timestamp LONG YES

关闭站内划转 (USER_DATA)

响应

{}

POST /sapi/v1/account/disableFastWithdrawSwitch (HMAC SHA256)

参数:

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

开启站内划转 (USER_DATA)

响应

{}

POST /sapi/v1/account/enableFastWithdrawSwitch (HMAC SHA256)

参数:

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

提币[SAPI]

响应

{
    "id":"7213fea8e94b4a5593d507237e5a555b"
}

POST /sapi/v1/capital/withdraw/apply (HMAC SHA256)

Submit a withdraw request.

权重: 1

参数:

名称 类型 是否必需 描述
coin STRING YES
withdrawOrderId STRING NO 自定义提币ID
network STRING NO 提币网络
address STRING YES 提币地址
addressTag STRING NO 某些币种例如 XRP,XMR 允许填写次级地址标签
amount DECIMAL YES 数量
transactionFeeFlag BOOLEAN NO 当站内转账时免手续费, true: 手续费归资金转入方; false: 手续费归资金转出方; . 默认 false.
name STRING NO 地址的备注,填写该参数后会加入该币种的提现地址簿。地址簿上限为20,超出后会造成提现失败。地址中的空格需要encode成%20
recvWindow LONG NO
timestamp LONG YES

提币

响应

{
    "msg": "success",
    "success": true,
    "id":"7213fea8e94b4a5593d507237e5a555b"
}

POST /wapi/v3/withdraw.html (HMAC SHA256)

提交提现请求。

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES
withdrawOrderId STRING NO 自定义提币ID
network STRING NO 提币网络
address STRING YES 提币地址
addressTag STRING NO 某些币种例如 XRP,XMR 允许填写次级地址标签
amount DECIMAL YES
transactionFeeFlag BOOLEAN NO 当站内转账时免手续费, true: 手续费归资金转入方; false: 手续费归资金转出方; . 默认 false.
name STRING NO 地址的备注,填写该参数后会加入该币种的提现地址簿。地址簿上限为20,超出后会造成提现失败。地址中的空格需要encode成%20
recvWindow LONG NO
timestamp LONG YES

获取充值历史(支持多网络) (USER_DATA)

响应

[
    {
        "amount":"0.00999800",
        "coin":"PAXG",
        "network":"ETH",
        "status":1,
        "address":"0x788cabe9236ce061e5a892e1a59395a81fc8d62c",
        "addressTag":"",
        "txId":"0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3",
        "insertTime":1599621997000,
        "transferType":0,
        "confirmTimes":"12/12"
    },
    {
        "amount":"0.50000000",
        "coin":"IOTA",
        "network":"IOTA",
        "status":1,
        "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW",
        "addressTag":"",
        "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999",
        "insertTime":1599620082000,
        "transferType":0,
        "confirmTimes":"1/1"
    }
]

GET /sapi/v1/capital/deposit/hisrec (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
coin STRING NO
status INT NO 0(0:pending,6: credited but cannot withdraw, 1:success)
startTime LONG NO 默认当前时间90天前的时间戳
endTime LONG NO 默认当前时间戳
offset INT NO default:0
limit INT NO
recvWindow LONG NO
timestamp LONG YES

获取充值历史 (USER_DATA)

响应

{
    "depositList": [
        {
            "insertTime": 1508198532000,   //币安系统记录该笔充值的时间
            "amount": 0.04670582,   //充值金额
            "asset": "ETH",   //充值资产
            "address": "0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b",   //充值地址
            "txId": "0xdf33b22bdb2b28b1f75ccd201a4a4m6e7g83jy5fc5d5a9d1340961598cfcb0a1",   //充值交易id
            "status": 1
        },
        {
            "insertTime": 1508298532000,
            "amount": 1000,
            "asset": "XMR",
            "address": "463tWEBn5XZJSxLU34r6g7h8jtxuNcDbjLSjkn3XAXHCbLrTTErJrBWYgHJQyrCwkNgYvyV3z8zctJLPCZy24jvb3NiTcTJ",
            "addressTag": "342341222",
            "txId": "b3c6219639c8ae3f9cf010cdc24fw7f7yt8j1e063f9b4bd1a05cb44c4b6e2509",
            "status": 1
        }
    ],
    "success": true
}

GET /wapi/v3/depositHistory.html (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO
status INT NO 0(0:充值进行中,1:充值已经成功)
startTime LONG NO 默认当前时间90天前的时间戳
endTime LONG NO 默认当前时间戳
recvWindow LONG NO
timestamp LONG YES

获取提币历史 (支持多网络) (USER_DATA)

响应

[
    {
        "address": "0x94df8b352de7f46f64b01d3666bf6e936e44ce60",
        "amount": "8.91000000",   // 提现转出金额
        "applyTime": "2019-10-12 11:12:02",  // UTC 时间
        "coin": "USDT",
        "id": "b6ae22b3aa844210a7041aee7589627c",  // 该笔提现在币安的id
        "withdrawOrderId": "WITHDRAWtest123", // 自定义ID, 如果没有则不返回该字段
        "network": "ETH",
        "transferType": 0 // 1: 站内转账, 0: 站外转账    
        "status": 6,
        "txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268"   // 提现交易id
    },
    {
        "address": "1FZdVHtiBqMrWdjPyRPULCUceZPJ2WLCsB",
        "amount": "0.00150000",
        "applyTime": "2019-09-24 12:43:45",
        "coin": "BTC",
        "id": "156ec387f49b41df8724fa744fa82719",
        "network": "BTC",
        "transferType": 0,  // 1: 站内转账, 0: 站外转账
        "status": 6,
        "txId": "60fd9007ebfddc753455f95fafa808c4302c836e4d1eebc5a132c36c1d8ac354"
    }
]

GET /sapi/v1/capital/withdraw/history (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
coin STRING NO
status INT NO 0(0:已发送确认Email,1:已被用户取消 2:等待确认 3:被拒绝 4:处理中 5:提现交易失败 6 提现完成)
offset INT NO
limit INT NO
startTime LONG NO 默认当前时间90天前的时间戳
endTime LONG NO 默认当前时间戳
recvWindow LONG NO
timestamp LONG YES

获取提币历史 (USER_DATA)

响应

{
    "withdrawList": [
        {
            "id":"7213fea8e94b4a5593d507237e5a555b",
            "withdrawOrderId": None,  
            "amount": 0.99,   
            "transactionFee": 0.01,   
            "address": "0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b",   
            "asset": "ETH",
            "txId": "0xdf33b22bdb2b28b1f75ccd201a4a4m6e7g83jy5fc5d5a9d1340961598cfcb0a1",
            "applyTime": 1508198532000,
            "status": 4
        },
        {
            "id":"7213fea8e94b4a5534ggsd237e5a555b",   //该笔提现在币安的id
            "withdrawOrderId": "withdrawtest",    // 该笔提现自定义id
            "amount": 999.9999,   //提现转出金额
            "transactionFee": 0.0001,   //提现手续费
            "address": "463tWEBn5XZJSxLU34r6g7h8jtxuNcDbjLSjkn3XAXHCbLrTTErJrBWYgHJQyrCwkNgYvyV3z8zctJLPCZy24jvb3NiTcTJ",   //提现目的地址
            "addressTag": "342341222",   //提现备注 只对某些币种存在
            "txId": "b3c6219639c8ae3f9cf010cdc24fw7f7yt8j1e063f9b4bd1a05cb44c4b6e2509",   //提现交易id
            "asset": "XMR",
            "applyTime": 1508198532000,
            "status": 4
        }
    ],
    "success": true
}

GET /wapi/v3/withdrawHistory.html (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO
status INT NO 0(0:已发送确认Email,1:已被用户取消 2:等待确认 3:被拒绝 4:处理中 5:提现交易失败 6 提现完成)
startTime LONG NO 默认当前时间90天前的时间戳
endTime LONG NO 默认当前时间戳
recvWindow LONG NO
timestamp LONG YES

获取充值地址 (支持多网络) (USER_DATA)

响应

{
    "address": "1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv",
    "coin": "BTC",
    "tag": "",
    "url": "https://btc.com/1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv"
}

GET /sapi/v1/capital/deposit/address (HMAC SHA256)

权重: 1

参数:

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

获取充值地址 (USER_DATA)

响应

{
    "address": "0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b",
    "success": true,
    "addressTag": "1231212",
    "asset": "BNB"
}

GET /wapi/v3/depositAddress.html (HMAC SHA256)

权重: 1

参数:

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

账户状态 (USER_DATA)

响应

{
    "msg": "Order failed:Low Order fill rate! Will be reactivated after 5 minutes.",    //msg中给出了账户状态,左边的例子表示由于成交率过低被暂停交易权限。
    "success": true,
    "objs": [
        "5"
    ]
}

GET /wapi/v3/accountStatus.html

获取账户状态详情。

权重: 1

参数:

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

账户API交易状态(USER_DATA)

响应

{
    "success": true,     // 查询结果
    "status": {          // 账户API交易状态详情
            "isLocked": false,   // API交易功能是否被锁
            "plannedRecoverTime": 0,  // API交易功能被锁情况下的预计恢复时间
            "triggerCondition": { 
                    "gcr": 150,  // Number of GTC orders
                    "ifer": 150, // Number of FOK/IOC orders
                    "ufr": 300   // Number of orders
            },
            "indicators": {  // The indicators updated every 30 seconds
                 "BTCUSDT": [  // The symbol
                    {
                    "i": "UFR",  // Unfilled Ratio (UFR)
                    "c": 20,     // Count of all orders
                    "v": 0.05,   // Current UFR value
                    "t": 0.995   // Trigger UFR value
                    },
                    {
                    "i": "IFER", // IOC/FOK Expiration Ratio (IFER)
                    "c": 20,     // Count of FOK/IOC orders
                    "v": 0.99,   // Current IFER value
                    "t": 0.99    // Trigger IFER value
                    },
                    {
                    "i": "GCR",  // GTC Cancellation Ratio (GCR)
                    "c": 20,     // Count of GTC orders
                    "v": 0.99,   // Current GCR value
                    "t": 0.99    // Trigger GCR value
                    }
                    ],
                    "ETHUSDT": [ 
                    {
                    "i": "UFR",
                    "c": 20,
                    "v": 0.05,
                    "t": 0.995
                    },
                    {
                    "i": "IFER",
                    "c": 20,
                    "v": 0.99,
                    "t": 0.99
                    },
                    {
                    "i": "GCR",
                    "c": 20,
                    "v": 0.99,
                    "t": 0.99
                    }
                    ]
            },
            "updateTime": 1547630471725   
    }
}

GET /wapi/v3/apiTradingStatus.html

获取 api 账户交易状态详情。

权重: 1

参数:

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

小额资产转换BNB历史 (USER_DATA)

响应

{
    "success": true, 
    "results": {
        "total": 2,   //共计发生过的转换笔数
        "rows": [
            {
                "transfered_total": "0.00132256",   //本次转换所得BNB
                "service_charge_total": "0.00002699",   //本次转换手续费(BNB)
                "tran_id": 4359321,
                "logs": [           //本次转换的细节
                    {
                        "tranId": 4359321,
                        "serviceChargeAmount": "0.000009",
                        "uid": "10000015",
                        "amount": "0.0009",
                        "operateTime": "2018-05-03 17:07:04",
                        "transferedAmount": "0.000441",
                        "fromAsset": "USDT"
                    },
                    {
                        "tranId": 4359321,
                        "serviceChargeAmount": "0.00001799",
                        "uid": "10000015",
                        "amount": "0.0009",
                        "operateTime": "2018-05-03 17:07:04",
                        "transferedAmount": "0.00088156",
                        "fromAsset": "ETH"
                    }
                ],
                "operate_time": "2018-05-03 17:07:04" //The time of this exchange.
            },
            {
                "transfered_total": "0.00058795",
                "service_charge_total": "0.000012",
                "tran_id": 4357015,
                "logs": [       
                    {
                        "tranId": 4357015,
                        "serviceChargeAmount": "0.00001",
                        "uid": "10000015",
                        "amount": "0.001",
                        "operateTime": "2018-05-02 13:52:24",
                        "transferedAmount": "0.00049",
                        "fromAsset": "USDT"
                    },
                    {
                        "tranId": 4357015,
                        "serviceChargeAmount": "0.000002",
                        "uid": "10000015",
                        "amount": "0.0001",
                        "operateTime": "2018-05-02 13:51:11",
                        "transferedAmount": "0.00009795",
                        "fromAsset": "ETH"
                    }
                ],
                "operate_time": "2018-05-02 13:51:11"
            }
        ]
    }
}

GET /wapi/v3/userAssetDribbletLog.html (HMAC SHA256)

权重: 1

参数:

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

小额资产转换 (USER_DATA)

响应

{
    "totalServiceCharge":"0.02102542",
    "totalTransfered":"1.05127099",
    "transferResult":[
        {
            "amount":"0.03000000",
            "fromAsset":"ETH",
            "operateTime":1563368549307,
            "serviceChargeAmount":"0.00500000",
            "tranId":2970932918,
            "transferedAmount":"0.25000000"
        },
        {
            "amount":"0.09000000",
            "fromAsset":"LTC",
            "operateTime":1563368549404,
            "serviceChargeAmount":"0.01548000",
            "tranId":2970932918,
            "transferedAmount":"0.77400000"
        },
        {
            "amount":"248.61878453",
            "fromAsset":"TRX",
            "operateTime":1563368549489,
            "serviceChargeAmount":"0.00054542",
            "tranId":2970932918,
            "transferedAmount":"0.02727099"
        }
    ]
}

POST /sapi/v1/asset/dust (HMAC SHA256)

把小额资产转换成 BNB.

权重: 1

参数:

名称 类型 是否必需 描述
asset ARRAY YES 正在转换的资产。 例如:asset = BTC&asset = USDT
recvWindow LONG NO
timestamp LONG YES

资产利息记录 (USER_DATA)

响应

{
    "rows":[
        {
            "amount":"10.00000000",
            "asset":"BHFT",
            "divTime":1563189166000,
            "enInfo":"BHFT distribution",
            "tranId":2968885920
        },
        {
            "amount":"10.00000000",
            "asset":"BHFT",
            "divTime":1563189165000,
            "enInfo":"BHFT distribution",
            "tranId":2968885920
        }
    ],
    "total":2
}

GET /sapi/v1/asset/assetDividend (HMAC SHA256)

获取资产利息记录。

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO
startTime LONG NO
endTime LONG NO
limit INT NO Default 20, max 500
recvWindow LONG NO
timestamp LONG YES

上架资产详情 (USER_DATA)

响应

{
    "success": true,
    "assetDetail": {
        "CTR": {
            "minWithdrawAmount": "70.00000000",   //最小提现数量
            "depositStatus": false,   //是否可以充值(只有所有网络都关闭充值才为false)
            "withdrawFee": 35,   // 提现手续费
            "withdrawStatus": true,    //是否开放提现(只有所有网络都关闭提币才为false)
            "depositTip": "Delisted, Deposit Suspended"   //暂停充值的原因(如果暂停才有这一项)
        },
        "SKY": {
            "minWithdrawAmount": "0.02000000",
            "depositStatus": true,
            "withdrawFee": 0.01,
            "withdrawStatus": true
        }   
    }
}

GET /wapi/v3/assetDetail.html (HMAC SHA256)

权重: 1

参数:

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

交易手续费率查询 (USER_DATA)

响应

{
    "tradeFee": [{
        "symbol": "ADABNB",
        "maker": 0.9000,
        "taker": 1.0000
    }, {
        "symbol": "BNBBTC",
        "maker": 0.3000,
        "taker": 0.3000
    }],
    "success": true
}

GET /wapi/v3/tradeFee.html (HMAC SHA256)

权重: 1

参数:

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

子母账户接口

查询子账户列表(适用主账户)

响应

{
    "success":true,
    "subAccounts":[
        {
            "email":"123@test.com",
            "status":"enabled",
            "activated":true,
            "mobile":"91605290",
            "gAuth":true,
            "createTime":1544433328000
        },
        {
            "email":"321@test.com",
            "status":"disabled",
            "activated":true,
            "mobile":"22501238",
            "gAuth":true,
            "createTime":1544433328000
        }
    ]
}

GET /wapi/v3/sub-account/list.html (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING NO 子账户邮箱 备注
status STRING NO 子账户状态: 启用或禁用
page INT NO 默认值: 1
limit INT NO 默认值: 500
recvWindow LONG NO
timestamp LONG YES

查询子账户现货资金划转历史(适用主账户)

响应

{
    "success":true,
    "transfers":[
        {
            "from":"aaa@test.com",
            "to":"bbb@test.com",
            "asset":"BTC",
            "qty":"1",
            "status": "SUCCESS",
            "tranId": 11415955596
            "time":1544433328000
        },
        {
            "from":"bbb@test.com",
            "to":"ccc@test.com",
            "asset":"ETH",
            "qty":"2",
            "status": "SUCCESS",
            "tranId": 11366865406
            "time":1544433328000
        }
    ]
}

GET /wapi/v3/sub-account/transfer/history.html (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
startTime LONG NO 默认返回100天内历史记录
endTime LONG NO 默认返回100天内历史记录
page INT NO 默认值: 1
limit INT NO 默认值: 500
recvWindow LONG NO
timestamp LONG YES

执行子账户现货资金划转(适用主账户)

响应

{
    "success":true,
    "txnId":"2966662589"
}

POST /wapi/v3/sub-account/transfer.html (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
fromEmail STRING YES 发送者邮箱 备注
toEmail STRING YES 接收者邮箱 备注
asset STRING YES
amount DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

查询子账户合约资金划转历史(适用主账户)

响应

{
    "success":true,
    "futuresType": 2,
    "transfers":[
        {
            "from":"aaa@test.com",
            "to":"bbb@test.com",
            "asset":"BTC",
            "qty":"1",
            "tranId":11897001102,
            "time":1544433328000
        },
        {
            "from":"bbb@test.com",
            "to":"ccc@test.com",
            "asset":"ETH",
            "qty":"2",
            "tranId":11631474902,
            "time":1544433328000
        }
    ]
}

GET /sapi/v1/sub-account/futures/internalTransfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
futuresType LONG YES 1:USDT合约,2: 币本位合约
startTime LONG NO 默认返回100天内历史记录
endTime LONG NO 默认返回100天内历史记录
page INT NO 默认值: 1
limit INT NO 默认值: 50, 最大值:500
recvWindow LONG NO
timestamp LONG YES

执行子账户合约资金划转(适用主账户)

响应

{
    "success":true,
    "txnId":"2934662589"
}

POST /sapi/v1/sub-account/futures/internalTransfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
fromEmail STRING YES 发送者邮箱 备注
toEmail STRING YES 接收者邮箱 备注
futuresType LONG YES 1:USDT合约, 2: 币本位合约
asset STRING YES
amount DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

查询子账户资产(适用主账户)

响应

{

    "success":true,
    "balances":[
        {
            "asset":"ADA",
            "free":10000,
            "locked":0
        },
        {
            "asset":"BNB",
            "free":10003,
            "locked":0
        },
        {
            "asset":"BTC",
            "free":11467.6399,
            "locked":0
        },
        {
            "asset":"ETH",
            "free":10004.995,
            "locked":0
        },
        {
            "asset":"USDT",
            "free":11652.14213,
            "locked":0
        }
    ]
}

GET /wapi/v3/sub-account/assets.html (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
recvWindow LONG NO
timestamp LONG YES

查询子账户现货资产汇总(适用主账户)

响应:

{
    "totalCount":2,
    "masterAccountTotalAsset":"0.23231201",
    "spotSubUserAssetBtcVoList":[
        {
            "email":"sub123@test.com",
            "totalAsset":"9999.00000000"
        },
        {
            "email":"test456@test.com",
            "totalAsset":"0.00000000"
        }
    ]
}

获取BTC计价的子账户现货资产汇总。

GET /sapi/v1/sub-account/spotSummary (HMAC SHA256)

权重: 5

参数:

名称 类型 是否必需 描述
email STRING NO 子账户邮箱
page LONG NO 分页,默认 1
size LONG NO 单页条目数, 默认 10, 最大 20
recvWindow LONG NO
timestamp LONG YES

获取子账户充值地址(适用主账户)

响应

{
    "address":"TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV",
    "coin":"USDT",
    "tag":"",
    "url":"https://tronscan.org/#/address/TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV"
}

GET /sapi/v1/capital/deposit/subAddress (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
coin STRING YES
network STRING NO
recvWindow LONG NO
timestamp LONG YES

获取子账户充值记录 (适用主账户)

响应

[
    {
        "amount":"0.00999800",
        "coin":"PAXG",
        "network":"ETH",
        "status":1,
        "address":"0x788cabe9236ce061e5a892e1a59395a81fc8d62c",
        "addressTag":"",
        "txId":"0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3",
        "insertTime":1599621997000,
        "transferType":0,
        "confirmTimes":"12/12"
    },
    {
        "amount":"0.50000000",
        "coin":"IOTA",
        "network":"IOTA",
        "status":1,
        "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW",
        "addressTag":"",
        "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999",
        "insertTime":1599620082000,
        "transferType":0,
        "confirmTimes":"1/1"
    }
]

GET /sapi/v1/capital/deposit/subHisrec (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
coin STRING NO
status INT NO 0(0:pending,6: credited but cannot withdraw, 1:success)
startTime LONG NO
endTime LONG NO
limit INT NO
offset INT NO default:0
recvWindow LONG NO
timestamp LONG YES

查询子账户Margin/Futures状态 (适用主账户)

响应

[
    {
        "email":"123@test.com",         // user email
        "isSubUserEnabled": true,   // true or false
        "isUserActive": true,           // true or false
        "insertTime": 1570791523523     // sub account create time
        "isMarginEnabled": true,      //true or false for margin
        "isFutureEnabled": true       //true or false for futures.
        "mobile": 1570791523523         // user mobile number
    }
]

GET /sapi/v1/sub-account/status (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING NO 子账户邮箱 备注
recvWindow LONG NO
timestamp LONG YES

为子账户开通Margin (适用主账户)

响应

{

    "email":"123@test.com",

    "isMarginEnabled": true

}

POST /sapi/v1/sub-account/margin/enable (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
recvWindow LONG NO
timestamp LONG YES

查询子账户Margin账户详情 (适用主账户)

响应

{
      "email":"123@test.com",
      "marginLevel": "11.64405625",
      "totalAssetOfBtc": "6.82728457",
      "totalLiabilityOfBtc": "0.58633215",
      "totalNetAssetOfBtc": "6.24095242",
      "marginTradeCoeffVo": 
            {
                "forceLiquidationBar": "1.10000000",  // 强平风险率
                "marginCallBar": "1.50000000",        // 补仓风险率
                "normalBar": "2.00000000"             // 初始风险率
            },
      "marginUserAssetVoList": [
          {
              "asset": "BTC",
              "borrowed": "0.00000000",
              "free": "0.00499500",
              "interest": "0.00000000",
              "locked": "0.00000000",
              "netAsset": "0.00499500"
          },
          {
              "asset": "BNB",
              "borrowed": "201.66666672",
              "free": "2346.50000000",
              "interest": "0.00000000",
              "locked": "0.00000000",
              "netAsset": "2144.83333328"
          },
          {
              "asset": "ETH",
              "borrowed": "0.00000000",
              "free": "0.00000000",
              "interest": "0.00000000",
              "locked": "0.00000000",
              "netAsset": "0.00000000"
          },
          {
              "asset": "USDT",
              "borrowed": "0.00000000",
              "free": "0.00000000",
              "interest": "0.00000000",
              "locked": "0.00000000",
              "netAsset": "0.00000000"
          }
      ]
}

GET /sapi/v1/sub-account/margin/account (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
recvWindow LONG NO

timestamp LONG YES

查询子账户Margin账户汇总 (适用主账户)

响应

{
    "totalAssetOfBtc": "4.33333333", 
    "totalLiabilityOfBtc": "2.11111112", 
    "totalNetAssetOfBtc": "2.22222221",
    "subAccountList":[
        {
            "email":"123@test.com",
            "totalAssetOfBtc": "2.11111111",
            "totalLiabilityOfBtc": "1.11111111",
            "totalNetAssetOfBtc": "1.00000000"
        },
        { 
            "email":"345@test.com",
            "totalAssetOfBtc": "2.22222222", 
            "totalLiabilityOfBtc": "1.00000001", 
            "totalNetAssetOfBtc": "1.22222221"
        }
    ]
}

GET /sapi/v1/sub-account/margin/accountSummary (HMAC SHA256)

权重: 1

参数:

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

为子账户开通Futures (适用主账户)

响应

{

    "email":"123@test.com",

    "isFuturesEnabled": true  // true or false

}

POST /sapi/v1/sub-account/futures/enable (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
recvWindow LONG NO
timestamp LONG YES

查询子账户Futures账户详情 (适用主账户)

响应


{
    "email": "abc@test.com",
    "asset": "USDT",
    "assets":[
        {
            "asset": "USDT",
            "initialMargin": "0.00000000",
            "maintenanceMargin": "0.00000000",
            "marginBalance": "0.88308000",
            "maxWithdrawAmount": "0.88308000",
            "openOrderInitialMargin": "0.00000000",
            "positionInitialMargin": "0.00000000",
            "unrealizedProfit": "0.00000000",
            "walletBalance": "0.88308000"
         }
    ],
    "canDeposit": true,
    "canTrade": true,
    "canWithdraw": true,
    "feeTier": 2,
    "maxWithdrawAmount": "0.88308000",
    "totalInitialMargin": "0.00000000",
    "totalMaintenanceMargin": "0.00000000",
    "totalMarginBalance": "0.88308000",
    "totalOpenOrderInitialMargin": "0.00000000",
    "totalPositionInitialMargin": "0.00000000",
    "totalUnrealizedProfit": "0.00000000",
    "totalWalletBalance": "0.88308000",
    "updateTime": 1576756674610
 }

GET /sapi/v1/sub-account/futures/account (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
recvWindow LONG NO
timestamp LONG YES

查询子账户Futures账户汇总 (适用主账户)

响应

{
    "totalInitialMargin": "9.83137400", 
    "totalMaintenanceMargin": "0.41568700", 
    "totalMarginBalance": "23.03235621", 
    "totalOpenOrderInitialMargin": "9.00000000",
    "totalPositionInitialMargin": "0.83137400",
    "totalUnrealizedProfit": "0.03219710",
    "totalWalletBalance": "22.15879444",
    "asset": "USDT",
    "subAccountList":[
        {
            "email": "123@test.com",
            "totalInitialMargin": "9.00000000", 
            "totalMaintenanceMargin": "0.00000000", 
            "totalMarginBalance": "22.12659734", 
            "totalOpenOrderInitialMargin": "9.00000000",
            "totalPositionInitialMargin": "0.00000000",
            "totalUnrealizedProfit": "0.00000000",
            "totalWalletBalance": "22.12659734",
            "asset": "USDT"
        },
        { 
            "email": "345@test.com",
            "totalInitialMargin": "0.83137400", 
            "totalMaintenanceMargin": "0.41568700",
            "totalMarginBalance": "0.90575887",
            "totalOpenOrderInitialMargin": "0.00000000",
            "totalPositionInitialMargin": "0.83137400",
            "totalUnrealizedProfit": "0.03219710",
            "totalWalletBalance": "0.87356177",
            "asset": "USDT"
        }
    ]
}

GET /sapi/v1/sub-account/futures/accountSummary (HMAC SHA256)

权重: 20

参数:

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

查询子账户合约持仓信息 (仅适用主账户)

响应

[
    {
        "entryPrice": "9975.12000",
        "leverage": "50",                   // current initial leverage
        "maxNotional": "1000000",      // notional value limit of current initial leverage
        "liquidationPrice": "7963.54",
        "markPrice": "9973.50770517",
        "positionAmount": "0.010",
        "symbol": "BTCUSDT",
        "unrealizedProfit": "-0.01612295"
    }
]

GET /sapi/v1/sub-account/futures/positionRisk (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email STRING YES 子账户邮箱 备注
recvWindow LONG NO
timestamp LONG YES

子账户Futures划转(仅适用主账户)

响应

{
    "txnId":"2966662589"
}

POST /sapi/v1/sub-account/futures/transfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email String YES 子账户邮箱 备注
asset STRING YES 划转资产, e.g., USDT
amount DECIMAL YES 划转数量
type INT YES 1: 由子账户的现货账户划转至其USDT本位合约账户; 2: 由子账户的USDT本位合约账户划转至其现货账户; 3:由子账户现货账户划转至其COIN本位合约账户;4: 由子账户COIN本位合约账户划转至其现货账户
timestamp LONG YES

子账户Margin划转(仅适用主账户)

响应

{
    "txnId":"2966662589"
}

POST /sapi/v1/sub-account/margin/transfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
email String YES 子账户邮箱 备注
asset STRING YES 划转资产, e.g., USDT
amount DECIMAL YES 划转数量
type INT YES 1: 由子账户的现货账户划转至其杠杆账户; 2: 由子账户的杠杆账户划转至其现货账户
timestamp LONG YES

向共同主账户下的子账户主动划转(仅适用子账户)

响应

{
    "txnId":"2966662589"
}

POST /sapi/v1/sub-account/transfer/subToSub (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
toEmail STRING YES 接收者子邮箱地址 备注
asset STRING YES
amount DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

向主账户主动划转(仅适用子账户)

响应

{
    "txnId":"2966662589"
}

POST /sapi/v1/sub-account/transfer/subToMaster (HMAC SHA256)

权重: 1

参数:

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

查询子账户划转历史 (仅适用子账户)

响应

[
  {
    "counterParty":"master",
    "email":"master@test.com",
    "type":1,  // 1 for transfer in , 2 for transfer out
    "asset":"BTC",
    "qty":"1",
    "status":"SUCCESS",
    "tranId":11798835829,
    "time":1544433325000
  },
  {
    "counterParty": "subAccount",
    "email": "sub2@test.com",
    "type":  2,                                 
    "asset":"ETH",
    "qty":"2",
    "status":"SUCCESS",
    "tranId":11798829519,
    "time":1544433326000
  }
]

GET /sapi/v1/sub-account/transfer/subUserHistory (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO 如不提供,返回所有asset 划转记录
type INT NO 1: transfer in, 2: transfer out; 如不提供,返回所有方向划转记录
startTime LONG NO
endTime LONG NO
limit INT NO 默认值: 500
recvWindow LONG NO
timestamp LONG YES

子母账户万能划转 (适用主账户)

响应

{
    "tranId":11945860693
}

POST /sapi/v1/sub-account/universalTransfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
fromEmail STRING NO
toEmail STRING NO
fromAccountType STRING YES "SPOT","USDT_FUTURE","COIN_FUTURE"
toAccountType STRING YES "SPOT","USDT_FUTURE","COIN_FUTURE"
asset STRING YES
amount DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

查询子母账户万能划转历史

响应

[
  {
    "tranId":11945860693,
    "fromEmail":"master@test.com",
    "toEmail":"subaccount1@test.com",
    "asset":"BTC",
    "amount":"0.1",
    "fromAccountType":"SPOT",
    "toAccountType":"COIN_FUTURE",
    "status":"SUCCESS",
    "createTimeStamp":1544433325000
  },
  {
    "tranId":11945857955,
    "fromEmail":"master@test.com",
    "toEmail":"subaccount2@test.com",                               
    "asset":"ETH",
    "amount":"0.2",
    "fromAccountType":"SPOT",
    "toAccountType":"USDT_FUTURE",
    "status":"SUCCESS",
    "createTimeStamp":1544433326000
  }
]

GET /sapi/v1/sub-account/universalTransfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
fromEmail STRING NO
toEmail STRING NO
startTime LONG NO
endTime LONG NO
page INT NO 默认 1
limit INT NO 默认 500, 最大 500
recvWindow LONG NO
timestamp LONG YES

行情接口

测试服务器连通性

响应

{}

GET /api/v3/ping

测试能否联通 Rest API。

权重:

1

参数:

NONE

获取服务器时间

响应

{
  "serverTime": 1499827319559
}

GET /api/v3/time

测试能否联通 Rest API 并 获取服务器时间。

权重: 1

参数:

NONE

交易规范信息

响应

{
    "timezone": "UTC",
    "serverTime": 1565246363776,
    "rateLimits": [
        {
            //These are defined in the `ENUM definitions` section under `Rate Limiters (rateLimitType)`.
            //All limits are optional
        }
    ],
    "exchangeFilters": [
            //These are the defined filters in the `Filters` section.
            //All filters are optional.
    ],
    "symbols": [
        {
            "symbol": "ETHBTC",
            "status": "TRADING",
            "baseAsset": "ETH",
            "baseAssetPrecision": 8,
            "quoteAsset": "BTC",
            "quotePrecision": 8,
            "quoteAssetPrecision": 8,
            "orderTypes": [
                "LIMIT",
                "LIMIT_MAKER",
                "MARKET",
                "STOP_LOSS",
                "STOP_LOSS_LIMIT",
                "TAKE_PROFIT",
                "TAKE_PROFIT_LIMIT"
            ],
            "icebergAllowed": true,
            "ocoAllowed": true,
            "isSpotTradingAllowed": true,
            "isMarginTradingAllowed": true,
            "filters": [
            //These are defined in the Filters section.
            //All filters are optional
            ],
            "permissions": [
              "SPOT",
              "MARGIN"
            ]
        }
    ]
}

GET /api/v3/exchangeInfo

获取交易规则和交易对信息。

权重: 1

参数:

NONE

深度信息

响应

{
  "lastUpdateId": 1027024,
  "bids": [
    [
      "4.00000000",     // 价位
      "431.00000000"    // 挂单量
    ]
  ],
  "asks": [
    [
      "4.00000200",
      "12.00000000"
    ]
  ]
}

GET /api/v3/depth

权重:

基于限制调整:

限制 权重
5, 10, 20, 50, 100 1
500 5
1000 10
5000 50

参数:

名称 类型 是否必需 描述
symbol STRING YES
limit INT NO 默认 100; 最大 5000. 可选值:[5, 10, 20, 50, 100, 500, 1000, 5000]

近期成交列表

响应

[
  {
    "id": 28457,
    "price": "4.00000100",
    "qty": "12.00000000",
    "time": 1499865549590, // 交易成交时间, 和websocket中的T一致.
    "isBuyerMaker": true,
    "isBestMatch": true
  }
]

GET /api/v3/trades

获取近期成交

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
limit INT NO 默认 500; 最大值 1000.

查询历史成交

响应

[
  {
    "id": 28457,
    "price": "4.00000100",
    "qty": "12.00000000",
    "quoteQty": "48.000012",
    "time": 1499865549590,
    "isBuyerMaker": true,
    "isBestMatch": true
  }
]

GET /api/v3/historicalTrades

获取历史成交。

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING YES
limit INT NO 默认 500; 最大值 1000.
fromId LONG NO 从哪一条成交id开始返回. 缺省返回最近的成交记录。

近期成交(归集)

响应

[
  {
    "a": 26129,         // 归集成交ID
    "p": "0.01633102",  // 成交价
    "q": "4.70443515",  // 成交量
    "f": 27781,         // 被归集的首个成交ID
    "l": 27781,         // 被归集的末个成交ID
    "T": 1498793709153, // 成交时间
    "m": true,          // 是否为主动卖出单
    "M": true           // 是否为最优撮合单(可忽略,目前总为最优撮合)
  }
]

GET /api/v3/aggTrades

归集交易与逐笔交易的区别在于,同一价格、同一方向、同一时间的trade会被聚合为一条

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
fromId LONG NO 从包含fromId的成交id开始返回结果
startTime LONG NO 从该时刻之后的成交记录开始返回结果
endTime LONG NO 返回该时刻为止的成交记录
limit INT NO 默认 500; 最大 1000.

K线数据

响应

[
  [
    1499040000000,      // 开盘时间
    "0.01634790",       // 开盘价
    "0.80000000",       // 最高价
    "0.01575800",       // 最低价
    "0.01577100",       // 收盘价(当前K线未结束的即为最新价)
    "148976.11427815",  // 成交量
    1499644799999,      // 收盘时间
    "2434.19055334",    // 成交额
    308,                // 成交笔数
    "1756.87402397",    // 主动买入成交量
    "28.46694368",      // 主动买入成交额
    "17928899.62484339" // 请忽略该参数
  ]
]

GET /api/v3/klines

每根K线代表一个交易对。
每根K线的开盘时间可视为唯一ID

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
interval ENUM YES
startTime LONG NO
endTime LONG NO
limit INT NO 默认 500; 最大 1000.

当前平均价格

响应

{
  "mins": 5,
  "price": "9.35751834"
}

GET /api/v3/avgPrice

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES

24hr 价格变动情况

响应

{
  "symbol": "BNBBTC",
  "priceChange": "-94.99999800",
  "priceChangePercent": "-95.960",
  "weightedAvgPrice": "0.29628482",
  "prevClosePrice": "0.10002000",
  "lastPrice": "4.00000200",
  "lastQty": "200.00000000",
  "bidPrice": "4.00000000",
  "askPrice": "4.00000200",
  "openPrice": "99.00000000",
  "highPrice": "100.00000000",
  "lowPrice": "0.10000000",
  "volume": "8913.30000000",
  "quoteVolume": "15.30000000",
  "openTime": 1499783499040,
  "closeTime": 1499869899040,
  "firstId": 28385,   // 首笔成交id
  "lastId": 28460,    // 末笔成交id
  "count": 76         // 成交笔数
}

OR

[
  {
    "symbol": "BNBBTC",
    "priceChange": "-94.99999800",
    "priceChangePercent": "-95.960",
    "weightedAvgPrice": "0.29628482",
    "prevClosePrice": "0.10002000",
    "lastPrice": "4.00000200",
    "lastQty": "200.00000000",
    "bidPrice": "4.00000000",
    "askPrice": "4.00000200",
    "openPrice": "99.00000000",
    "highPrice": "100.00000000",
    "lowPrice": "0.10000000",
    "volume": "8913.30000000",
    "quoteVolume": "15.30000000",
    "openTime": 1499783499040,
    "closeTime": 1499869899040,
    "firstId": 28385,  
    "lastId": 28460,   
    "count": 76      
  }
]

GET /api/v3/ticker/24hr

24 小时滚动窗口价格变动数据。 请注意,不携带symbol参数会返回全部交易对数据,不仅数据庞大,而且权重极高

权重: 1 单一交易对;
40 交易对参数缺失;

参数:

名称 类型 是否必需 描述
symbol STRING NO

最新价格

响应

{
  "symbol": "LTCBTC",
  "price": "4.00000200"
}

OR

[
  {
    "symbol": "LTCBTC",
    "price": "4.00000200"
  },
  {
    "symbol": "ETHBTC",
    "price": "0.07946600"
  }
]

GET /api/v3/ticker/price

获取交易对最新价格

权重:

1 单一交易对;
2 交易对参数缺失

参数:

名称 类型 是否必需 描述
symbol STRING NO

当前最优挂单

响应

{
  "symbol": "LTCBTC",
  "bidPrice": "4.00000000",
  "bidQty": "431.00000000",
  "askPrice": "4.00000200",
  "askQty": "9.00000000"
}

OR

[
  {
    "symbol": "LTCBTC",
    "bidPrice": "4.00000000",
    "bidQty": "431.00000000",
    "askPrice": "4.00000200",
    "askQty": "9.00000000"
  },
  {
    "symbol": "ETHBTC",
    "bidPrice": "0.07946700",
    "bidQty": "9.00000000",
    "askPrice": "100000.00000000",
    "askQty": "1000.00000000"
  }
]

GET /api/v3/ticker/bookTicker

返回当前最优的挂单(最高买单,最低卖单)

权重:

1 单一交易对;
2 交易对参数缺失

参数:

名称 类型 是否必需 描述
symbol STRING NO

Websocket 行情推送

实时订阅/取消数据流

订阅一个信息流

响应

  {
    "result": null,
    "id": 1
  }

取消订阅一个信息流

响应

  {
    "result": null,
    "id": 312
  }

{
"method": "UNSUBSCRIBE",
"params":
[
"btcusdt@depth"
],
"id": 312
}

已订阅信息流

响应

  {
    "result": [
      "btcusdt@aggTrade"
    ],
    "id": 3
  }

{
"method": "LIST_SUBSCRIPTIONS",
"id": 3
}

设定属性

当前,唯一可以设置的属性是设置是否启用combined("组合")信息流。
当使用/ws/("原始信息流")进行连接时,combined属性设置为false,而使用 /stream/进行连接时则将属性设置为true

响应

{
  "result": null,
  "id": 5
}

{
"method": "SET_PROPERTY",
"params":
[
"combined",
true
],
"id": 5
}

检索属性

响应

  {
    "result": true, // Indicates that combined is set to true.
    "id": 2
  }

{
"method": "GET_PROPERTY",
"params":
[
"combined"
],
"id": 2
}

错误信息

错误信息 描述
{"code": 0, "msg": "Unknown property"} SET_PROPERTYGET_PROPERTY中应用的参数无效
{"code": 1, "msg": "Invalid value type: expected Boolean", "id": '%s'} 仅接受truefalse
{"code": 2, "msg": "Invalid request: property name must be a string"} 提供的属性名无效
{"code": 2, "msg": "Invalid request: request ID must be an unsigned integer"} 参数id未提供或id值是无效类型
{"code": 2, "msg": "Invalid request: unknown variant %s, expected one of SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS, SET_PROPERTY, GET_PROPERTY at line 1 column 28"} 错字提醒,或提供的值不是预期类型
{"code": 2, "msg": "Invalid request: too many parameters"} 数据中提供了不必要参数
{"code": 2, "msg": "Invalid request: property name must be a string"} 未提供属性名
{"code": 2, "msg": "Invalid request: missing field method at line 1 column 73"} 数据未提供method
{"code":3,"msg":"Invalid JSON: expected value at line %s column %s"} JSON 语法有误.

归集交易流

Payload:

{
  "e": "aggTrade",  // 事件类型
  "E": 123456789,   // 事件时间
  "s": "BNBBTC",    // 交易对
  "a": 12345,       // 归集交易ID
  "p": "0.001",     // 成交价格
  "q": "100",       // 成交笔数
  "f": 100,         // 被归集的首个交易ID
  "l": 105,         // 被归集的末次交易ID
  "T": 123456785,   // 成交时间
  "m": true,        // 买方是否是做市方。如true,则此次成交是一个主动卖出单,否则是一个主动买入单。
  "M": true         // 请忽略该字段
}

归集交易 stream 推送交易信息,是对单一订单的集合。

Stream 名称: <symbol>@aggTrade
Update Speed: 实时

逐笔交易

Payload:

{
  "e": "trade",     // 事件类型
  "E": 123456789,   // 事件时间
  "s": "BNBBTC",    // 交易对
  "t": 12345,       // 交易ID
  "p": "0.001",     // 成交价格
  "q": "100",       // 成交笔数
  "b": 88,          // 买方的订单ID
  "a": 50,          // 卖方的订单ID
  "T": 123456785,   // 成交时间
  "m": true,        // 买方是否是做市方。如true,则此次成交是一个主动卖出单,否则是一个主动买入单。
  "M": true         // 请忽略该字段
}

Stream Name: <symbol>@trade

逐笔交易推送每一笔成交的信息。成交,或者说交易的定义是仅有一个吃单者与一个挂单者相互交易

K线 Streams

Payload:

{
  "e": "kline",     // 事件类型
  "E": 123456789,   // 事件时间
  "s": "BNBBTC",    // 交易对
  "k": {
    "t": 123400000, // 这根K线的起始时间
    "T": 123460000, // 这根K线的结束时间
    "s": "BNBBTC",  // 交易对
    "i": "1m",      // K线间隔
    "f": 100,       // 这根K线期间第一笔成交ID
    "L": 200,       // 这根K线期间末一笔成交ID
    "o": "0.0010",  // 这根K线期间第一笔成交价
    "c": "0.0020",  // 这根K线期间末一笔成交价
    "h": "0.0025",  // 这根K线期间最高成交价
    "l": "0.0015",  // 这根K线期间最低成交价
    "v": "1000",    // 这根K线期间成交量
    "n": 100,       // 这根K线期间成交笔数
    "x": false,     // 这根K线是否完结(是否已经开始下一根K线)
    "q": "1.0000",  // 这根K线期间成交额
    "V": "500",     // 主动买入的成交量
    "Q": "0.500",   // 主动买入的成交额
    "B": "123456"   // 忽略此参数
  }
}

K线stream逐秒推送所请求的K线种类(最新一根K线)的更新。

Stream Name: <symbol>@kline_<interval>

Update Speed: 2000ms

K线图间隔参数:

m -> 分钟; h -> 小时; d -> 天; w -> 周; M -> 月

按 Symbol 的精简Ticker

Payload:

  {
    "e": "24hrMiniTicker",  // 事件类型
    "E": 123456789,         // 事件时间
    "s": "BNBBTC",          // 交易对
    "c": "0.0025",          // 最新成交价格
    "o": "0.0010",          // 24小时前开始第一笔成交价格
    "h": "0.0025",          // 24小时内最高成交价
    "l": "0.0010",          // 24小时内最低成交加
    "v": "10000",           // 成交量
    "q": "18"               // 成交额
  }

按Symbol刷新的最近24小时精简ticker信息

Stream 名称: <symbol>@miniTicker

Update Speed: 1000ms

全市场所有Symbol的精简Ticker

Payload: javascript [ { // 数组每一个元素对应一个交易对,内容与 \<symbol\>@miniTicker相同 } ]

同上,只是推送所有交易对.需要注意的是,只有更新的ticker才会被推送.

Stream名称: !miniTicker@arr

Update Speed: 1000ms

按Symbol的完整Ticker

Payload:

{
  "e": "24hrTicker",  // 事件类型
  "E": 123456789,     // 事件时间
  "s": "BNBBTC",      // 交易对
  "p": "0.0015",      // 24小时价格变化
  "P": "250.00",      // 24小时价格变化(百分比)
  "w": "0.0018",      // 平均价格
  "x": "0.0009",      // 整整24小时之前,向前数的最后一次成交价格
  "c": "0.0025",      // 最新成交价格
  "Q": "10",          // 最新成交交易的成交量
  "b": "0.0024",      // 目前最高买单价
  "B": "10",          // 目前最高买单价的挂单量
  "a": "0.0026",      // 目前最低卖单价
  "A": "100",         // 目前最低卖单价的挂单量
  "o": "0.0010",      // 整整24小时前,向后数的第一次成交价格
  "h": "0.0025",      // 24小时内最高成交价
  "l": "0.0010",      // 24小时内最低成交加
  "v": "10000",       // 24小时内成交量
  "q": "18",          // 24小时内成交额
  "O": 0,             // 统计开始时间
  "C": 86400000,      // 统计结束时间
  "F": 0,             // 24小时内第一笔成交交易ID
  "L": 18150,         // 24小时内最后一笔成交交易ID
  "n": 18151          // 24小时内成交数
}

每秒推送单个交易对的过去24小时滚动窗口标签统计信息。

Stream 名称: <symbol>@ticker

Update Speed: 1000ms

全市场所有交易对的完整Ticker

Payload:

[
  {
    // Same as <symbol>@ticker payload
  }
]

Stream Name: !ticker@arr

Update Speed: 1000ms

推送全市场所有交易对刷新的24小时完整ticker信息。需要注意的是,没有更新的ticker不会被推送。

按Symbol的最优挂单信息

Payload:

{
  "u":400900217,     // order book updateId
  "s":"BNBUSDT",     // 交易对
  "b":"25.35190000", // 买单最优挂单价格
  "B":"31.21000000", // 买单最优挂单数量
  "a":"25.36520000", // 卖单最优挂单价格
  "A":"40.66000000"  // 卖单最优挂单数量
}

实时推送指定交易对最优挂单信息

Stream Name: <symbol>@bookTicker

Update Speed: 实时

全市场最优挂单信息

Payload:

{
  // Same as <symbol>@bookTicker payload
}

实时推送所有交易对交易对最优挂单信息

Stream Name: !bookTicker

Update Speed: 实时

有限档深度信息

Payload:

{
  "lastUpdateId": 160,  // Last update ID
  "bids": [             // Bids to be updated
    [
      "0.0024",         // Price level to be updated
      "10"              // Quantity
    ]
  ],
  "asks": [             // Asks to be updated
    [
      "0.0026",         // Price level to be updated
      "100"             // Quantity
    ]
  ]
}

每秒或每100毫秒推送有限档深度信息。levels表示几档买卖单信息, 可选 5/10/20档

Stream Names: <symbol>@depth<levels><symbol>@depth<levels>@100ms.

Update Speed: 1000ms 或 100ms

增量深度信息

Payload:

{
  "e": "depthUpdate", // 事件类型
  "E": 123456789,     // 事件时间
  "s": "BNBBTC",      // 交易对
  "U": 157,           // 从上次推送至今新增的第一个 update Id
  "u": 160,           // 从上次推送至今新增的最后一个 update Id
  "b": [              // 变动的买单深度
    [
      "0.0024",       // 变动的价格档位
      "10"            // 数量
    ]
  ],
  "a": [              // 变动的卖单深度
    [
      "0.0026",       // 变动的价格档位
      "100"           // 数量
    ]
  ]
}

每秒或每100毫秒推送orderbook的变化部分(如果有)

Stream Name: <symbol>@depth<symbol>@depth@100ms

Update Speed: 1000ms 或 100ms

如何正确在本地维护一个orderbook副本

  1. 订阅 wss://stream.binance.com:9443/ws/bnbbtc@depth
  2. 开始缓存收到的更新。同一个价位,后收到的更新覆盖前面的。
  3. 访问Rest接口 https://api.binance.com/api/v3/depth?symbol=BNBBTC&limit=1000 获得一个1000档的深度快照
  4. 将目前缓存到的信息中u <= 步骤3中获取到的快照中的lastUpdateId的部分丢弃(丢弃更早的信息,已经过期)。
  5. 将深度快照中的内容更新到本地orderbook副本中,并从websocket接收到的第一个U <= lastUpdateId+1 u >= lastUpdateId+1 的event开始继续更新本地副本。
  6. 每一个新event的U应该恰好等于上一个event的u+1,否则可能出现了丢包,请从step3重新进行初始化。
  7. 每一个event中的挂单量代表这个价格目前的挂单量绝对值,而不是相对变化。
  8. 如果某个价格对应的挂单量为0,表示该价位的挂单已经撤单或者被吃,应该移除这个价位。

现货账户和交易接口

测试下单 (TRADE)

响应

{}

POST /api/v3/order/test (HMAC SHA256)

用于测试订单请求,但不会提交到撮合引擎

权重: 1

参数:

同于 POST /api/v3/order

下单 (TRADE)

Response ACK:

{
  "symbol": "BTCUSDT",
  "orderId": 28,
  "orderListId": -1, //Unless OCO, value will be -1
  "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
  "transactTime": 1507725176595
}

Response RESULT:

{
  "symbol": "BTCUSDT",
  "orderId": 28,
  "orderListId": -1, //Unless OCO, value will be -1
  "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
  "transactTime": 1507725176595,
  "price": "0.00000000",
  "origQty": "10.00000000",
  "executedQty": "10.00000000",
  "cummulativeQuoteQty": "10.00000000",
  "status": "FILLED",
  "timeInForce": "GTC",
  "type": "MARKET",
  "side": "SELL"
}

Response FULL:

{
  "symbol": "BTCUSDT", // 交易对
  "orderId": 28, // 系统的订单ID
  "orderListId": -1, // OCO订单的ID,不然就是-1
  "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", // 客户自己设置的ID
  "transactTime": 1507725176595, // 交易的时间戳
  "price": "0.00000000", // 订单价格
  "origQty": "10.00000000", // 用户设置的原始订单数量
  "executedQty": "10.00000000", // 交易的订单数量
  "cummulativeQuoteQty": "10.00000000", // 累计交易的金额
  "status": "FILLED", // 订单状态
  "timeInForce": "GTC", // 订单的时效方式
  "type": "MARKET", // 订单类型, 比如市价单,现价单等
  "side": "SELL", // 订单方向,买还是卖
  "fills": [ // 订单中交易的信息
    {
      "price": "4000.00000000", // 交易的价格
      "qty": "1.00000000", // 交易的数量
      "commission": "4.00000000", // 手续费金额
      "commissionAsset": "USDT" // 手续费的币种
    },
    {
      "price": "3999.00000000",
      "qty": "5.00000000",
      "commission": "19.99500000",
      "commissionAsset": "USDT"
    },
    {
      "price": "3998.00000000",
      "qty": "2.00000000",
      "commission": "7.99600000",
      "commissionAsset": "USDT"
    },
    {
      "price": "3997.00000000",
      "qty": "1.00000000",
      "commission": "3.99700000",
      "commissionAsset": "USDT"
    },
    {
      "price": "3995.00000000",
      "qty": "1.00000000",
      "commission": "3.99500000",
      "commissionAsset": "USDT"
    }
  ]
}

POST /api/v3/order (HMAC SHA256)

发送下单。

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
side ENUM YES
type ENUM YES
timeInForce ENUM NO
quantity DECIMAL NO
quoteOrderQty DECIMAL NO
price DECIMAL NO
newClientOrderId STRING NO 客户自定义的唯一订单ID。 如果未发送,则自动生成
stopPrice DECIMAL NO STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, 和TAKE_PROFIT_LIMIT 需要此参数。
icebergQty DECIMAL NO 仅使用 LIMIT, STOP_LOSS_LIMIT, 和 TAKE_PROFIT_LIMIT 创建新的 iceberg 订单时需要此参数
newOrderRespType ENUM NO 设置响应JSON。 ACK,RESULT或FULL; "MARKET"和" LIMIT"订单类型默认为"FULL",所有其他订单默认为"ACK"。
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

基于订单 type不同,强制要求某些参数:

类型 强制要求的参数
LIMIT timeInForce, quantity, price
MARKET quantity or quoteOrderQty
STOP_LOSS quantity, stopPrice
STOP_LOSS_LIMIT timeInForce, quantity, price, stopPrice
TAKE_PROFIT quantity, stopPrice
TAKE_PROFIT_LIMIT timeInForce, quantity, price, stopPrice
LIMIT_MAKER quantity, price

其他信息:

MARKET版本和LIMIT版本针对市场价格触发订单价格规则:

关于 newOrderRespType的三种选择

撤销订单 (TRADE)

响应

{
  "symbol": "LTCBTC",
  "origClientOrderId": "myOrder1",
  "orderId": 4,
  "orderListId": -1, //Unless part of an OCO, the value will always be -1.
  "clientOrderId": "cancelMyOrder1",
  "price": "2.00000000",
  "origQty": "1.00000000",
  "executedQty": "0.00000000",
  "cummulativeQuoteQty": "0.00000000",
  "status": "CANCELED",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "side": "BUY"
}

DELETE /api/v3/order (HMAC SHA256)

取消有效订单。

权重: 1

参数:

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

orderIdorigClientOrderId 必须至少发送一个

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

Response:

[
  {
    "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"
  },
  {
    "symbol": "BTCUSDT",
    "origClientOrderId": "A3EF2HCwxgZPFMrfwbgrhv",
    "orderId": 13,
    "orderListId": -1,
    "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx",
    "price": "0.090430",
    "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"
      },
      {
        "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"
      }
    ]
  }
]

DELETE api/v3/openOrders

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

权重: 1

参数:

Name Type Mandatory Description
symbol STRING YES
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

查询订单 (USER_DATA)

响应

{
  "symbol": "LTCBTC", // 交易对
  "orderId": 1, // 系统的订单ID
  "orderListId": -1, // OCO订单的ID,不然就是-1
  "clientOrderId": "myOrder1", // 客户自己设置的ID
  "price": "0.1", // 订单价格
  "origQty": "1.0", // 用户设置的原始订单数量
  "executedQty": "0.0", // 交易的订单数量
  "cummulativeQuoteQty": "0.0", // 累计交易的金额
  "status": "NEW", // 订单状态
  "timeInForce": "GTC", // 订单的时效方式
  "type": "LIMIT", // 订单类型, 比如市价单,现价单等
  "side": "BUY", // 订单方向,买还是卖
  "stopPrice": "0.0", // 止损价格
  "icebergQty": "0.0", // 冰山数量
  "time": 1499827319559, // 订单时间
  "updateTime": 1499827319559, // 最后更新时间
  "isWorking": true, // 订单是否出现在orderbook中
  "origQuoteOrderQty": "0.000000" // 原始的交易金额
}

GET /api/v3/order (HMAC SHA256)

查询订单状态。

权重: 1

参数:

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

注意:

当前挂单 (USER_DATA)

响应

[
  {
    "symbol": "LTCBTC",
    "orderId": 1,
    "orderListId": -1, //Unless OCO, the value will always be -1
    "clientOrderId": "myOrder1",
    "price": "0.1",
    "origQty": "1.0",
    "executedQty": "0.0",
    "cummulativeQuoteQty": "0.0",
    "status": "NEW",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "stopPrice": "0.0",
    "icebergQty": "0.0",
    "time": 1499827319559,
    "updateTime": 1499827319559,
    "isWorking": true,
    "origQuoteOrderQty": "0.000000"
  }
]

GET /api/v3/openOrders (HMAC SHA256)

获取交易对的所有当前挂单, 请小心使用不带交易对参数的调用。

权重: 1 单一交易对;
2交易对参数缺失

参数:

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

查询所有订单 (USER_DATA)

响应

[
  {
    "symbol": "LTCBTC",
    "orderId": 1,
    "orderListId": -1, //Unless OCO, the value will always be -1
    "clientOrderId": "myOrder1",
    "price": "0.1",
    "origQty": "1.0",
    "executedQty": "0.0",
    "cummulativeQuoteQty": "0.0",
    "status": "NEW",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "stopPrice": "0.0",
    "icebergQty": "0.0",
    "time": 1499827319559,
    "updateTime": 1499827319559,
    "isWorking": true,
    "origQuoteOrderQty": "0.000000"
  }
]

GET /api/v3/allOrders (HMAC SHA256)

获取所有帐户订单; 有效,已取消或已完成。

权重: 5 带有symbol

参数:

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

注意:

OCO下单(TRADE)

响应

{
  "orderListId": 0,
  "contingencyType": "OCO",
  "listStatusType": "EXEC_STARTED",
  "listOrderStatus": "EXECUTING",
  "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
  "transactionTime": 1563417480525,
  "symbol": "LTCBTC",
  "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"
    },
    {
      "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"
    }
  ]
}

POST /api/v3/order/oco (HMAC SHA256)

权重: 1

发送新 OCO 订单

参数:

名称 类型 是否必需 描述
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 Set the response JSON.
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

其他信息:

取消 OCO 订单(TRADE)

Response:

{
  "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"
    },
    {
      "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"
    }
  ]
}

DELETE /api/v3/orderList (HMAC SHA256)

权重: 1

取消整个订单列表。

参数

名称 类型 是否必需 描述
symbol STRING YES
orderListId LONG NO orderListIdlistClientOrderId 必须被提供
listClientOrderId STRING NO orderListIdlistClientOrderId 必须被提供
newClientOrderId STRING NO 用户自定义的本次撤销操作的ID(注意不是被撤销的订单的自定义ID)。如无指定会自动赋值。
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 /api/v3/orderList (HMAC SHA256)

权重: 1

根据提供的可选参数检索特定的OCO。

参数:

名称 类型 是否必需 描述
orderListId LONG NO orderListIdlistClientOrderId 必须提供一个。
origClientOrderId STRING NO orderListIdlistClientOrderId 必须提供一个。
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 /api/v3/allOrderList (HMAC SHA256)

权重: 10

根据提供的可选参数检索所有的OCO。

参数

名称 类型 是否必需 描述
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": "1565246079109",
    "orders": [
      {
        "symbol": "LTCBTC",
        "orderId": 4,
        "clientOrderId": "r3EH2N76dHfLoSZWIUw1bT"
      },
      {
        "symbol": "LTCBTC",
        "orderId": 5,
        "clientOrderId": "Cv1SnyPD3qhqpbjpYEHbd2"
      }
    ]
  }
]

GET /api/v3/openOrderList (HMAC SHA256)

权重: 2

参数

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

账户信息 (USER_DATA)

响应

{
  "makerCommission": 15,
  "takerCommission": 15,
  "buyerCommission": 0,
  "sellerCommission": 0,
  "canTrade": true,
  "canWithdraw": true,
  "canDeposit": true,
  "updateTime": 123456789,
  "accountType": "SPOT",
  "balances": [
    {
      "asset": "BTC",
      "free": "4723846.89208129",
      "locked": "0.00000000"
    },
    {
      "asset": "LTC",
      "free": "4763368.68006011",
      "locked": "0.00000000"
    }
  ],
  "permissions": [
    "SPOT"
  ]
}

GET /api/v3/account (HMAC SHA256)

获取当前账户信息。

权重: 5

参数:

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

账户成交历史 (USER_DATA)

响应

[
  {
    "symbol": "BNBBTC", // 交易对
    "id": 28457, // trade ID
    "orderId": 100234, // 订单ID
    "orderListId": -1, // OCO订单的ID,不然就是-1
    "price": "4.00000100", // 成交价格
    "qty": "12.00000000", // 成交量
    "quoteQty": "48.000012", // 成交金额
    "commission": "10.10000000", // 交易费金额
    "commissionAsset": "BNB", // 交易费资产类型
    "time": 1499865549590, // 交易时间
    "isBuyer": true, // 是否是买家
    "isMaker": false, // 是否是挂单方
    "isBestMatch": true
  }
]

GET /api/v3/myTrades (HMAC SHA256)

获取账户指定交易对的成交历史

权重: 5

参数:

名称 类型 是否必需 描述
symbol STRING YES
startTime LONG NO
endTime LONG NO
fromId LONG NO 起始Trade id。 默认获取最新交易。
limit INT NO 默认 500; 最大 1000.
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

注意:

杠杆账户和交易接口

全仓杠杆账户划转 (MARGIN)

响应

{
    //transaction id
    "tranId": 100000001
}

POST /sapi/v1/margin/transfer (HMAC SHA256) 执行现货账户与全仓杠杆账户之间的划转

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES 被划转的资产, 比如, BTC
amount DECIMAL YES 划转数量
type INT YES 1: 主账户向全仓杠杆账户划转 2: 全仓杠杆账户向主账户划转
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

杠杆账户借贷 (MARGIN)

响应

{
    //transaction id
    "tranId": 100000001
}

POST /sapi/v1/margin/loan (HMAC SHA256) 申请借贷。

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES
isIsolated STRING NO 是否逐仓杠杆,"TRUE", "FALSE", 默认 "FALSE"
symbol STRING NO 逐仓交易对,配合逐仓使用
amount DECIMAL YES
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

杠杆账户归还借贷 (MARGIN)

响应

{
    //transaction id
    "tranId": 100000001
}

POST /sapi/v1/margin/repay (HMAC SHA256) 获取杠杆账户归还借贷。

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES
isIsolated STRING NO 是否逐仓杠杆,"TRUE", "FALSE", 默认 "FALSE"
symbol STRING NO 逐仓交易对,配合逐仓使用
amount DECIMAL YES
recvWindow LONG NO 赋值不能超过 60000
timestamp LONG YES

查询杠杆资产 (MARKET_DATA)

响应

{
    "assetFullName": "Binance Coin",
    "assetName": "BNB",
    "isBorrowable": false,
    "isMortgageable": true,
    "userMinBorrow": "0.00000000",
    "userMinRepay": "0.00000000"
}

GET /sapi/v1/margin/asset

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES

查询全仓杠杆交易对 (MARKET_DATA)

响应

{
   "id":323355778339572400,
   "symbol":"BTCUSDT",
   "base":"BTC",
   "quote":"USDT",
   "isMarginTrade":true,
   "isBuyAllowed":true,
   "isSellAllowed":true
}

GET /sapi/v1/margin/pair

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES

获取所有全仓杠杆资产信息 (MARKET_DATA)

响应

  [
      {
          "assetFullName": "USD coin",
          "assetName": "USDC",
          "isBorrowable": true,
          "isMortgageable": true,
          "userMinBorrow": "0.00000000",
          "userMinRepay": "0.00000000"
      },
      {
          "assetFullName": "BNB-coin",
          "assetName": "BNB",
          "isBorrowable": true,
          "isMortgageable": true,
          "userMinBorrow": "1.00000000",
          "userMinRepay": "0.00000000"
      },
      {
          "assetFullName": "Tether",
          "assetName": "USDT",
          "isBorrowable": true,
          "isMortgageable": true,
          "userMinBorrow": "1.00000000",
          "userMinRepay": "0.00000000"
      },
      {
          "assetFullName": "etherum",
          "assetName": "ETH",
          "isBorrowable": true,
          "isMortgageable": true,
          "userMinBorrow": "0.00000000",
          "userMinRepay": "0.00000000"
      },
      {
          "assetFullName": "Bitcoin",
          "assetName": "BTC",
          "isBorrowable": true,
          "isMortgageable": true,
          "userMinBorrow": "0.00000000",
          "userMinRepay": "0.00000000"
      }
  ]

GET /sapi/v1/margin/allAssets

权重: 1

参数:
None

获取所有全仓杠杆交易对(MARKET_DATA)

响应

[
    {
        "base": "BNB",
        "id": 351637150141315861,
        "isBuyAllowed": true,
        "isMarginTrade": true,
        "isSellAllowed": true,
        "quote": "BTC",
        "symbol": "BNBBTC"
    },
    {
        "base": "TRX",
        "id": 351637923235429141,
        "isBuyAllowed": true,
        "isMarginTrade": true,
        "isSellAllowed": true,
        "quote": "BTC",
        "symbol": "TRXBTC"
    },
    {
        "base": "XRP",
        "id": 351638112213990165,
        "isBuyAllowed": true,
        "isMarginTrade": true,
        "isSellAllowed": true,
        "quote": "BTC",
        "symbol": "XRPBTC"
    },
    {
        "base": "ETH",
        "id": 351638524530850581,
        "isBuyAllowed": true,
        "isMarginTrade": true,
        "isSellAllowed": true,
        "quote": "BTC",
        "symbol": "ETHBTC"
    },
    {
        "base": "BNB",
        "id": 376870400832855109,
        "isBuyAllowed": true,
        "isMarginTrade": true,
        "isSellAllowed": true,
        "quote": "USDT",
        "symbol": "BNBUSDT"
  }
]

GET /sapi/v1/margin/allPairs

权重: 1

参数:

None

查询杠杆价格指数 (MARKET_DATA)

响应

{
   "calcTime": 1562046418000,
   "price": "0.00333930",
   "symbol": "BNBBTC"
}

GET /sapi/v1/margin/priceIndex

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES

杠杆账户下单 (TRADE)

Response ACK:

{
  "symbol": "BTCUSDT",
  "orderId": 28,
  "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
  "isIsolated": true,       // 是否是逐仓symbol交易
  "transactTime": 1507725176595
}

Response RESULT:

{
  "symbol": "BTCUSDT",
  "orderId": 28,
  "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
  "transactTime": 1507725176595,
  "price": "1.00000000",
  "origQty": "10.00000000",
  "executedQty": "10.00000000",
  "cummulativeQuoteQty": "10.00000000",
  "status": "FILLED",
  "timeInForce": "GTC",
  "type": "MARKET",
  "isIsolated": true,       // 是否是逐仓symbol交易
  "side": "SELL"
}

Response FULL:

{
  "symbol": "BTCUSDT",
  "orderId": 28,
  "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
  "transactTime": 1507725176595,
  "price": "0.00000000",
  "origQty": "10.00000000",
  "executedQty": "10.00000000",
  "cummulativeQuoteQty": "10.00000000",
  "status": "FILLED",
  "timeInForce": "GTC",
  "type": "MARKET",
  "side": "SELL",
  "marginBuyBorrowAmount": 5,       // 下单后没有发生借款则不返回该字段
  "marginBuyBorrowAsset": "BTC",    // 下单后没有发生借款则不返回该字段
  "isIsolated": true,       // 是否是逐仓symbol交易
  "fills": [
    {
      "price": "4000.00000000",
      "qty": "1.00000000",
      "commission": "4.00000000",
      "commissionAsset": "USDT"
    },
    {
      "price": "3999.00000000",
      "qty": "5.00000000",
      "commission": "19.99500000",
      "commissionAsset": "USDT"
    },
    {
      "price": "3998.00000000",
      "qty": "2.00000000",
      "commission": "7.99600000",
      "commissionAsset": "USDT"
    },
    {
      "price": "3997.00000000",
      "qty": "1.00000000",
      "commission": "3.99700000",
      "commissionAsset": "USDT"
    },
    {
      "price": "3995.00000000",
      "qty": "1.00000000",
      "commission": "3.99500000",
      "commissionAsset": "USDT"
    }
  ]
}

POST /sapi/v1/margin/order (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
isIsolated STRING NO 是否逐仓杠杆,"TRUE", "FALSE", 默认 "FALSE"
side ENUM YES BUY
SELL
type ENUM YES
quantity DECIMAL YES
price DECIMAL NO
stopPrice DECIMAL NO STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, 和 TAKE_PROFIT_LIMIT 订单一起使用.
newClientOrderId STRING NO 客户自定义的唯一订单ID。若未发送自动生成。
icebergQty DECIMAL NO LIMIT, STOP_LOSS_LIMIT, 和 TAKE_PROFIT_LIMIT 一起使用创建 iceberg 订单.
newOrderRespType ENUM NO 设置响应: JSON. ACK, RESULT, 或 FULL; MARKET 和 LIMIT 订单类型默认为 FULL, 所有其他订单默认为 ACK.
sideEffectType ENUM NO NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY;默认为 NO_SIDE_EFFECT.
timeInForce ENUM NO GTC,IOC,FOK
recvWindow LONG NO 赋值不能大于 60000
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",
  "isIsolated": true       // 是否是逐仓symbol交易 
}

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

杠杆账户撤销有效订单。

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
isIsolated STRING NO 是否逐仓杠杆,"TRUE", "FALSE", 默认 "FALSE"
orderId LONG NO
origClientOrderId STRING NO
newClientOrderId STRING NO 用于唯一识别此撤销订单,默认自动生成。
recvWindow LONG NO T赋值不能大于 60000
timestamp LONG YES

获取全仓杠杆划转历史 (USER_DATA)

响应

{
  "rows": [
    {
      "amount": "0.10000000",
      "asset": "BNB",
      "status": "CONFIRMED",
      "timestamp": 1566898617,
      "txId": 5240372201,
      "type": "ROLL_IN"
    },
    {
      "amount": "5.00000000",
      "asset": "USDT",
      "status": "CONFIRMED",
      "timestamp": 1566888436,
      "txId": 5239810406,
      "type": "ROLL_OUT"
    },
    {
      "amount": "1.00000000",
      "asset": "EOS",
      "status": "CONFIRMED",
      "timestamp": 1566888403,
      "txId": 5239808703,
      "type": "ROLL_IN"
    }
  ],
  "total": 3
}

GET /sapi/v1/margin/transfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO
type STRING NO 划转类型: ROLL_IN, ROLL_OUT
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。 从 1开始。 默认:1
size LONG NO 默认:10 最大:100
archived STRING NO 默认: false. 查询6个月以前的数据,需要设为 true
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

查询借贷记录 (USER_DATA)

响应

{
  "rows": [
    {
        "isolatedSymbol": "BNBUSDT",     // 逐仓借贷 返回逐仓symbol;若是全仓返回""
        "asset": "BNB",
        "principal": "0.84624403",
        "timestamp": 1555056425000,
        "status": "CONFIRMED"   //one of PENDING (pending to execution), CONFIRMED (successfully loaned), FAILED (execution failed, nothing happened to your account);
    }
  ],
  "total": 1
}

GET /sapi/v1/margin/loan (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES
isolatedSymbol STRING NO 逐仓symbol
txId LONG NO tranId in POST /sapi/v1/margin/loan
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。 开始值 1。 默认:1
size LONG NO 默认:10 最大:100
archived STRING NO 默认: false. 查询6个月以前的数据,需要设为 true
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

查询还贷记录 (USER_DATA)

响应

{
     "rows": [
         {
                "isolatedSymbol": "BNBUSDT",     // 逐仓还款 返回逐仓symbol;若是全仓返回""
                "amount": "14.00000000",   //Total amount repaid
                "asset": "BNB",   
                "interest": "0.01866667",    //Interest repaid
                "principal": "13.98133333",   //Principal repaid
                "status": "CONFIRMED",   //one of PENDING (pending to execution), CONFIRMED (successfully loaned), FAILED (execution failed, nothing happened to your account)
                "timestamp": 1563438204000,
                "txId": 2970933056
         }
     ],
     "total": 1
}

GET /sapi/v1/margin/repay (HMAC SHA256)

权重 1

参数:

名称 类型 是否必需 描述
asset STRING YES
isolatedSymbol STRING NO 逐仓symbol
txId LONG NO 返回 /sapi/v1/margin/repay
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。开始值 1. 默认:1
size LONG NO 默认:10 最大:100
archived STRING NO 默认: false. 查询6个月以前的数据,需要设为 true
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

获取利息历史 (USER_DATA)

响应

{
    "rows":[
        {
            "isolatedSymbol": "BNBUSDT", / 返回逐仓symbol;若是全仓返回""margin
            "asset": "BNB",
            "interest": "0.02414667",
            "interestAccuredTime": 1566813600000,
            "interestRate": "0.01600000",
            "principal": "36.22000000",
            "type": "ON_BORROW"
        }
    ],
    "total": 1
}

GET /sapi/v1/margin/interestHistory (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO
isolatedSymbol STRING NO 逐仓symbol
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。 开始值 1. 默认:1
size LONG NO 默认:10 最大:100
archived STRING NO 默认: false. 查询6个月以前的数据,需要设为 true
recvWindow LONG NO 赋值不能大于 60000
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",
              "isIsolated": ture,         // 是否是逐仓
              "updatedTime": 1558941374745
          }
      ],
      "total": 1
  }

GET /sapi/v1/margin/forceLiquidationRec (HMAC SHA256)

权重: 1

参数:

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

查询全仓杠杆账户详情 (USER_DATA)

响应

{
      "borrowEnabled": true,
      "marginLevel": "11.64405625",
      "totalAssetOfBtc": "6.82728457",
      "totalLiabilityOfBtc": "0.58633215",
      "totalNetAssetOfBtc": "6.24095242",
      "tradeEnabled": true,
      "transferEnabled": true,
      "userAssets": [
          {
              "asset": "BTC",
              "borrowed": "0.00000000",
              "free": "0.00499500",
              "interest": "0.00000000",
              "locked": "0.00000000",
              "netAsset": "0.00499500"
          },
          {
              "asset": "BNB",
              "borrowed": "201.66666672",
              "free": "2346.50000000",
              "interest": "0.00000000",
              "locked": "0.00000000",
              "netAsset": "2144.83333328"
          },
          {
              "asset": "ETH",
              "borrowed": "0.00000000",
              "free": "0.00000000",
              "interest": "0.00000000",
              "locked": "0.00000000",
              "netAsset": "0.00000000"
          },
          {
              "asset": "USDT",
              "borrowed": "0.00000000",
              "free": "0.00000000",
              "interest": "0.00000000",
              "locked": "0.00000000",
              "netAsset": "0.00000000"
          }
      ]
}

GET /sapi/v1/margin/account (HMAC SHA256)

权重: 1

参数:

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

查询杠杆账户订单 (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",
   "isIsolated": true,       // 是否是逐仓symbol交易
   "time": 1562133008725,
   "timeInForce": "GTC",
   "type": "LIMIT",
   "updateTime": 1562133008725
}

GET /sapi/v1/margin/order (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
isIsolated STRING NO 是否逐仓杠杆,"TRUE", "FALSE", 默认 "FALSE"
orderId STRING 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",
       "isIsolated": true,       // 是否是逐仓symbol交易
       "time": 1562040170089,
       "timeInForce": "GTC",
       "type": "LIMIT",
       "updateTime": 1562040170089
    }
]

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

权重: 1

参数:

名称 类型 是否必需 描述
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",
          "isIsolated": false,       // 是否是逐仓symbol交易 
          "time": 1565769338806,
          "timeInForce": "GTC",
          "type": "TAKE_PROFIT_LIMIT",
          "updateTime": 1565769342148
      },
      {
          "clientOrderId": "gXYtqhcEAs2Rn9SUD9nRKx",
          "cummulativeQuoteQty": "0.00000000",
          "executedQty": "0.00000000",
          "icebergQty": "1.00000000",
          "isWorking": true,
          "orderId": 41296,
          "origQty": "6.65000000",
          "price": "0.18000000",
          "side": "SELL",
          "status": "CANCELED",
          "stopPrice": "0.00000000",
          "symbol": "BNBBTC",
          "isIsolated": false,       // 是否是逐仓symbol交易 
          "time": 1565769348687,
          "timeInForce": "GTC",
          "type": "LIMIT",
          "updateTime": 1565769352226
      }

]

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

权重: 1

访问限制
60次/分钟/IP

参数:

名称 类型 是否必需 描述
symbol STRING YES
isIsolated STRING NO 是否逐仓杠杆,"TRUE", "FALSE", 默认 "FALSE"
orderId LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO 默认 500;最大500.
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",
        "isIsolated": false,      // 是否是逐仓symbol交易
        "time": 1561973357171
    },
    {
        "commission": "0.00002950",
        "commissionAsset": "BTC",
        "id": 32,
        "isBestMatch": true,
        "isBuyer": false,
        "isMaker": true,
        "orderId": 39319,
        "price": "0.00590000",
        "qty": "5.00000000",
        "symbol": "BNBBTC",
        "isIsolated": false,      // 是否是逐仓symbol交易
        "time": 1561964645345
    }
]

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

权重: 1

参数:

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

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

响应

{
    "amount": "1.69248805", // 用户账户当前最多可以额度
    "borrowLimit": "60" // 平台限制的用户当前等级可以借的额度
}

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

权重: 5

参数:

名称 类型 是否必需 描述
asset STRING YES
isolatedSymbol STRING NO 逐仓交易对,适用于逐仓查询
recvWindow LONG NO 默认值不能大于 60000
timestamp LONG YES

查询最大可转出额 (USER_DATA)

响应

 {
      "amount": "3.59498107"
 }

GET /sapi/v1/margin/maxTransferable (HMAC SHA256)

权重: 5

参数:

名称 类型 是否必需 描述
asset STRING YES
isolatedSymbol STRING NO 逐仓交易对,适用于逐仓查询
recvWindow LONG NO 默认值不能大于 60000
timestamp LONG YES

创建杠杆逐仓账户 (MARGIN)

响应:

{
    "success": true,
    "symbol": "BTCUSDT"
}

POST /sapi/v1/margin/isolated/create (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
base STRING YES base aseet of symbol
quote STRING YES quote asset of symbol
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

杠杆逐仓账户划转 (MARGIN)

响应:

{
    //transaction id
    "tranId": 100000001
}

POST /sapi/v1/margin/isolated/transfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES 被划转的资产, 比如, BTC
symbol STRING YES 逐仓 symbol
transFrom STRING YES "SPOT", "ISOLATED_MARGIN"
transTo STRING YES "SPOT", "ISOLATED_MARGIN"
amount DECIMAL YES 划转数量
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

获取杠杆逐仓划转历史 (USER_DATA)

响应:

{
  "rows": [
    {
      "amount": "0.10000000",
      "asset": "BNB",
      "status": "CONFIRMED",
      "timestamp": 1566898617000,
      "txId": 5240372201,
      "transFrom": "SPOT",
      "transTo": "ISOLATED_MARGIN"
    },
    {
      "amount": "5.00000000",
      "asset": "USDT",
      "status": "CONFIRMED",
      "timestamp": 1566888436123,
      "txId": 5239810406,
      "transFrom": "ISOLATED_MARGIN",
      "transTo": "SPOT"
    }
  ],
  "total": 2
}

GET /sapi/v1/margin/isolated/transfer (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO
symbol STRING YES 逐仓 symbol
transFrom STRING NO "SPOT", "ISOLATED_MARGIN"
transTo STRING NO "SPOT", "ISOLATED_MARGIN"
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)

响应:

不传"symbols"的返回内容

{
   "assets":[
      {
        "baseAsset": 
          {
          "asset": "BTC",
          "borrowEnabled": true,
          "borrowed": "0.00000000",
          "free": "0.00000000",
          "interest": "0.00000000",
          "locked": "0.00000000",
          "netAsset": "0.00000000",
          "netAssetOfBtc": "0.00000000",
          "repayEnabled": true,
          "totalAsset": "0.00000000"
        },
        "quoteAsset": 
        {
          "asset": "USDT",
          "borrowEnabled": true,
          "borrowed": "0.00000000",
          "free": "0.00000000",
          "interest": "0.00000000",
          "locked": "0.00000000",
          "netAsset": "0.00000000",
          "netAssetOfBtc": "0.00000000",
          "repayEnabled": true,
          "totalAsset": "0.00000000"
        },
        "symbol": "BTCUSDT"
        "isolatedCreated": true, 
        "marginLevel": "0.00000000", 
        "marginLevelStatus": "EXCESSIVE", // "EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION"
        "marginRatio": "0.00000000",
        "indexPrice": "10000.00000000"
        "liquidatePrice": "1000.00000000",
        "liquidateRate": "1.00000000"
        "tradeEnabled": true
      }
    ],
    "totalAssetOfBtc": "0.00000000",
    "totalLiabilityOfBtc": "0.00000000",
    "totalNetAssetOfBtc": "0.00000000" 
}

传"symbols"的返回内容

{
   "assets":[
      {
        "baseAsset": 
        {
          "asset": "BTC",
          "borrowEnabled": true,
          "borrowed": "0.00000000",
          "free": "0.00000000",
          "interest": "0.00000000",
          "locked": "0.00000000",
          "netAsset": "0.00000000",
          "netAssetOfBtc": "0.00000000",
          "repayEnabled": true,
          "totalAsset": "0.00000000"
        },
        "quoteAsset": 
        {
          "asset": "USDT",
          "borrowEnabled": true,
          "borrowed": "0.00000000",
          "free": "0.00000000",
          "interest": "0.00000000",
          "locked": "0.00000000",
          "netAsset": "0.00000000",
          "netAssetOfBtc": "0.00000000",
          "repayEnabled": true,
          "totalAsset": "0.00000000"
        },
        "symbol": "BTCUSDT"
        "isolatedCreated": true, 
        "marginLevel": "0.00000000", 
        "marginLevelStatus": "EXCESSIVE", // "EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION"
        "marginRatio": "0.00000000",
        "indexPrice": "10000.00000000"
        "liquidatePrice": "1000.00000000",
        "liquidateRate": "1.00000000"
        "tradeEnabled": true
      }
    ]
}

GET /sapi/v1/margin/isolated/account (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
symbols STRING NO 最多可以传5个symbol; 由","分隔的字符串表示. e.g. "BTCUSDT,BNBUSDT,ADAUSDT"
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

查询逐仓杠杆交易对 (USER_DATA)

响应:

{
   "symbol":"BTCUSDT",
   "base":"BTC",
   "quote":"USDT",
   "isMarginTrade":true,
   "isBuyAllowed":true,
   "isSellAllowed":true      
}

GET /sapi/v1/margin/isolated/pair (HMAC SHA256)

权重: 1

参数:

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

获取所有逐仓杠杆交易对(USER_DATA)

响应:

[
    {
        "base": "BNB",
        "isBuyAllowed": true,
        "isMarginTrade": true,
        "isSellAllowed": true,
        "quote": "BTC",
        "symbol": "BNBBTC"     
    },
    {
        "base": "TRX",
        "isBuyAllowed": true,
        "isMarginTrade": true,
        "isSellAllowed": true,
        "quote": "BTC",
        "symbol": "TRXBTC"    
    }
]

GET /sapi/v1/margin/isolated/allPairs (HMAC SHA256)

权重: 1

参数:

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

现货交易和杠杆利息BNB抵扣开关(USER_DATA)

响应:

{
   "spotBNBBurn":true,
   "interestBNBBurn": false   
}

POST /sapi/v1/bnbBurn (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
spotBNBBurn STRING NO "true" or "false", 是否使用BNB支付现货交易的手续费
interestBNBBurn STRING NO "true" or "false", 是否使用BNB支付杠杆贷款的利息
recvWindow LONG NO 赋值不能大于 60000
timestamp LONG YES

获取BNB抵扣开关状态 (USER_DATA)

响应:

{
   "spotBNBBurn":true,
   "interestBNBBurn": false   
}

GET /sapi/v1/bnbBurn (HMAC SHA256)

权重: 1

参数:

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

Websocket账户信息推送

Listen Key(现货账户)

生成 Listen Key (USER_STREAM)

响应

{
  "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
}

POST /api/v3/userDataStream

开始一个新的数据流。除非发送 keepalive,否则数据流于60分钟后关闭。如果该帐户具有有效的listenKey,则将返回该listenKey并将其有效期延长60分钟。 权重: 1

参数:

NONE

延长 Listen Key 有效期 (USER_STREAM)

响应

{}

PUT /api/v3/userDataStream

有效期延长至本次调用后60分钟,建议每30分钟发送一个 ping 。

权重: 1

参数:

名称 类型 是否必需 描述
listenKey STRING YES

关闭 Listen Key (USER_STREAM)

响应

{}

DELETE /api/v3/userDataStream

关闭用户数据流。

权重: 1

参数:

名称 类型 是否必需 描述
listenKey STRING YES

Listen Key(杠杆账户)

生成 Listen Key (USER_STREAM)

响应

{"listenKey":  "T3ee22BIYuWqmvne0HNq2A2WsFlEtLhvWCtItw6ffhhdmjifQ2tRbuKkTHhr"}

POST /sapi/v1/userDataStream

权重: 1

参数:

NONE

延长 Lisen Key 有效期 (USER_STREAM)

响应

{}

PUT /sapi/v1/userDataStream

权重: 1

参数:

名称 类型 是否必需 描述
listenKey STRING YES

关闭 ListenKey (USER_STREAM)

响应

{}

DELETE /sapi/v1/userDataStream

权重: 1

参数:

名称 类型 是否必需 描述
listenKey STRING YES

Listen Key(逐仓杠杆账户)

生成 Listen Key (USER_STREAM)

响应:

{
    "listenKey":  "T3ee22BIYuWqmvne0HNq2A2WsFlEtLhvWCtItw6ffhhdmjifQ2tRbuKkTHhr"
}

POST /sapi/v1/userDataStream/isolated

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES

延长 Lisen Key 有效期 (USER_STREAM)

响应:

{}

PUT /sapi/v1/userDataStream/isolated

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
listenKey STRING YES

关闭 ListenKey (USER_STREAM)

响应:

{}

DELETE /sapi/v1/userDataStream/isolated

权重: 1

参数:

名称 类型 是否必需 描述
symbol STRING YES
listenKey STRING YES

Payload: 账户更新

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

Payload

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

outboundAccountInfo只推送余额不为0,以及余额刚变成0的资产。
对于余额刚变成0的资产,只会被推送一次,后面如果此资产还是0,不会再推送。
任何没有出现在outboundAccountInfo消息中的资产,应该被考虑为余额是0.

Payload

{
  "e": "outboundAccountInfo",   // 事件类型
  "E": 1499405658849,           // 事件时间
  "m": 0,                       // 挂单费率 (基点)
  "t": 0,                       // 吃单费率 (基点)
  "b": 0,                       // 买单费率(基点)
  "s": 0,                       // 卖单费率(基点)
  "T": true,                    // 是否允许交易
  "W": true,                    // 是否允许提现
  "D": true,                    // 是否允许充值
  "u": 1499405658848,           // 账户末次更新时间戳
  "B": [                        // 余额
    {
      "a": "LTC",               // 资产名称
      "f": "17366.18538083",    // 可用余额
      "l": "0.00000000"         // 冻结余额
    },
    {
      "a": "BTC",
      "f": "10537.85314051",
      "l": "2.19464093"
    },
    {
      "a": "ETH",
      "f": "17902.35190619",
      "l": "0.00000000"
    },
    {
      "a": "BNC",
      "f": "1114503.29769312",
      "l": "0.00000000"
    }
  ],
  "P": [                        // 权限
    "SPOT"
  ]
}

Payload: 余额更新

Payload

{
  "e": "balanceUpdate",         //Event Type
  "E": 1573200697110,           //Event Time
  "a": "ABC",                   //Asset
  "d": "100.00000000",          //Balance Delta
  "T": 1573200697068            //Clear Time
}

当下列情形发生时更新:

Payload: 订单更新

订单通过executionReport事件进行更新。

请查阅文档公开API参数以及以下文档,以获取相关的枚举定义。

通过将Z除以z可以找到平均价格。

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
  "I": 8641984,                  // 请忽略
  "w": true,                     // 订单是否在订单簿上?
  "m": false,                    // 该成交是作为挂单成交吗?
  "M": false,                    // 请忽略
  "O": 1499405658657,            // 订单创建时间
  "Z": "0.00000000",             // 订单累计已成交金额
  "Y": "0.00000000",              // 订单末次成交金额
  "Q": "0.00000000"              // Quote Order Qty
}

执行类型:

如果订单是OCO,则除了显示"executionReport"事件外,还将显示一个名为"ListStatus"的事件。

Payload

{
  "e": "listStatus",                // 事件类型
  "E": 1564035303637,               // 事件时间
  "s": "ETHBTC",                    // 交易对
  "g": 2,                           // OrderListId
  "c": "OCO",                       // Contingency Type
  "l": "EXEC_STARTED",              // List Status Type
  "L": "EXECUTING",                 // List Order Status
  "r": "NONE",                      // List 被拒绝的原因
  "C": "F4QN4G8DlFATFlIUQ0cjdD",    // List Client Order ID
  "T": 1564035303625,               // 成交时间
  "O": [                           
    {
      "s": "ETHBTC",                // 交易对
      "i": 17,                      // orderId
      "c": "AJYsMjErWJesZvqlJCTUgL" // clientOrderId
    },
    {
      "s": "ETHBTC",
      "i": 18,
      "c": "bfYPSQdLoqAJeNrOr9adzq"
    }
  ]
}

币安宝接口

获取活期产品列表 (USER_DATA)

响应:

[
    {
        "asset": "BTC",
        "avgAnnualInterestRate": "0.00250025",
        "canPurchase": true,
        "canRedeem": true,
        "dailyInterestPerThousand": "0.00685000",
        "featured": true,
        "minPurchaseAmount": "0.01000000",
        "productId": "BTC001",
        "purchasedAmount": "16.32467016",
        "status": "PURCHASING",
        "upLimit": "200.00000000",
        "upLimitPerUser": "5.00000000"
    },
    {
        "asset": "BUSD",
        "avgAnnualInterestRate": "0.01228590",
        "canPurchase": true,
        "canRedeem": true,
        "dailyInterestPerThousand": "0.03836000",
        "featured": true,
        "minPurchaseAmount": "0.10000000",
        "productId": "BUSD001",
        "purchasedAmount": "10.38932339",
        "status": "PURCHASING",
        "upLimit": "100000.00000000",
        "upLimitPerUser": "50000.00000000"
    }
]

GET /sapi/v1/lending/daily/product/list (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
status ENUM NO "ALL", "SUBSCRIBABLE", "UNSUBSCRIBABLE"; default "ALL"
featured STRING NO "ALL", "true"; default "ALL"
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

获取用户当日剩余活期可申购余额 (USER_DATA)

响应:

{
    "asset": "BUSD", 
    "leftQuota": "50000.00000000"
}

GET /sapi/v1/lending/daily/userLeftQuota (HMAC SHA256)

权重: 1

参数:

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

申购活期产品 (USER_DATA)

响应:

{
    "purchaseId": 40607
}

POST /sapi/v1/lending/daily/purchase (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
productId STRING YES
amount DECIMAL YES
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

获取用户当日活期可赎回余额 (USER_DATA)

响应:

{
    "asset": "USDT",
    "dailyQuota": "10000000.00000000",
    "leftQuota": "0.00000000",
    "minRedemptionAmount": "0.10000000"
}

GET /sapi/v1/lending/daily/userRedemptionQuota (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
productId STRING YES
type ENUM YES "FAST", "NORMAL"
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

赎回活期产品 (USER_DATA)

响应:

{}

POST /sapi/v1/lending/daily/redeem (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
productId STRING YES
amount DECIMAL YES
type ENUM YES "FAST", "NORMAL"
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

用户活期产品持仓 (USER_DATA)

响应:

[
    {
        "annualInterestRate": "0.02600000",
        "asset": "USDT",
        "avgAnnualInterestRate": "0.02599895",
        "canRedeem": true,
        "dailyInterestRate": "0.00007123",
        "freeAmount": "75.46000000",
        "freezeAmount": "0.00000000", // 弃用
        "lockedAmount": "0.00000000", // 弃用
        "productId": "USDT001",
        "productName": "USDT",
        "redeemingAmount": "0.00000000",
        "todayPurchasedAmount": "0.00000000",
        "totalAmount": "75.46000000",
        "totalInterest": "0.22759183"
    }
]

GET /sapi/v1/lending/daily/token/position (HMAC SHA256)

权重: 1

参数:

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

查询定期/活动产品列表 (USER_DATA)

响应:

[
    {
        "asset": "USDT",
        "displayPriority": 1,
        "duration": 90,
        "interestPerLot": "1.35810000",
        "interestRate": "0.05510000",
        "lotSize": "100.00000000",
        "lotsLowLimit": 1,
        "lotsPurchased": 74155,
        "lotsUpLimit": 80000,
        "maxLotsPerUser": 2000,
        "needKyc": False,
        "projectId": "CUSDT90DAYSS001",
        "projectName": "USDT",
        "status": "PURCHASING",
        "type": "CUSTOMIZED_FIXED",
        "withAreaLimitation": False
    }
]

GET /sapi/v1/lending/project/list (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING NO
type ENUM YES "CUSTOMIZED_FIXED"定期 , "ACTIVITY" 活动
status ENUM NO "ALL", "SUBSCRIBABLE", "UNSUBSCRIBABLE"; 默认 "ALL"
isSortAsc BOOLEAN NO 默认 "true"
sortBy ENUM NO "START_TIME", "LOT_SIZE", "INTEREST_RATE", "DURATION"; 默认 "START_TIME"
current LONG NO 分页页码. 默认:1
size LONG NO 单页显示条数,默认:10 最大:100
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

申购定期/活动产品 (USER_DATA)

响应:

{
    purchaseId: "18356"
}

POST /sapi/v1/lending/customizedFixed/purchase (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
projectId STRING YES
lot LONG YES 申购手数
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

用户定期/活动持仓 (USER_DATA)

响应:

[
    {
        "asset": "USDT",
        "canTransfer": True,
        "createTimestamp": 1587010770000,
        "duration": 14,
        "endTime": 1588291200000,
        "interest": "0.19950000",
        "interestRate": "0.05201250",
        "lot": 1,
        "positionId": 51724,
        "principal": "100.00000000",
        "projectId": "CUSDT14DAYSS001",
        "projectName": "USDT",
        "purchaseTime": 1587010771000,
        "redeemDate": "2020-05-01",
        "startTime": 1587081600000,
        "status": "HOLDING",
        "type": "CUSTOMIZED_FIXED"
    }
]

GET /sapi/v1/lending/project/position/list (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES
projectId STRING NO
status ENUM NO "HOLDING", "REDEEMED"
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

币安宝账户信息 (USER_DATA)

响应:

{
    "positionAmountVos": [
        {
            "amount": "75.46000000",
            "amountInBTC": "0.01044819",
            "amountInUSDT": "75.46000000",
            "asset": "USDT"
        },
        {
            "amount": "1.67072036",
            "amountInBTC": "0.00023163",
            "amountInUSDT": "1.67289230",
            "asset": "BUSD"
        }
    ],
    "totalAmountInBTC": "0.01067982",
    "totalAmountInUSDT": "77.13289230",
    "totalFixedAmountInBTC": "0.00000000",
    "totalFixedAmountInUSDT": "0.00000000",
    "totalFlexibleInBTC": "0.01067982",
    "totalFlexibleInUSDT": "77.13289230"
 }

GET /sapi/v1/lending/union/account (HMAC SHA256)

权重: 1

参数:

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

获取申购记录 (USER_DATA)

响应:

活期产品

[
    {
        "amount": "100.00000000",
        "asset": "USDT",
        "createTime": 1575018510000,
        "lendingType": "DAILY",
        "productName": "USDT",
        "purchaseId": 26055,
        "status": "SUCCESS"
    }
]

定期/活动产品

[
    {
        "amount": "100.00000000",
        "asset": "USDT",
        "createTime": 1575018453000,
        "lendingType": "ACTIVITY",
        "lot": 1,
        "productName": "【Special】USDT 7D (8%)",
        "purchaseId": 36857,
        "status": "SUCCESS"
    },
    {
        "amount": "100.00000000",
        "asset": "USDT",
        "createTime": 1587010770000,
        "lendingType": "CUSTOMIZED_FIXED",
        "lot": 1,
        "productName": "USDT",
        "purchaseId": 55841,
        "status": 'SUCCESS'
    }
]

GET /sapi/v1/lending/union/purchaseRecord (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
lendingType ENUM YES "DAILY" 表示活期, "ACTIVITI" 表示活动, "CUSTOMIZED_FIXED" 表示定期
asset STRING NO
startTime LONG NO
endTime LONG NO
current LONG NO Currently querying page. Start from 1. Default:1
size LONG NO Default:10, Max:100
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

获取赎回记录 (USER_DATA)

响应:

活期产品

[
    {
        "amount": "10.54000000",
        "asset": "USDT",
        "createTime": 1577257222000,
        "principal": "10.54000000",
        "projectId": "USDT001",
        "projectName": "USDT",
        "status": "PAID",
        "type": "FAST"
     }
]

定期/活动产品

[
    {
        "amount": "0.07070000",
        "asset": "USDT",
        "createTime": 1566200161000,
        "interest": "0.00070000",
        "principal": "0.07000000",
        "projectId": "test06",
        "projectName": "USDT 1 day (10% anniualized)",
        "startTime": 1566198000000,
        "status": "PAID"
     }
]

GET /sapi/v1/lending/union/redemptionRecord (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
lendingType ENUM YES "DAILY" 表示活期, "ACTIVITI" 表示活动, "CUSTOMIZED_FIXED" 表示定期
asset STRING NO
startTime LONG NO
endTime LONG NO
current LONG NO Currently querying page. Start from 1. Default:1
size LONG NO Default:10, Max:100
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

获取利息历史 (USER_DATA)

响应:

[
    {
        "asset": "BUSD",
        "interest": "0.00006408",
        "lendingType": "DAILY",
        "productName": "BUSD",
        "time": 1577233578000
    },
    {
        "asset": "USDT",
        "interest": "0.00687654",
        "lendingType": "DAILY",
        "productName": "USDT",
        "time": 1577233562000
    }
]

GET /sapi/v1/lending/union/interestHistory (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
lendingType ENUM YES "DAILY" 表示活期, "ACTIVITY" 表示活动, "CUSTOMIZED_FIXED" 表示定期
asset STRING NO
startTime LONG NO
endTime LONG NO
current LONG NO Currently querying page. Start from 1. Default:1
size LONG NO Default:10, Max:100
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

定期/活动持仓转活期持仓 (USER_DATA)

响应:


{
    "dailyPurchaseId": 862290,
    "success": true,    
    "time": 1577233578000
 },

POST /sapi/v1/lending/positionChanged (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
projectId STRING YES
lot LONG YES
positionId LONG NO
recvWindow LONG NO 不能大于 60000
timestamp LONG YES

矿池接口

获取算法(MARKET_DATA)

响应:

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "algoName": "sha256",                        //  算法名称
      "algoId": 1,                                 // 算法id
      "poolIndex": 0,                               // 序列 
      "unit": "h/s"                                //   单位
    }
  ]
}

GET /sapi/v1/mining/pub/algoList

权重:
1
参数:

获取币种(MARKET_DATA)

响应:

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "coinName": "BTC",                      //  币种名称
      "coinId": 1,                            // id
      "poolIndex": 0,                         // 排序
      "algoId": 1,                            // 所属算法
      "algoName": "sha256"                    //所属算法名称
    }
  ]
}

GET /sapi/v1/mining/pub/coinList

权重:
1
参数:

请求矿工列表明细 (USER_DATA)

响应:

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "workerName": "bhdc1.16A10404B",     //挖矿用户名
      "type": "H_hashrate",               // 小时算力类型
      "hashrateDatas": [
        {
          "time": 1587902400000,         //  时间
          "hashrate": "0",               // 算力 
          "reject": 0                    //拒绝率
        },
        {
          "time": 1587906000000,
          "hashrate": "0",
          "reject": 0
        },
        .......
      ]
    },
    {
      "workerName": "bhdc1.16A10404B",    //挖矿用户名
      "type": "D_hashrate",                //日均算力类型
      "hashrateDatas": [
        {
          "time": 1587902400000,          //  时间
          "hashrate": "0",                // 算力 
          "reject": 0                     //拒绝率
        },
        {
          "time": 1587906000000,
          "hashrate": "0",
          "reject": 0
        },
        .......
      ]
    }
  ]
}

GET /sapi/v1/mining/worker/detail (HMAC SHA256)

权重: 5

参数:

Name Type Mandatory Description 例子
algo STRING YES 算法名称(sha256) sha256
userName STRING YES 挖矿用户名 test
workerName STRING YES 矿工用户名,必传 bhdc1.16A10404B

请求矿工列表 (USER_DATA)

响应:

{
  "code": 0,
  "msg": "",
  "data": {
    "workerDatas": [
      {
        "workerId": "1420554439452400131",  //矿工id
        "workerName": "2X73",               //矿工姓名  
        "status": 3,                        // 状态:1 有效, 2 无效, 3 失效
        "hashRate": 0,                      // 实时速率
        "dayHashRate": 0,                   //日均算力
        "rejectRate": 0,                    //实时拒绝率
        "lastShareTime": 1587712919000      // 最后提交时间  
      },
      {
        "workerId": "7893926126382807951",
        "workerName": "AZDC1.1A10101",
        "status": 2,
        "hashRate": 29711247541680,
        "dayHashRate": 12697781298013.66,
        "rejectRate": 0,
        "lastShareTime": 1587969727000
      },
     ......
    ],
    "totalNum": 18530,           // 总数量
    "pageSize": 20               // 每页条数
  }
}

GET /sapi/v1/mining/worker/list (HMAC SHA256)

权重: 5

参数:

Name Type Mandatory Description 例子
algo STRING YES 算法名称(sha256) sha256
userName STRING YES 挖矿用户名 test
pageIndex INTEGER NO 页码,为空默认第一页,从1开始
sort INTEGER NO 排序方向(为空默认为0): 0 正序,1 倒序
sortColumn INTEGER NO 排序字段(默认为1):
1: 根据矿工名称排序,
2: 根据实时算力排序,
3: 根据日均算力排序,
4: 根据实时拒绝率排序,5最后提交时间
workerStatus INTEGER NO 矿机状态(默认为0):0 全部,1 有效, 2 无效, 3 失效

收益列表 (USER_DATA)

响应:

{
  "code": 0,
  "msg": "",
  "data": {
    "accountProfits": [
      {
        "time": 1586188800000,            // 时间
        "dayHashRate": 129129903378244,  // 算力
        "profitAmount": 8.6083060304,   //奖励数量
        "coinName":"BTC",              // 奖励币种
        "status": 2    //支付状态:0:待支付, 1:支付中  2:已支付
      },
      {
        "time": 1586102400000,
        "dayHashRate": 129253700243001,
        "profitAmount": 30.8638644339,
        "coinName":"BTC",
        "status": 2
      },
      {
        "time": 1586102400000,
        "dayHashRate": 130393934523657,
        "profitAmount": 29.699802832,
        "coinName":"BTC",
        "status": 2
      }
    ],
    "totalNum": 3,          // 总条数
    "pageSize": 20          // 每页数量
  }
}

GET /sapi/v1/mining/payment/list (HMAC SHA256)

权重: 5

参数:

Name Type Mandatory Description 例子
algo STRING YES 算法名称(sha256) sha256
userName STRING YES 挖矿用户名 test
coin STRING NO 币种名称
startDate Long NO 搜索日期 毫秒时间戳,同时为空查询所有
endDate Long NO 搜索日期 毫秒时间戳,同时为空查询所有
pageIndex INTEGER NO 页码,为空默认第一页,从1开始

统计列表 (USER_DATA)

响应:

{
  "code": 0,
  "msg": "",
  "data": {
    "fifteenMinHashRate": "457835490067496409.00000000",          // 15分钟算力
    "dayHashRate": "214289268068874127.65000000",                 //  日均算力
    "validNum": 0,                                                // 有效数量
    "invalidNum": 17562,                                          // 无效数量
    "profitToday":{                                              // 今日预估
      "BTC":"0.00314332",       
      "BSV":"56.17055953",
      "BCH":"106.61586001"
     },
    "profitYesterday":{                                       //  昨日收益
      "BTC":"0.00314332",
       "BSV":"56.17055953",
       "BCH":"106.61586001"
     },

    "userName": "test",                                    // 挖矿账户
    "unit": "h/s",                                        //  算力单位
    "algo": "sha256"                                      // 所属算法
  }
}

GET /sapi/v1/mining/statistics/user/status (HMAC SHA256)

权重: 5

参数:

Name Type Mandatory Description 例子
algo STRING YES 算法名称(sha256) sha256
userName STRING YES 挖矿用户名 test

账号列表 (USER_DATA)

响应:

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "type": "H_hashrate",        //小时算力类型
      "userName": "test",         // 账户名
      "list": [
        {
          "time": 1585267200000,    // 时间
          "hashrate": "0.00000000", // 算力
          "reject": "0.00000000"    //拒绝率
        },
        {
          "time": 1585353600000,
          "hashrate": "0.00000000",
          "reject": "0.00000000"
        }
        ......
      ]
    },
    {
      "type": "D_hashrate",        //日均算力类型
      "userName": "test",          // 账户名
      "list": [
        {
          "time": 1587906000000,     // 时间
          "hashrate": "0.00000000", // 算力
          "reject": "0.00000000"    //拒绝率
        },
        {
          "time": 1587909600000,
          "hashrate": "0.00000000",
          "reject": "0.00000000"
        }    ......
      ]
    }
  ]
}

GET /sapi/v1/mining/statistics/user/list (HMAC SHA256)

权重: 5

参数:

Name Type Mandatory Description 例子
algo STRING YES 算法名称(sha256) sha256
userName STRING YES 挖矿用户名 test

合约接口

合约资金划转 (USER_DATA)

响应:

{
    "tranId": 100000001    // 划转 ID 
}

POST /sapi/v1/futures/transfer (HMAC SHA256)

执行现货账户与合约账户之间的划转

权重: 1

参数:

名称 类型 是否必需 描述
asset STRING YES The asset being transferred, e.g., USDT
amount DECIMAL YES The amount to be transferred
type INT YES 1: 现货账户向USDT合约账户划转
2: USDT合约账户向现货账户划转
3: 现货账户向币本位合约账户划转
4: 币本位合约账户向现货账户划转
recvWindow LONG NO
timestamp LONG YES

获取合约资金划转历史 (USER_DATA)

响应:

{
  "rows": [
    {
      "asset": "USDT",          // 资产
      "tranId": 100000001,      // 划转ID         
      "amount": "40.84624400",  // 数量
      "type": "1",              // 划转方向: 1( 现货向USDT本位合约), 2( USDT本位合约向现货), 3( 现货向币本位合约), and 4( 币本位合约向现货)
      "timestamp": 1555056425000,   // 时间戳
      "status": "CONFIRMED"         // PENDING (等待执行), CONFIRMED (成功划转), FAILED (执行失败);
    }
  ],
  "total": 1
}

GET /sapi/v1/futures/transfer (HMAC SHA256)

权重: 5

参数:

名称 类型 是否必需 描述
asset STRING YES
startTime LONG YES
endTime LONG NO
current LONG NO 当前页面. 起始计数为1. 默认值1
size LONG NO 单叶数据条目数,默认:10 最大:100
recvWindow LONG NO
timestamp LONG YES

混合保证金借款 (TRADE)

响应:

{
    "coin": "USDT",
    "amount": "4.50000000",
    "collateralCoin": "BUSD",
    "collateralAmount": "5.00000000",
    "time": 1582540328433,
    "borrowId": "438648398970089472"
}

POST /sapi/v1/futures/loan/borrow (HMAC SHA256)

参数:

名称 类型 是否必需 描述
coin STRING YES
amount DECIMAL YES when collateralAmount is empty
collateralCoin STRING YES
collateralAmount DECIMAL YES when amount is empty
recvWindow LONG NO
timestamp LONG YES

Rate Limit:
每个账户最多每秒一次

混合保证金借款历史 (USER_DATA)

响应:

{
    "rows":[
        {
            "confirmedTime": 1582540328433,
            "coin": "USDT",
            "collateralRate": "0.89991001",  // collateralLevel
            "leftTotal": "4.5",
            "leftPrincipal": "4.5",
            "deadline": 4736102399000,
            "collateralCoin": "BUSD",
            "collateralAmount": "5.0",
            "orderStatus": "PENDING",
            "borrowId": "438648398970089472"
        }
    ],
    "total": 1
}

GET /sapi/v1/futures/loan/borrow/history (HMAC SHA256)

参数:

名称 类型 是否必需 描述
coin STRING NO
startTime LONG NO
endTime LONG NO
limit LONG NO default 500, max 1000
recvWindow LONG NO
timestamp LONG YES

权重: 1

混合保证金还款 (TRADE)

响应:

{
    "coin": "USDT",
    "amount": "1.68",
    "collateralCoin": "BUSD",
    "repayId": "439659223998894080"
}

POST /sapi/v1/futures/loan/repay (HMAC SHA256)

参数:

名称 类型 是否必需 描述
coin STRING YES
collateralCoin STRING YES
amount DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

Rate Limit: 每个账户最多每秒一次

混合保证金还款历史 (USER_DATA)

相应:

{
    "rows": [
        {
            "coin": "USDT",
            "amount": "1.68",
            "collateralCoin": "BUSD",
            "repayType": "NORMAL",    // "COLLATERAL" 则为抵押物还款
            "releasedCollateral": "1.80288889",
            "price": "1.001",    // 借贷/抵押物还款兑换价格比率
            "repayCollateral": "10010",    // 抵押物还款所用抵押物量
            "confirmedTime": 1582781327575,
            "updateTime": 1582794387516,    // 时间
            "status": "PENDING",
            "repayId": "439659223998894080"
        }
    ],
    "total": 1
}

GET /sapi/v1/futures/loan/repay/history HMAC SHA256)

参数:

名称 类型 是否必需 描述
coin STRING NO
startTime LONG NO
endTime LONG NO
limit LONG NO default 500, max 1000
recvWindow LONG NO
timestamp LONG YES

权重: 1

混合保证金钱包 (USER_DATA)

响应:

{
    "totalCrossCollateral":"5.8238577133",
    "totalBorrowed":"5.07000000",
    "totalInterest":"0.0",   // 混合保证金总利息
    "asset": "USDT",
    "crossCollaterals":[
        {
            "collateralCoin":"BUSD",
            "locked":"5.82211108",
            "loanAmount": "5.07",
            "currentCollateralRate": "0.87168984",   // collateralLevel
            "principalForInterest": "0.0",    // 混合保证金利息计算所用本金
            "interest": "0.0"    // 混合保证金利息
        },
        {
            "collateralCoin":"BTC",
            "locked":"0",
            "loanAmount": "0",
            "currentCollateralRate": "0",   // collateralLevel
            "principalForInterest": "0.0",    // 混合保证金利息计算所用本金
            "interest": "0.0"    // 混合保证金利息
        }
    ]
}

GET /sapi/v1/futures/loan/wallet (HMAC SHA256)

参数:

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

权重: 1

混合保证金信息 (USER_DATA)

响应:

[
    {
        "collateralCoin": "BUSD",
        "rate": "0.9",
        "marginCallCollateralRate": "0.95",
        "liquidationCollateralRate": "0.98",
        "currentCollateralRate": "0.87168984",
        "interestRate": "0.0",    // 混合保证金利率
        "interestGracePeriod": "0"    // 混合保证金免息期,天
    }
]

GET /sapi/v1/futures/loan/configs (HMAC SHA256)

参数:

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

权重: 1

计算调整后的混合保证金质押率(USER_DATA)

响应:

{
    "afterCollateralRate":"0.89736451"
}

GET /sapi/v1/futures/loan/calcAdjustLevel (HMAC SHA256)

参数:

名称 类型 是否必需 描述
collateralCoin STRING YES
amount DECIMAL YES
direction ENUM YES "ADDITIONAL", "REDUCED"
recvWindow LONG NO
timestamp LONG YES

权重: 1

可供调整混合保证金质押率的最大额(USER_DATA)

响应:

{
    "maxInAmount": "9.97109038",
    "maxOutAmount": "0.50952693"
}

GET /sapi/v1/futures/loan/calcMaxAdjustAmount (HMAC SHA256)

参数:

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

权重: 1

调整混合保证金质押率 (TRADE)

响应:

{
    "collateralCoin": "BUSD",
    "direction": "ADDITIONAL",
    "amount": "5.00000000",
    "time": 1583540328433
}

POST /sapi/v1/futures/loan/adjustCollateral (HMAC SHA256)

参数:

名称 类型 是否必需 描述
collateralCoin STRING YES
amount DECIMAL YES
direction ENUM YES "ADDITIONAL", "REDUCED"
recvWindow LONG NO
timestamp LONG YES

RateLimit: 每个账户最多每秒一次

混合保证金调整质押率历史 (USER_DATA)

响应:

{ 
    "rows":[
        {
            "amount": ".17398184".
            "collateralCoin": "BUSD", 
            "coin": "USDT", 
            "preCollateralRate":"0.87054861",
            "afterCollateralRate":"0.89736451",
            "direction": "REDUCED",
            "status": "COMPLETED",
            "adjustTime": 1583978243588
        }
    ],
    "total": 1
}

GET /sapi/v1/futures/loan/adjustCollateral/history (HMAC SHA256)

参数:

Name Type Mandatory Description
collateralCoin STRING NO
startTime LONG NO
endTime LONG NO
limit LONG NO default 500, max 1000
recvWindow LONG NO
timestamp LONG YES

权重: 1

混合保证金强平历史 (USER_DATA)

响应:

{
    "rows":[
        {
            "collateralAmountForLiquidation":"10.12345678",
            "collateralCoin": "BUSD",
            "forceLiquidationStartTime": 1583978243588,
            "coin": "USDT", 
            "restCollateralAmountAfterLiquidation": "15.12345678",
            "restLoanAmount": "11.12345678",
            "status": "PENDING"
        }
    ],
    "total": 1
}

GET /sapi/v1/futures/loan/liquidationHistory (HMAC SHA256)

参数:

名称 类型 是否必需 描述
collateralCoin STRING NO
startTime LONG NO
endTime LONG NO
limit LONG NO default 500, max 1000
recvWindow LONG NO
timestamp LONG YES

权重: 1

混合保证金抵押物还款上下限 (USER_DATA)

查询混合保证金以抵押物还款的上下限

响应:

{
    "coin": "USDT",
    "collateralCoin": "BTC",
    "max": "15000",
    "min": "15"
}

GET /sapi/v1/futures/loan/collateralRepayLimit (HMAC SHA256)

参数:

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

权重: 1

获取混合保证金抵押物还款兑换比率 (USER_DATA)

混合保证金以抵押物还款前需先获取兑换比率得到 quoteId 才能请求以抵押物还款,兑换比率有效期为 25 秒

响应:

{
    "coin": "USDT",
    "collateralCoin": "BTC",
    "amount": "0.00222",
    "quoteId": "8a03da95f0ad4fdc8067e3b6cde72423"
}

GET /sapi/v1/futures/loan/collateralRepay (HMAC SHA256)

参数:

名称 类型 是否必需 描述
coin STRING YES
collateralCoin STRING YES
amount DECIMAL YES 还款量
recvWindow LONG NO
timestamp LONG YES

权重: 1

混合保证金抵押物还款 (TRADE)

混合保证金以抵押物还款前需先获取兑换比率得到 quoteId 才能请求以抵押物还款,兑换比率有效期为 25 秒

响应:

{
    "coin": "USDT",
    "collateralCoin": "BTC",
    "amount": "30",
    "quoteId": "3eece81ca2734042b2f538ea0d9cbdd3"
}

POST /sapi/v1/futures/loan/collateralRepay (HMAC SHA256)

参数:

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

权重: 1

混合保证金抵押物还款结果 (USER_DATA)

查询混合保证金抵押物还款结果

响应:

{
    "quoteId": "3eece81ca2734042b2f538ea0d9cbdd3",
    "status": "SUCCESS"
}

GET /sapi/v1/futures/loan/collateralRepayResult (HMAC SHA256)

参数:

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

权重: 1

混合保证金利息收取历史 (USER_DATA)

响应:

{
    "rows":[
        {
            "collateralCoin": "BUSD",
            "interestCoin": "USDT",
            "interest": "2.354",
            "principalForInterest": "10000",
            "interestRate": "0.002",
            "time": 1582794387516
        }
    ],
    "total": 1
}

GET /sapi/v1/futures/loan/interestHistory (HMAC SHA256)

参数:

名称 类型 是否必需 描述
collateralCoin STRING NO
startTime LONG NO
endTime LONG NO
current LONG NO 当前查询页。 开始值 1。 默认:1
limit LONG NO 默认 500,最大 1000
recvWindow LONG NO
timestamp LONG YES

权重: 1

杠杆代币接口

杠杆代币信息 (MARKET_DATA)

响应:

[  
  {
    "tokenName": "BTCDOWN",  
    "description": "3X Short Bitcoin Token",
    "underlying": "BTC",
    "tokenIssued": "717953.95",
    "basket": "-821.474 BTCUSDT Futures",
    "nav": "4.79",
    "realLeverage": "-2.316",
    "fundingRate": "0.001020",
    "dailyManagementFee": "0.0001",
    "timstamp":1583127900000  
  },
  {
    "tokenName": "LINKUP",  
    "description": "3X LONG ChainLink Token",
    "underlying": "LINK",
    "tokenIssued": "163846.99",
    "basket": "417288.870 LINKUSDT Futures",
    "nav": "9.60",
    "realLeverage": "2.597",
    "fundingRate": "-0.000917",
    "dailyManagementFee": "0.0001",
    "timstamp":1583127900000  
  },
 ]

GET /sapi/v1/blvt/tokenInfo

权重: 1

参数:

名称 类型 是否必需 描述
tokenName STRING NO BTCDOWN, BTCUP

杠杆代币历史净值K线

杠杆代币净值系统基于合约架构,故该接口采用fapi

请前往这里查看相关接口,并按照fapi使用规范操作。

申购代币 (USER_DATA)

响应:

 {
    "id": 123,  
    "status": "S", // S, P, F 分别表示 "success", "pending", "failure"
    "tokenName": "LINKUP",
    "amount": "0.95590905", // 申购代币数量
    "cost": "9.99999995", // 申购金额
    "timstamp":1600249972899  
 }

POST /sapi/v1/blvt/subscribe (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
tokenName STRING YES BTCDOWN, BTCUP
cost DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

查询申购记录 (USER_DATA)

响应:

[  
  {
    "id": 1,  
    "tokenName": "LINKUP",
    "amount": "0.54216292", 
    "nav": "18.42621386",  // usdt计价的申购净值
    "fee": "0.00999000", // usdt计价的申购费用
    "totalCharge": "9.99999991", //usdt计价的申购总金额
    "timstamp":1599127217916  
  }
]

GET /sapi/v1/blvt/subscribe/record (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
tokenName STRING NO BTCDOWN, BTCUP
id LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO 默认 1000, 最大 1000
recvWindow LONG NO
timestamp LONG YES

赎回代币 (USER_DATA)

响应:

 {
    "id": 123,  
    "status": "S", // S, P, F 分别表示 "success", "pending", "failure"
    "tokenName": "LINKUP",
    "redeemAmount": "0.95590905",       // 赎回代币数量
    "amount": "10.05022099",    // usdt计价的赎回金额
    "timstamp":1600250279614  
 }

POST /sapi/v1/blvt/redeem (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
tokenName STRING YES BTCDOWN, BTCUP
amount DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

查询赎回记录 (USER_DATA)

响应:

[  
  {
    "id": 1,  
    "tokenName": "LINKUP",
    "amount": "0.54216292", // 赎回数量
    "nav": "18.36345064",  // usdt计价的赎回净值
    "fee": "0.00995598", // usdt计价的赎回费用
    "netProceed": "9.94602604", // usdt计价的净赎回金额
    "timstamp":1599128003050  
  }
]

GET /sapi/v1/blvt/redeem/record (HMAC SHA256)

权重: 1

参数:

名称 类型 是否必需 描述
tokenName STRING NO BTCDOWN, BTCUP
id LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO 默认 1000, 最大 1000
recvWindow LONG NO
timestamp LONG YES

Websocket 杠杆代币信息更新

杠杆代币净值系统基于合约架构,故该推送采用合约WS服务。

请前往这里查看相关接口,并按照fstream 或 fstream3 使用规范操作。

Websocket 杠杆代币净值K线更新

杠杆代币净值系统基于合约架构,故该推送采用合约WS服务。

请前往这里查看相关接口,并按照fstream 或 fstream3 使用规范操作。

币安挖矿接口

获取所有流动资金池 (MARKET_DATA)

响应:

[
    {
        "poolId": 2,
        "poolName": "BUSD/USDT",
        "assets": [
            "BUSD",
            "USDT"
        ]
    },
    {
        "poolId": 3,
        "poolName": "BUSD/DAI",
        "assets": [
            "BUSD",
            "DAI"
        ]
    },
    {
        "poolId": 4,
        "poolName": "USDT/DAI",
        "assets": [
            "USDT",
            "DAI"
        ]
    }
]

GET /sapi/v1/bswap/pools

获取币安挖矿产品中所有资金池

权重: 1

参数:

获取流动资金池具体信息 (USER_DATA)

响应:

[
    {
        "poolId": 2,
        "poolNmae": "BUSD/USDT",
        "updateTime": 1565769342148,
        "liquidity": {
            "BUSD": 100000315.79,
            "USDT": 99999245.54
        },
        "share": {
            "shareAmount": 12415,
            "sharePercentage": 0.00006207,
            "asset": {
                "BUSD": 6207.02,
                "USDT": 6206.95
            }
        }
    }
]

GET /sapi/v1/bswap/liquidity (HMAC SHA256)

获取某个流动资金池具体信息

权重:

1 单一池

10 poolId 参数缺失

参数:

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

添加流动性 (TRADE)

响应:

{
    "operationId": 12341
}

POST /sapi/v1/bswap/liquidityAdd (HMAC SHA256)

向某个资金池添加流动性

权重: 2

参数:

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

移除流动性 (TRADE)

响应:

{
    "operationId": 12341
}

POST /sapi/v1/bswap/liquidityRemove (HMAC SHA256)

从某个资金池移除流动性,type 包含 SINGLECOMBINATION,如果是单币种移除则 asset 参数为必需

权重: 2

参数:

名称 类型 是否必需 描述
poolId LONG YES
type STRING YES SINGLE 为以单币种移出, COMBINATION 为以池中所有币种按比例移出
asset LIST YES
shareAmount DECIMAL YES Mandatory for liquidity removal
recvWindow LONG NO
timestamp LONG YES

获取流动性操作记录 (USER_DATA)

响应:

[
    {
        "operationId": 12341,
        "poolId": 2,
        "poolName": "BUSD/USDT",
        "operation": "ADD", // "ADD" or "REMOVE"
        "status": 1, // 0: pending, 1: success, 2: failed 
        "updateTime": 1565769342148,
        "shareAmount": "10.1"
    }
]

GET /sapi/v1/bswap/liquidityOps (HMAC SHA256)

获取流动性操作(添加/移除)记录

权重: 2

参数:

名称 类型 是否必需 描述
operationId LONG NO
poolId LONG NO
operation ENUM NO ADDREMOVE
startTime LONG NO
endTime LONG NO
limit LONG NO 默认 3, 最大 100
recvWindow LONG NO
timestamp LONG YES

获取报价 (USER_DATA)

响应:

{
    "quoteAsset": "USDT",
    "baseAsset": "BUSD",
    "quoteQty": 300000,
    "baseQty": 299975,
    "price": 1.00008334,
    "slippage": 0.00007245,
    "fee": 120
}

GET /sapi/v1/bswap/quote (HMAC SHA256)

通过传入计价币(卖出币)与交易币(买入币)获取报价,即给定量的兑换汇率。quoteQty 为卖出币数量。注意该报价为参考,实际会随流动性变动而变化,推荐在获取报价之后立刻进行兑换交易以避免滑点变化过大。

权重: 2

参数:

名称 类型 是否必需 描述
quoteAsset STRING YES
baseAsset STRING YES
quoteQty DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

交易 (TRADE)

响应:

{
    "swapId": 2314
}

POST /sapi/v1/bswap/swap (HMAC SHA256)

交易,即兑换 quoteAssetbaseAsset

权重: 2

参数:

名称 类型 是否必需 描述
quoteAsset STRING YES
baseAsset STRING YES
quoteQty DECIMAL YES
recvWindow LONG NO
timestamp LONG YES

获取交易记录 (USER_DATA)

响应:

[
    {
        "swapId": 2314,
        "swapTime": 1565770342148,
        "status": 0, // 0: pending, 1: success, 2: failed 
        "quoteAsset": "USDT",
        "baseAsset": "BUSD",
        "quoteQty": 300000,
        "baseQty": 299975,
        "price": 1.00008334,
        "fee": 120
    }
]

GET /sapi/v1/bswap/swap (HMAC SHA256)

获取交易历史记录。

权重: 1

参数:

名称 类型 是否必需 描述
swapId LONG NO
startTime LONG NO
endTime LONG NO
status INT NO 0: 交易中, 1: 交易成功, 2: 交易失败
quoteAsset STRING NO
baseAsset STRING NO
limit LONG NO 默认 3, 最大 100
recvWindow LONG NO
timestamp LONG YES

错误代码

错误JSON格式:

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

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

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

-1000 UNKNOWN

-1001 DISCONNECTED

-1002 UNAUTHORIZED

-1003 TOO_MANY_REQUESTS

-1004 SERVER_BUSY

-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

-1099 Not found, authenticated, or authorized

11xx - 2xxx Request issues

-1100 ILLEGAL_CHARS

-1101 TOO_MANY_PARAMETERS

-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED

-1103 UNKNOWN_PARAM

-1104 UNREAD_PARAMETERS

-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

-1131 BAD_RECV_WINDOW

-2010 NEW_ORDER_REJECTED

-2011 CANCEL_REJECTED

-2013 NO_SUCH_ORDER

-2014 BAD_API_KEY_FMT

-2015 REJECTED_MBX_KEY

-2016 NO_TRADING_WINDOW

3xxx-5xxx SAPI 具体问题

-3000 INNER_FAILURE

-3001 NEED_ENABLE_2FA

-3002 ASSET_DEFICIENCY

-3003 NO_OPENED_MARGIN_ACCOUNT

-3004 TRADE_NOT_ALLOWED

-3005 TRANSFER_OUT_NOT_ALLOWED

-3006 EXCEED_MAX_BORROWABLE

-3007 HAS_PENDING_TRANSACTION

-3008 BORROW_NOT_ALLOWED

-3009 ASSET_NOT_MORTGAGEABLE

-3010 REPAY_NOT_ALLOWED

-3011 BAD_DATE_RANGE

-3012 ASSET_ADMIN_BAN_BORROW

-3013 LT_MIN_BORROWABLE

-3014 ACCOUNT_BAN_BORROW

-3015 REPAY_EXCEED_LIABILITY

-3016 LT_MIN_REPAY

-3017 ASSET_ADMIN_BAN_MORTGAGE

-3018 ACCOUNT_BAN_MORTGAGE

-3019 ACCOUNT_BAN_ROLLOUT

-3020 EXCEED_MAX_ROLLOUT

-3021 PAIR_ADMIN_BAN_TRADE

-3022 ACCOUNT_BAN_TRADE

-3023 WARNING_MARGIN_LEVEL

-3024 FEW_LIABILITY_LEFT

-3025 INVALID_EFFECTIVE_TIME

-3026 VALIDATION_FAILED

-3027 NOT_VALID_MARGIN_ASSET

-3028 NOT_VALID_MARGIN_PAIR

-3029 TRANSFER_FAILED

-3036 ACCOUNT_BAN_REPAY

-3037 PNL_CLEARING

-3038 LISTEN_KEY_NOT_FOUND

-3041 BALANCE_NOT_CLEARED

-3042 PRICE_INDEX_NOT_FOUND

-3043 TRANSFER_IN_NOT_ALLOWED

-3044 SYSTEM_BUSY

-3999 NOT_WHITELIST_USER

-4001 CAPITAL_INVALID

-4002 CAPITAL_IG

-4003 CAPITAL_IEV

-4004 CAPITAL_UA

-4005 CAPAITAL_TOO_MANY_REQUEST

-4006 CAPITAL_ONLY_SUPPORT_PRIMARY_ACCOUNT

-4007 CAPITAL_ADDRESS_VERIFICATION_NOT_PASS

-4008 CAPITAL_ADDRESS_TAG_VERIFICATION_NOT_PASS

-4010 CAPITAL_WHITELIST_EMAIL_CONFIRM

-4011 CAPITAL_WHITELIST_EMAIL_EXPIRED

-4012 CAPITAL_WHITELIST_CLOSE

-4013 CAPITAL_WITHDRAW_2FA_VERIFY

-4014 CAPITAL_WITHDRAW_LOGIN_DELAY

-4015 CAPITAL_WITHDRAW_RESTRICTED_MINUTE

-4016 CAPITAL_WITHDRAW_RESTRICTED_PASSWORD

-4017 CAPITAL_WITHDRAW_RESTRICTED_UNBIND_2FA

-4018 CAPITAL_WITHDRAW_ASSET_NOT_EXIST

-4019 CAPITAL_WITHDRAW_ASSET_PROHIBIT

-4021 CAPITAL_WITHDRAW_AMOUNT_MULTIPLE

-4022 CAPITAL_WITHDRAW_MIN_AMOUNT

-4023 CAPITAL_WITHDRAW_MAX_AMOUNT

-4024 CAPITAL_WITHDRAW_USER_NO_ASSET

-4025 CAPITAL_WITHDRAW_USER_ASSET_LESS_THAN_ZERO

-4026 CAPITAL_WITHDRAW_USER_ASSET_NOT_ENOUGH

-4027 CAPITAL_WITHDRAW_GET_TRAN_ID_FAILURE

-4028 CAPITAL_WITHDRAW_MORE_THAN_FEE

-4029 CAPITAL_WITHDRAW_NOT_EXIST

-4030 CAPITAL_WITHDRAW_CONFIRM_SUCCESS

-4031 CAPITAL_WITHDRAW_CANCEL_FAILURE

-4032 CAPITAL_WITHDRAW_CHECKSUM_VERIFY_FAILURE

-4033 CAPITAL_WITHDRAW_ILLEGAL_ADDRESS

-4034 CAPITAL_WITHDRAW_ADDRESS_CHEAT

-4035 CAPITAL_WITHDRAW_NOT_WHITE_ADDRESS

-4036 CAPITAL_WITHDRAW_NEW_ADDRESS

-4037 CAPITAL_WITHDRAW_RESEND_EMAIL_FAIL

-4038 CAPITAL_WITHDRAW_RESEND_EMAIL_TIME_OUT

-4039 CAPITAL_USER_EMPTY

-4041 CAPITAL_MINUTE_TOO_SMALL

-4042 CAPITAL_CHARGE_NOT_RESET

-4043 CAPITAL_ADDRESS_TOO_MUCH

-4044 CAPITAL_BLACKLIST_COUNTRY_GET_ADDRESS

-4045 CAPITAL_GET_ASSET_ERROR

-4046 CAPITAL_AGREEMENT_NOT_CONFIRMED

-4047 CAPITAL_DATE_INTERVAL_LIMIT

-5001 ASSET_DRIBBLET_CONVERT_SWITCH_OFF

-5002 ASSET_ASSET_NOT_ENOUGH

-5003 ASSET_USER_HAVE_NO_ASSET

-5004 USER_OUT_OF_TRANSFER_FLOAT

-5005 USER_ASSET_AMOUNT_IS_TOO_LOW

-5006 USER_CAN_NOT_REQUEST_IN_24_HOURS

-5007 AMOUNT_OVER_ZERO

-5008 ASSET_WITHDRAW_WITHDRAWING_NOT_ENOUGH

-5009 PRODUCT_NOT_EXIST

-5010 TRANSFER_FAIL

-5011 FUTURE_ACCT_NOT_EXIST

-5012 TRANSFER_PENDING

-5021 PARENT_SUB_HAVE_NO_RELATION

-5012 FUTURE_ACCT_OR_SUBRELATION_NOT_EXIST

6XXX - 币安宝相关

-6001 DAILY_PRODUCT_NOT_EXIST

-6003 DAILY_PRODUCT_NOT_ACCESSIBLE

-6004 DAILY_PRODUCT_NOT_PURCHASABLE

-6005 DAILY_LOWER_THAN_MIN_PURCHASE_LIMIT

-6006 DAILY_REDEEM_AMOUNT_ERROR

-6007 DAILY_REDEEM_TIME_ERROR

-6008 DAILY_PRODUCT_NOT_REDEEMABLE

-6009 REQUEST_FREQUENCY_TOO_HIGH

-6011 EXCEEDED_USER_PURCHASE_LIMIT

-6012 BALANCE_NOT_ENOUGH

-6013 PURCHASING_FAILED

-6014 UPDATE_FAILED

-6015 EMPTY_REQUEST_BODY

-6016 PARAMS_ERR

-6017 NOT_IN_WHITELIST

-6018 ASSET_NOT_ENOUGH

-6019 PENDING

-6020 PROJECT_NOT_EXISTS

70xx - 期货

-7001 FUTURES_BAD_DATE_RANGE

-7002 FUTURES_BAD_TYPE

10xxx - 混合保证金

-10017 REPAY_CHECK_BEYOND_LIABILITY

-9xxx 过滤器故障

报错信息 描述
"Filter failure: PRICE_FILTER" "价格"过高,过低和/或不遵循交易对的最小价格规则。
"Filter failure: PERCENT_PRICE" "价格"比最近Y分钟的平均加权价格高X%或X%太低。
"Filter failure: LOT_SIZE" "数量"太高,太低和/或不遵循该交易对的步长规则。
"Filter failure: MIN_NOTIONAL" 价格*数量太低,无法成为该交易对的有效订单。
"Filter failure: ICEBERG_PARTS" ICEBERG 订单会分成太多部分; icebergQty太小。
"Filter failure: MARKET_LOT_SIZE" "MARKET"订单的"数量"过高,过低和/或未遵循交易对的步长规则。
"Filter failure: MAX_POSITION" 达到账户的最大仓位限制。这包括了账户的余额总额,以及所有处于open的买单的数量总和。
"Filter failure: MAX_NUM_ORDERS" 客户在交易对上有太多挂单。
"Filter failure: MAX_ALGO_ORDERS" 账户有太多未平仓止损和/或在交易对上执行获利指令。
"Filter failure: MAX_NUM_ICEBERG_ORDERS" 客户在交易对上有太多 iceberg 挂单。
"Filter failure: EXCHANGE_MAX_NUM_ORDERS" 帐户上的交易所有太多挂单。
"Filter failure: EXCHANGE_MAX_ALGO_ORDERS" 帐户有太多止损挂单和/或在交易所收取获利指令。

订单拒绝错误

以下错误代码表示撮合引擎返回的订单相关错误:

结合以下消息将指示特定的错误:

Error message Description
"Unknown order sent." 找不到订单(通过"orderId","clientOrderId","origClientOrderId")
"Duplicate order sent." clientOrderId已经被使用
"Market is closed." 该交易对不在交易范围
"Account has insufficient balance for requested action." 没有足够的资金来完成行动
"Market orders are not supported for this symbol." 交易对上未启用"MARKET"
"Iceberg orders are not supported for this symbol." 交易对上未启用icebergQty
"Stop loss orders are not supported for this symbol." 交易对上未启用 STOP_LOSS
"Stop loss limit orders are not supported for this symbol." 交易对上未启STOP_LOSS_LIMIT
"Take profit orders are not supported for this symbol." 交易对上未启用TAKE_PROFIT
"Take profit limit orders are not supported for this symbol." 交易对上未启用TAKE_PROFIT_LIMIT
"Price * QTY is zero or less." price * quantity太小
"IcebergQty exceeds QTY." icebergQty 必须少于订单数量
"This action disabled is on this account." 联系客户支持; 该帐户已禁用了某些操作。
"Unsupported order combination" 不允许组合orderType, timeInForce, stopPrice, 和/或 icebergQty
"Order would trigger immediately." 与最后交易价格相比,订单的止损价无效。
"Cancel order is invalid. Check origClientOrderId and orderId." 未发送origClientOrderIdorderId
"Order would immediately match and take." LIMIT_MAKER 订单类型将立即匹配并进行交易,而不是纯粹的生成订单。
"The relationship of the prices for the orders is not correct." OCO订单中设置的价格不符合报价规则:
The rules are:
SELL Orders: Limit Price > Last Price > Stop Price
BUY Orders: Limit Price < Last Price < Stop Price
"OCO orders are not supported for this symbol" OCO订单不支持该交易对
"Quote order qty market orders are not support for this symbol." 这个交易对,市价单不支持参数quoteOrderQty

备注说明

请求参数

Email地址

Email地址作为请求参数,需要转译(encode)。比如 alice@test.com 转换成 alice%40test.com