跳到主要内容

账户请求

账户信息 (USER_DATA)

{
"id": "605a6d20-6588-4cb9-afa0-b0ab087507ba",
"method": "account.status",
"params": {
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "83303b4a136ac1371795f465808367242685a9e3a42b22edb4d977d0696eb45c",
"timestamp": 1660801839480
}
}

获取当前账户信息。

权重: 20

参数:

名称类型是否必需描述
apiKeySTRINGYES
omitZeroBalancesBOOLEANNO如果true,将隐藏所有零余额。
默认值:false
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

数据源: 缓存 => 数据库

响应:

{
"id": "605a6d20-6588-4cb9-afa0-b0ab087507ba",
"status": 200,
"result": {
"makerCommission": 15,
"takerCommission": 15,
"buyerCommission": 0,
"sellerCommission": 0,
"canTrade": true,
"canWithdraw": true,
"canDeposit": true,
"commissionRates": {
"maker": "0.00150000",
"taker": "0.00150000",
"buyer": "0.00000000",
"seller": "0.00000000"
},
"brokered": false,
"requireSelfTradePrevention": false,
"preventSor": false,
"updateTime": 1660801833000,
"accountType": "SPOT",
"balances": [
{
"asset": "BNB",
"free": "0.00000000",
"locked": "0.00000000"
},
{
"asset": "BTC",
"free": "1.3447112",
"locked": "0.08600000"
},
{
"asset": "USDT",
"free": "1021.21000000",
"locked": "0.00000000"
}
],
"permissions": [
"SPOT"
],
"uid": 354937868
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}

查询未成交的订单计数 (USER_DATA)

{
"id": "d3783d8d-f8d1-4d2c-b8a0-b7596af5a664",
"method": "account.rateLimits.orders",
"params": {
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "76289424d6e288f4dc47d167ac824e859dabf78736f4348abbbac848d719eb94",
"timestamp": 1660801839500
}
}

显示用户在所有时间间隔内的未成交订单计数。

权重: 40

参数:

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

数据源: 缓存

响应:

{
"id": "d3783d8d-f8d1-4d2c-b8a0-b7596af5a664",
"status": 200,
"result": [
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 10,
"limit": 50,
"count": 0
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"intervalNum": 1,
"limit": 160000,
"count": 0
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 40
}
]
}

账户订单历史 (USER_DATA)

{
"id": "734235c2-13d2-4574-be68-723e818c08f3",
"method": "allOrders",
"params": {
"symbol": "BTCUSDT",
"startTime": 1660780800000,
"endTime": 1660867200000,
"limit": 5,
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "f50a972ba7fad92842187643f6b930802d4e20bce1ba1e788e856e811577bd42",
"timestamp": 1661955123341
}
}

获取所有账户订单; 有效,已取消或已完成。按时间范围过滤。

权重: 20

参数:

名称类型是否必需描述
symbolSTRINGYES
orderIdINTNO起始订单ID
startTimeINTNO
endTimeINTNO
limitINTNO默认 500; 最大值 1000
apiKeySTRINGYES
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

备注:

  • 如果指定了 startTime 和/或 endTime,则忽略 orderId

    订单是按照最后一次更新的执行状态的time过滤的。

  • 如果指定了 orderId,返回的订单将是订单ID >= orderId

  • 如果不指定条件,则返回最近的订单。

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

  • startTimeendTime之间的时间不能超过 24 小时。

数据源: 数据库

响应:

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

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

{
"id": "734235c2-13d2-4574-be68-723e818c08f3",
"status": 200,
"result": [
{
"symbol": "BTCUSDT",
"orderId": 12569099453,
"orderListId": -1,
"clientOrderId": "4d96324ff9d44481926157",
"price": "23416.10000000",
"origQty": "0.00847000",
"executedQty": "0.00847000",
"cummulativeQuoteQty": "198.33521500",
"status": "FILLED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"stopPrice": "0.00000000",
"icebergQty": "0.00000000",
"time": 1660801715639,
"updateTime": 1660801717945,
"isWorking": true,
"origQuoteOrderQty": "0.00000000",
"selfTradePreventionMode": "NONE",
"preventedMatchId": 0, // 这仅在订单因 STP 而过期时可见
"preventedQuantity": "1.200000" // 这仅在订单因 STP 而过期时可见
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}

账户订单列表历史 (USER_DATA)

{
"id": "8617b7b3-1b3d-4dec-94cd-eefd929b8ceb",
"method": "allOrderLists",
"params": {
"startTime": 1660780800000,
"endTime": 1660867200000,
"limit": 5,
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "c8e1484db4a4a02d0e84dfa627eb9b8298f07ebf12fcc4eaf86e4a565b2712c2",
"timestamp": 1661955123341
}
}

查询所有订单列表的信息,按时间范围过滤。

权重: 20

参数:

名称类型是否必需描述
fromIdINTNO起始的 Order list ID
startTimeINTNO
endTimeINTNO
limitINTNO默认 500; 最大值 1000
apiKeySTRINGYES
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

备注:

  • 如果指定了 startTime 和/或 endTime,则忽略 fromId

    订单列表是按照最后一次更新的订单列表执行状态的 transactionTime 过滤的。

  • 如果指定了 fromId,返回的订单列表将是 order list ID >= fromId

  • 如果不指定条件,则返回最近的订单列表。

  • startTimeendTime之间的时间不能超过 24 小时

数据源: 数据库

响应:

订单列表的状态报告与 orderList.status 相同。

{
"id": "8617b7b3-1b3d-4dec-94cd-eefd929b8ceb",
"status": 200,
"result": [
{
"orderListId": 1274512,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "08985fedd9ea2cf6b28996",
"transactionTime": 1660801713793,
"symbol": "BTCUSDT",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 12569138901,
"clientOrderId": "BqtFCj5odMoWtSqGk2X9tU"
},
{
"symbol": "BTCUSDT",
"orderId": 12569138902,
"clientOrderId": "jLnZpj5enfMXTuhKB1d0us"
}
]
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}

账户成交历史 (USER_DATA)

{
"id": "f4ce6a53-a29d-4f70-823b-4ab59391d6e8",
"method": "myTrades",
"params": {
"symbol": "BTCUSDT",
"startTime": 1660780800000,
"endTime": 1660867200000,
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "c5a5ffb79fd4f2e10a92f895d488943a57954edf5933bde3338dfb6ea6d6eefc",
"timestamp": 1661955125250
}
}

获取账户指定交易对的成交历史,按时间范围过滤。

权重: 20

参数:

名称类型是否必需描述
symbolSTRINGYES
orderIdINTNO
startTimeINTNO
endTimeINTNO
fromIdINTNO起始交易 ID
limitINTNO默认 500; 最大值 1000
apiKeySTRINGYES
recvWindowINTNO值不能大于 60000
signatureSTRINGYES
timestampINTYES

备注:

  • 如果指定了 fromId,则返回的交易将是 交易ID >= fromId

  • 如果指定了 startTime 和/或 endTime,则交易按执行时间(time)过滤。

    fromId 不能与 startTimeendTime 一起使用。

  • 如果指定了 orderId,则只返回与该订单相关的交易。

    startTimeendTime 不能与 orderId 一起使用。

  • 如果不指定条件,则返回最近的交易。

  • startTimeendTime之间的时间不能超过 24 小时。

数据源: 缓存 => 数据库

响应:

{
"id": "f4ce6a53-a29d-4f70-823b-4ab59391d6e8",
"status": 200,
"result": [
{
"symbol": "BTCUSDT",
"id": 1650422481,
"orderId": 12569099453,
"orderListId": -1,
"price": "23416.10000000",
"qty": "0.00635000",
"quoteQty": "148.69223500",
"commission": "0.00000000",
"commissionAsset": "BNB",
"time": 1660801715793,
"isBuyer": false,
"isMaker": true,
"isBestMatch": true
},
{
"symbol": "BTCUSDT",
"id": 1650422482,
"orderId": 12569099453,
"orderListId": -1,
"price": "23416.50000000",
"qty": "0.00212000",
"quoteQty": "49.64298000",
"commission": "0.00000000",
"commissionAsset": "BNB",
"time": 1660801715793,
"isBuyer": false,
"isMaker": true,
"isBestMatch": true
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}

账户的 Prevented Matches (USER_DATA)

{
"id": "g4ce6a53-a39d-4f71-823b-4ab5r391d6y8",
"method": "myPreventedMatches",
"params": {
"symbol": "BTCUSDT",
"orderId": 35,
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "c5a5ffb79fd4f2e10a92f895d488943a57954edf5933bde3338dfb6ea6d6eefc",
"timestamp": 1673923281052
}
}

获取因 STP 而过期的订单列表。

这些是支持的组合:

  • symbol + preventedMatchId
  • symbol + orderId
  • symbol + orderId + fromPreventedMatchId (limit 默认为 500)
  • symbol + orderId + fromPreventedMatchId + limit

参数:

名称类型是否必需描述
symbolSTRINGYES
preventedMatchIdLONGNO
orderIdLONGNO
fromPreventedMatchIdLONGNO
limitINTNO默认:500;最大:1000
recvWindowLONGNO赋值不得大于 60000
timestampLONGYES

权重:

情况权重
如果 symbol 不合法2
preventedMatchId 查询2
orderId 查询20

数据源:

数据库

响应:

{
"id": "g4ce6a53-a39d-4f71-823b-4ab5r391d6y8",
"status": 200,
"result": [
{
"symbol": "BTCUSDT",
"preventedMatchId": 1,
"takerOrderId": 5,
"makerSymbol": "BTCUSDT",
"makerOrderId": 3,
"tradeGroupId": 1,
"selfTradePreventionMode": "EXPIRE_MAKER",
"price": "1.100000",
"makerPreventedQuantity": "1.300000",
"transactTime": 1669101687094
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}

查询分配结果 (USER_DATA)

{
"id": "g4ce6a53-a39d-4f71-823b-4ab5r391d6y8",
"method": "myAllocations",
"params": {
"symbol": "BTCUSDT",
"orderId": 500,
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "c5a5ffb79fd4f2e10a92f895d488943a57954edf5933bde3338dfb6ea6d6eefc",
"timestamp": 1673923281052
}
}

检索由 SOR 订单生成引起的分配结果。

权重: 20

参数:

名称类型是否必需描述
symbolSTRINGYES
startTimeLONGNO
endTimeLONGNO
fromAllocationIdINTNO
limitINTNO默认值 500; 最大值 1000
orderIdLONGNO
recvWindowLONGNO不能大于 60000
timestampLONGNO

支持的参数组合:

参数响应
symbol按从最旧到最新排序的分配
symbol + startTimestartTime 开始的最旧的分配
symbol + endTimeendTime 为止的最新的分配
symbol + startTime + endTime在指定时间范围内的分配
symbol + fromAllocationId从指定 AllocationId 开始的分配
symbol + orderId按从最旧到最新排序并和特定订单关联的分配
symbol + orderId + fromAllocationId从指定 AllocationId 开始并和特定订单关联的分配

注意: startTimeendTime 之间的时间不能超过 24 小时。

数据源: 数据库

响应:

{
"id": "g4ce6a53-a39d-4f71-823b-4ab5r391d6y8",
"status": 200,
"result": [
{
"symbol": "BTCUSDT",
"allocationId": 0,
"allocationType": "SOR",
"orderId": 500,
"orderListId": -1,
"price": "1.00000000",
"qty": "0.10000000",
"quoteQty": "0.10000000",
"commission": "0.00000000",
"commissionAsset": "BTC",
"time": 1687319487614,
"isBuyer": false,
"isMaker": false,
"isAllocator": false
}
],
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}

账户佣金费率 (USER_DATA)

{
"id": "d3df8a61-98ea-4fe0-8f4e-0fcea5d418b0",
"method": "account.commission",
"params": {
"symbol": "BTCUSDT",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"signature": "c5a5ffb79fd4f2e10a92f895d488943a57954edf5933bde3338dfb6ea6d6eefc",
"timestamp": 1673923281052
}
}

获取当前账户的佣金费率。

参数:

参数名类型是否必需描述
symbolSTRINGYES

权重: 20

数据源: 数据库

响应:

{
"id": "d3df8a61-98ea-4fe0-8f4e-0fcea5d418b0",
"status": 200,
"result":
[
{
"symbol": "BTCUSDT",
"standardCommission": // 订单交易的标准佣金率。
{
"maker": "0.00000010",
"taker": "0.00000020",
"buyer": "0.00000030",
"seller": "0.00000040"
},
"taxCommission": // 订单交易的税率。
{
"maker": "0.00000112",
"taker": "0.00000114",
"buyer": "0.00000118",
"seller": "0.00000116"
},
"discount": // 以BNB支付时的标准佣金折扣。
{
"enabledForAccount": true,
"enabledForSymbol": true,
"discountAsset": "BNB",
"discount": "0.75000000" // 当用BNB支付佣金时,在标准佣金上按此比率打折。
}
}
],
"rateLimits":
[
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 20
}
]
}