币种数据 API

BBX 开放API提供了完整的币种数据接口,让您能够轻松获取加密货币的各类信息。本文档将详细介绍币种相关的所有 API 端点,包括如何查询币种列表、获取实时行情等功能。


GET/v2/coin

获取币种列表

此接口返回支持的所有币种基础信息。

请求参数

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

返回数据

  • Name
    success
    Type
    boolean
    Description

    接口状态

  • Name
    errorCode
    Type
    integer
    Description

    状态码

  • Name
    error
    Type
    string
    Description

    错误提示信息

  • Name
    data
    Type
    array
    Description

    币种列表数据

    • Name
      coin_key
      Type
      string
      Description

      币种主键

    • Name
      hash_key
      Type
      string
      Description

      币种哈希键

    • Name
      show
      Type
      string
      Description

      币种简称

    • Name
      cn_name
      Type
      string
      Description

      币种中文名称

    • Name
      en_name
      Type
      string
      Description

      币种英文名称

请求

GET
/v2/coin
curl -G https://open.bbx.com/api/v2/coin \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "success": true,
  "errorCode": 200,
  "data": [
    {
      "coin_key": "bitcoin",
      "show": "BTC",
      "cn_name": "比特币",
      "en_name": "Bitcoin",
      "hash_key": "A92455EC"
    }
  ]
}

GET/v2/coin/ticker

获取币种相关数据

此接口用于获取币种的实时行情数据,包括价格、涨跌幅、成交量等信息。

请求参数

  • Name
    coin_list
    Type
    string
    Description

    币种主键列表,用英文逗号连接,最多100个币种

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

返回数据

  • Name
    success
    Type
    boolean
    Description

    接口状态

  • Name
    errorCode
    Type
    integer
    Description

    状态码

  • Name
    error
    Type
    string
    Description

    错误提示信息

  • Name
    data
    Type
    array
    Description

    返回数据

    • Name
      coin_key
      Type
      string
      Description

      币种主键

    • Name
      price_cny
      Type
      string
      Description

      最新价(人民币)

    • Name
      price_usd
      Type
      string
      Description

      最新价(美元)

    • Name
      degree_24h_cny
      Type
      string
      Description

      24小时涨跌幅(人民币)

    • Name
      degree_24h_usd
      Type
      string
      Description

      24小时涨跌幅(美元)

    • Name
      supply_cny
      Type
      string
      Description

      市值(人民币)

    • Name
      supply_usd
      Type
      string
      Description

      市值(美元)

    • Name
      trade_24h_cny
      Type
      string
      Description

      24小时成交额(人民币)

    • Name
      trade_24h_usd
      Type
      string
      Description

      24小时成交额(美元)

    • Name
      vol_24h
      Type
      string
      Description

      24小时成交量

    • Name
      usdt_funding_rate
      Type
      string
      Description

      U本位费率

    • Name
      usd_funding_rate
      Type
      string
      Description

      币本位费率

请求

GET
/v2/coin/ticker
curl -G https://open.bbx.com/api/v2/coin/ticker \
  -d coin_list=bitcoin,litecoin \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "success": true,
  "errorCode": 200,
  "data": [
    {
      "coin_key": "bitcoin",
      "price_cny": "54810.01",
      "price_usd": "7930.59",
      "degree_24h_cny": "0.70",
      "degree_24h_usd": "0.66",
      "supply_cny": "970788045869",
      "supply_usd": "140465618756",
      "trade_24h_cny": "123163682659.427876",
      "trade_24h_usd": "17851217131.209215",
      "vol_24h": "3669627.78",
      "usdt_funding_rate": "0.01",
      "usd_funding_rate": "0.02"
    }
  ]
}

GET/v2/coin/config

获取币种简介数据

此接口用于获取币种的基础配置信息,包括简介、白皮书、发行信息等。

请求参数

  • Name
    coin_list
    Type
    string
    Description

    币种主键列表,用英文逗号连接,最多100个币种

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

返回数据

  • Name
    success
    Type
    boolean
    Description

    接口状态

  • Name
    errorCode
    Type
    integer
    Description

    状态码

  • Name
    error
    Type
    string
    Description

    错误提示信息

  • Name
    data
    Type
    array
    Description

    返回数据

    • Name
      coin_key
      Type
      string
      Description

      币种主键

    • Name
      show
      Type
      string
      Description

      币种简称,空字符串表示没有数据

    • Name
      cnName
      Type
      string
      Description

      币种中文名,空字符串表示没有数据

    • Name
      enName
      Type
      string
      Description

      币种英文名,空字符串表示没有数据

    • Name
      describe
      Type
      string
      Description

      币种简介,空字符串表示没有数据

    • Name
      whitePaper
      Type
      string
      Description

      白皮书地址,空字符串表示没有数据

    • Name
      officialUrl
      Type
      string
      Description

      官网,空字符串表示没有数据

    • Name
      publishAmount
      Type
      string
      Description

      发行量,空字符串表示没有数据

    • Name
      distribution
      Type
      array
      Description

      代币分配

      • Name
        ico
        Type
        string
        Description

        类型,空字符串表示没有数据

      • Name
        foundation
        Type
        string
        Description

        占比,空字符串表示没有数据

请求

GET
/v2/coin/config
curl -G https://open.bbx.com/api/v2/coin/config \
  -d coin_list=bitcoin \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "success": true,
  "errorCode": 200,
  "data": [
    {
      "coin_key": "bitcoin",
      "show": "BTC",
      "cnName": "比特币",
      "enName": "Bitcoin",
      "describe": "比特币(BitCoin)的概念最初由中本聪在2009年提出...",
      "whitePaper": "https://bitcoin.org/files/bitcoin-paper/bitcoin_zh_cn.pdf",
      "officialUrl": "https://bitcoin.org/en/",
      "publishAmount": "21000000",
      "distribution": [
        {
          "ico": "团队",
          "foundation": "8.3"
        }
      ]
    }
  ]
}

GET/upgrade/v2/futures/funding-rate/history

获取资金费率历史

此接口用于获取指定交易对的资金费率历史数据。

请求参数

  • Name
    symbol
    Type
    string
    Description

    交易对,如 "btcswapusdt:okcoinfutures"

  • Name
    interval
    Type
    string
    Description

    时间间隔,支持: 1m, 3m, 5m, 15m, 30m, 1h, 4h, 6h, 8h, 12h, 1d, 1w

  • Name
    limit
    Type
    integer
    Description

    返回条数限制

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),可选

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒),可选

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 futures:FUNDING_RATE_HISTORY 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的交易对

symbol说明
btcswapusdt:okcoinfuturesOKX合约
btcswapusdt:binanceBinance合约
btcswapusdt:bybitBybit合约
btcswapusdt:gateGate合约
btcswapusdt:hbdmHBDM合约
更多BTC相关交易对...支持50+个BTC相关交易对

返回数据

  • Name
    code
    Type
    integer
    Description

    状态码

  • Name
    message
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    资金费率历史数据

    • Name
      time
      Type
      integer
      Description

      时间戳(毫秒)

    • Name
      open
      Type
      string
      Description

      开盘资金费率

    • Name
      high
      Type
      string
      Description

      最高资金费率

    • Name
      low
      Type
      string
      Description

      最低资金费率

    • Name
      close
      Type
      string
      Description

      收盘资金费率

请求

GET
/upgrade/v2/futures/funding-rate/history
curl -G https://open.bbx.com/api/upgrade/v2/futures/funding-rate/history \
  -d symbol=btcswapusdt:okcoinfutures \
  -d interval=15m \
  -d limit=100 \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "message": "success",
  "data": [
    {
      "time": 1749026400000,
      "open": "0.0001",
      "high": "0.0001",
      "low": "0.0001",
      "close": "0.0001"
    }
  ]
}

GET/upgrade/v2/futures/funding-rate/vol-weight-history

获取加权资金费率历史

此接口用于获取指定币种的加权资金费率历史数据。

请求参数

  • Name
    symbol
    Type
    string
    Description

    交易对,如 "btcswapusdt"

  • Name
    interval
    Type
    string
    Description

    时间间隔,支持: 1m, 3m, 5m, 15m, 30m, 1h, 4h, 6h, 8h, 12h, 1d, 1w

  • Name
    limit
    Type
    integer
    Description

    返回条数限制

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),可选

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒),可选

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 futures:WEIGHTED_FUNDING_RATE 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的交易对

symbol对应聚合的交易所列表
btcswapusdtOKX, Binance

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    加权资金费率历史数据

    • Name
      time
      Type
      integer
      Description

      时间戳(毫秒)

    • Name
      open
      Type
      string
      Description

      开盘加权资金费率

    • Name
      high
      Type
      string
      Description

      最高加权资金费率

    • Name
      low
      Type
      string
      Description

      最低加权资金费率

    • Name
      close
      Type
      string
      Description

      收盘加权资金费率

请求

GET
/upgrade/v2/futures/funding-rate/vol-weight-history
curl -G https://open.bbx.com/api/upgrade/v2/futures/funding-rate/vol-weight-history \
  -d symbol=btcswapusdt \
  -d interval=15m \
  -d limit=100 \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": [
    {
      "time": 1749026520000,
      "open": "2.939e-05",
      "high": "2.939e-05",
      "low": "2.939e-05",
      "close": "2.939e-05"
    }
  ]
}

GET/upgrade/v2/futures/open-interest/aggregated-stablecoin-history

获取聚合稳定币保证金持仓量历史

此接口用于获取指定币种的聚合稳定币保证金持仓量历史数据。

请求参数

  • Name
    symbol
    Type
    string
    Description

    币种名称,如 "BTC"

  • Name
    interval
    Type
    string
    Description

    时间间隔,支持: 1m, 3m, 5m, 15m, 30m, 1h, 4h, 6h, 8h, 12h, 1d, 1w

  • Name
    limit
    Type
    integer
    Description

    返回条数限制

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),可选

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒),可选

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 futures:STABLECOIN_MARGIN_POSITION 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的币种

symbol对应聚合的交易所列表
BTCOKX, Binance, Bybit, Bitget, Gate, HBDM, Pionex

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    聚合稳定币保证金持仓量历史数据

    • Name
      time
      Type
      integer
      Description

      时间戳(毫秒)

    • Name
      open
      Type
      string
      Description

      开盘持仓量

    • Name
      high
      Type
      string
      Description

      最高持仓量

    • Name
      low
      Type
      string
      Description

      最低持仓量

    • Name
      close
      Type
      string
      Description

      收盘持仓量

请求

GET
/upgrade/v2/futures/open-interest/aggregated-stablecoin-history
curl -G https://open.bbx.com/api/upgrade/v2/futures/open-interest/aggregated-stablecoin-history \
  -d symbol=BTC \
  -d interval=15m \
  -d limit=100 \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": [
    {
      "time": 1749026700000,
      "open": "291600",
      "high": "291600",
      "low": "291598",
      "close": "291598"
    }
  ]
}

GET/upgrade/v2/futures/open-interest/aggregated-coin-margin-history

获取聚合币本位保证金持仓量历史

此接口用于获取指定币种的聚合币本位保证金持仓量历史数据。

请求参数

  • Name
    symbol
    Type
    string
    Description

    币种名称,如 "BTC"

  • Name
    interval
    Type
    string
    Description

    时间间隔,支持: 1m, 2m, 15m, 30m

  • Name
    limit
    Type
    integer
    Description

    返回条数限制

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),可选

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒),可选

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 futures:COIN_MARGIN_POSITION 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的币种

symbol对应聚合的交易所列表
BTCOKX, Binance, Bybit, Bitget, Gate, HBDM, Pionex

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    聚合币本位保证金持仓量历史数据

    • Name
      time
      Type
      integer
      Description

      时间戳(毫秒)

    • Name
      open
      Type
      string
      Description

      开盘持仓量

    • Name
      high
      Type
      string
      Description

      最高持仓量

    • Name
      low
      Type
      string
      Description

      最低持仓量

    • Name
      close
      Type
      string
      Description

      收盘持仓量

请求

GET
/upgrade/v2/futures/open-interest/aggregated-coin-margin-history
curl -G https://open.bbx.com/api/upgrade/v2/futures/open-interest/aggregated-coin-margin-history \
  -d symbol=BTC \
  -d interval=15m \
  -d limit=100 \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": [
    {
      "time": 1749026640000,
      "open": "6.721158125e+09",
      "high": "1.5884201391e+10",
      "low": "6.721158125e+09",
      "close": "1.5881786057e+10"
    }
  ]
}

GET/upgrade/v2/futures/liquidation/history

获取爆仓单历史

此接口用于获取指定交易对的爆仓单历史数据。

请求参数

  • Name
    symbol
    Type
    string
    Description

    交易对标识,如 "btcswapusdt:binance"

  • Name
    interval
    Type
    string
    Description

    时间间隔,支持: 1m, 2m, 15m, 30m

  • Name
    limit
    Type
    integer
    Description

    返回条数限制,默认 10

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),可选

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒),可选

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 futures:LIQUIDATION_ORDERS 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的交易对

symbol说明
btcswapusdt:binanceBinance BTC 交易对
btcswapusdt:okcoinfuturesOKX BTC 交易对

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    爆仓单历史数据

    • Name
      time
      Type
      integer
      Description

      数据时间戳(毫秒)

    • Name
      long_liquidation_usd
      Type
      string
      Description

      多头爆仓金额(美元)

    • Name
      short_liquidation_usd
      Type
      string
      Description

      空头爆仓金额(美元)

请求

GET
/upgrade/v2/futures/liquidation/history
curl -G https://open.bbx.com/api/upgrade/v2/futures/liquidation/history \
  -d symbol=btcswapusdt:binance \
  -d interval=15m \
  -d limit=100 \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": [
    {
      "time": 1700000000000,
      "long_liquidation_usd": "1500000.50000",
      "short_liquidation_usd": "2300000.75000"
    },
    {
      "time": 1700003600000,
      "long_liquidation_usd": "1200000.25000",
      "short_liquidation_usd": "1800000.35000"
    }
  ]
}

GET/upgrade/v2/futures/estimated-liquidation/history

获取历史预估爆仓图

此接口用于获取指定交易对的历史预估爆仓图数据。

请求参数

  • Name
    dbkey
    Type
    string
    Description

    交易对标识,如 "btcswapusdt:binance"

  • Name
    leverage
    Type
    string
    Description

    杠杆倍数,如 "50",为空则返回所有杠杆倍数

  • Name
    cycle
    Type
    string
    Description

    时间周期,支持: 24h, 7d

  • Name
    limit
    Type
    integer
    Description

    返回条数限制,默认 100

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),可选

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒),可选

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 futures:ESTIMATED_LIQUIDATION_HISTORY 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的交易对

dbkey说明
solswapusdt:binanceBinance SOL 合约
btcswapusdt:binanceBinance BTC 合约
ethswapusdt:binanceBinance ETH 合约
btcswapusdt:okcoinfuturesOKX BTC 合约
ethswapusdt:okcoinfuturesOKX ETH 合约
solswapusdt:okcoinfuturesOKX SOL 合约

支持的杠杆倍数

leverage说明
1010倍杠杆
2525倍杠杆
5050倍杠杆
100100倍杠杆

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    预估爆仓图历史数据

    • Name
      time
      Type
      integer
      Description

      数据时间戳(毫秒)

    • Name
      data_map
      Type
      object
      Description

      按杠杆倍数分组的爆仓图数据

      • Name
        mapping
        Type
        array
        Description

        字段映射,固定为 ["from", "to", "turnover"]

      • Name
        short
        Type
        array
        Description

        空头爆仓数据,格式为 [[起始价格, 结束价格, 交易量], ...]

      • Name
        long
        Type
        array
        Description

        多头爆仓数据,格式为 [[起始价格, 结束价格, 交易量], ...]

      • Name
        timestamp
        Type
        integer
        Description

        计算时间戳

请求

GET
/upgrade/v2/futures/estimated-liquidation/history
curl -G https://open.bbx.com/api/upgrade/v2/futures/estimated-liquidation/history \
  -d dbkey=btcswapusdt:binance \
  -d leverage=50 \
  -d cycle=24h \
  -d limit=100 \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": [
    {
      "time": 1700000000000,
      "data_map": {
        "50": {
          "mapping": ["from", "to", "turnover"],
          "short": [
            [184601.0, 104672.4, 66262.0273686],
            [104672.4, 104743.8, 567185.0349501]
          ],
          "long": [
            [100499.0, 100567.6, 39065.6318472],
            [100567.6, 100636.2, 146365.2013005]
          ],
          "timestamp": 1749783658
        }
      }
    }
  ]
}

GET/upgrade/v2/futures/liquidation/map

获取清算地图

此接口基于历史预估爆仓图数据,返回最新时间点的预估爆仓图数据,用于实时监控当前市场的清算风险分布情况。

请求参数

  • Name
    dbkey
    Type
    string
    Description

    交易对标识,如 "btcswapusdt:binance"

  • Name
    cycle
    Type
    string
    Description

    时间周期,支持: 24h, 7d

  • Name
    leverage
    Type
    string
    Description

    杠杆倍数,如 "50",为空则返回所有杠杆倍数

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 futures:LIQUIDATION_MAP 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的交易对

dbkey说明
solswapusdt:binanceBinance SOL 合约
btcswapusdt:binanceBinance BTC 合约
ethswapusdt:binanceBinance ETH 合约
btcswapusdt:okcoinfuturesOKX BTC 合约
ethswapusdt:okcoinfuturesOKX ETH 合约
solswapusdt:okcoinfuturesOKX SOL 合约

支持的杠杆倍数

leverage说明
1010倍杠杆
2525倍杠杆
5050倍杠杆
100100倍杠杆

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    object
    Description

    最新清算地图数据

    • Name
      time
      Type
      integer
      Description

      数据时间戳(毫秒)

    • Name
      data_map
      Type
      object
      Description

      按杠杆倍数分组的爆仓图数据

      • Name
        mapping
        Type
        array
        Description

        字段映射,固定为 ["from", "to", "turnover"]

      • Name
        short
        Type
        array
        Description

        空头爆仓数据,格式为 [[起始价格, 结束价格, 交易量], ...]

      • Name
        long
        Type
        array
        Description

        多头爆仓数据,格式为 [[起始价格, 结束价格, 交易量], ...]

      • Name
        timestamp
        Type
        integer
        Description

        计算时间戳

请求

GET
/upgrade/v2/futures/liquidation/map
curl -G https://open.bbx.com/api/upgrade/v2/futures/liquidation/map \
  -d dbkey=btcswapusdt:binance \
  -d cycle=24h \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": {
    "time": 1700000000000,
    "data_map": {
      "50": {
        "mapping": ["from", "to", "turnover"],
        "short": [
          [184601.0, 104672.4, 66262.0273686],
          [104672.4, 104743.8, 567185.0349501]
        ],
        "long": [
          [100499.0, 100567.6, 39065.6318472],
          [100567.6, 100636.2, 146365.2013005]
        ],
        "timestamp": 1749783658
      },
      "25": {
        "mapping": ["from", "to", "turnover"],
        "short": [
          [184601.0, 104672.4, 66262.0273686],
          [104672.4, 104743.8, 567185.0349501]
        ],
        "long": [
          [100499.0, 100567.6, 39065.6318472],
          [100567.6, 100636.2, 146365.2013005]
        ],
        "timestamp": 1749783658
      }
    }
  }
}

GET/upgrade/v2/futures/historical-depth

获取历史挂单深度

此接口用于获取指定交易对的历史挂单深度数据。

请求参数

  • Name
    key
    Type
    string
    Description

    交易对:交易所,如 "btcswapusdt:okcoinfutures"

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),不填则默认获取最近数据

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒)

  • Name
    limit
    Type
    integer
    Description

    返回条数限制,默认 100,最大 1000

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 trading_pair:HISTORICAL_DEPTH 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的交易对

key说明
btcswapusdt:okcoinfuturesOKX BTC 永续合约
ethswapusdt:okcoinfuturesOKX ETH 永续合约

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    历史挂单深度数据

    • Name
      time
      Type
      integer
      Description

      数据时间戳(毫秒)

    • Name
      asks
      Type
      array
      Description

      卖盘深度,格式为 [[价格, 数量], ...],按价格从低到高排序

    • Name
      bids
      Type
      array
      Description

      买盘深度,格式为 [[价格, 数量], ...],按价格从高到低排序

请求

GET
/upgrade/v2/futures/historical-depth
curl -G https://open.bbx.com/api/upgrade/v2/futures/historical-depth \
  -d key=btcswapusdt:okcoinfutures \
  -d limit=100 \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": [
    {
      "time": 1700000000000,
      "asks": [
        [104150.5, 2.5],
        [104151.0, 1.8],
        [104152.0, 3.2]
      ],
      "bids": [
        [104149.5, 1.9],
        [104149.0, 2.1],
        [104148.0, 1.5]
      ]
    }
  ]
}

GET/upgrade/v2/futures/super-depth/history

获取大单挂单历史

此接口用于获取指定交易对的大单挂单历史数据,可用于监控市场上的大额挂单变化。

请求参数

  • Name
    key
    Type
    string
    Description

    交易对:交易所,如 "btcswapusdt:okcoinfutures"

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),不填则默认获取最近 24 小时数据

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒)

  • Name
    amount
    Type
    integer
    Description

    金额阈值,默认 10000

  • Name
    limit
    Type
    integer
    Description

    返回条数限制,默认 100,最大 1000

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 trading_pair:SUPER_DEPTH_HISTORY 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

支持的交易对

key说明
btcswapusdt:okcoinfuturesOKX BTC 永续合约
ethswapusdt:okcoinfuturesOKX ETH 永续合约
btcswapusdt:binanceBinance BTC 永续合约

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    大单挂单历史数据

    • Name
      id
      Type
      string
      Description

      挂单唯一标识

    • Name
      coin_type
      Type
      string
      Description

      币种类型

    • Name
      platform
      Type
      string
      Description

      交易所平台

    • Name
      depth_type
      Type
      string
      Description

      挂单类型,"bid"表示买单,"ask"表示卖单

    • Name
      depth_price
      Type
      number
      Description

      挂单价格

    • Name
      depth_amount
      Type
      number
      Description

      挂单金额(USDT)

    • Name
      depth_vol
      Type
      number
      Description

      挂单数量

    • Name
      depth_state
      Type
      integer
      Description

      挂单状态(0=待确认,1=已确认,2=部分成交,3=完全成交,4=已撤销)

    • Name
      hold_time
      Type
      integer
      Description

      挂单持续时间(毫秒)

    • Name
      trade_amount
      Type
      number
      Description

      实际成交金额

    • Name
      trade_vol
      Type
      number
      Description

      实际成交数量

    • Name
      transaction_ratio
      Type
      number
      Description

      成交率(%)

    • Name
      create_time
      Type
      integer
      Description

      挂单创建时间(毫秒时间戳)

    • Name
      start_time
      Type
      integer
      Description

      挂单开始时间(毫秒时间戳)

    • Name
      update_time
      Type
      integer
      Description

      最后更新时间(毫秒时间戳)

请求

GET
/upgrade/v2/futures/super-depth/history
curl -G https://open.bbx.com/api/upgrade/v2/futures/super-depth/history \
  -d key=btcswapusdt:okcoinfutures \
  -d amount=10000 \
  -d limit=100 \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": [
    {
      "id": "mIRLwpYBzW61Mmzuz0tL",
      "cache_bbx_id": 110000000332883550,
      "coin_type": "btc",
      "coin": "btcswapusdt",
      "platform": "okcoinfutures",
      "trade_type": "futures",
      "depth_type": "bid",
      "depth_price": 104100,
      "depth_amount": 5000.16,
      "depth_turnover": 5205166.56,
      "depth_vol": 50.0016,
      "create_time": 1747016470308,
      "start_time": 1747016469005,
      "update_time": 1747016610234,
      "update_state_time": 1747016610234,
      "depth_state": 2,
      "depth_status": 0,
      "show_state": 1,
      "bait_state": 0,
      "hold_time": 131567,
      "order_over_time": 1747016599006,
      "order_over_status": 0,
      "order_miss_time": 1747016609006,
      "order_miss_price": 104093.4,
      "uporder_time": 1747016609006,
      "trade_start_time": 1747016572528,
      "trade_stop_time": 1747016600572,
      "trade_miss_time": 1747016600572,
      "trade_miss_price": 104099.9,
      "uptrade_time": 1747016606844,
      "trade_price": 104112.1,
      "trade_amount": 10021.24,
      "trade_turnover": 10432110.84,
      "trade_vol": 100.2124,
      "trade_count": 433,
      "transaction_ratio": 2.00419,
      "high_amount": 10095.76,
      "high_turnover": 10509686.16,
      "high_vol": 100.9576,
      "high_trade_amount": 1122.3,
      "high_trade_turnover": 1168314.3,
      "high_trade_vol": 11.223,
      "last_amount": 8053.88,
      "last_turnover": 8384089.08,
      "last_vol": 80.5388,
      "last_check_amount": 1875.56,
      "miss_price": 104099.9,
      "miss_time": 1747016600572,
      "position_start": 2278885.09,
      "position_start_vol": 22788.8509,
      "position_start_turnover": 2372319378.69001,
      "position_stop": 2282126.8,
      "position_stop_vol": 22821.268,
      "position_stop_turnover": 2375693998.8,
      "position_sub": 3241.7099999999,
      "position_sub_vol": 32.4171,
      "position_sub_turnover": 3374620.1099999,
      "fake_price": 104208.598273844
    }
  ]
}

字段说明:

  • depth_type: 挂单类型,"bid"表示买单,"ask"表示卖单
  • depth_price: 挂单价格
  • depth_amount: 挂单金额(USDT)
  • depth_vol: 挂单数量(BTC)
  • depth_state: 挂单状态(0=待确认,1=已确认,2=部分成交,3=完全成交,4=已撤销)
  • hold_time: 挂单持续时间(毫秒)
  • trade_amount: 实际成交金额
  • trade_vol: 实际成交数量
  • transaction_ratio: 成交率(%)
  • create_time: 挂单创建时间(毫秒时间戳)
  • start_time: 挂单开始时间(毫秒时间戳)
  • update_time: 最后更新时间(毫秒时间戳)

使用场景:

  • 大单监控:监控市场上的大额挂单变化
  • 流动性分析:分析特定价位的流动性提供情况
  • 市场情绪:通过大单挂单行为分析市场情绪和趋势

GET/upgrade/v2/futures/trade-data

获取最新成交数据

此接口用于获取交易对的最新成交数据,支持实时查询和历史数据查询。

请求参数

  • Name
    dbkey
    Type
    string
    Description

    交易对:交易所,如 "btcswapusdt:okcoinfutures"

  • Name
    start_time
    Type
    integer
    Description

    开始时间戳(毫秒),不填则默认获取最近 1 小时数据

  • Name
    end_time
    Type
    integer
    Description

    结束时间戳(毫秒)

  • Name
    limit
    Type
    integer
    Description

    返回条数限制,默认 100,最大 1000

  • Name
    AccessKeyId
    Type
    string
    Description

    用户访问密钥ID,需要具有 trading_pair:TRADE_DATA 权限

  • Name
    SignatureNonce
    Type
    string
    Description

    签名随机数

  • Name
    Timestamp
    Type
    string
    Description

    请求时间戳(秒),有效期30秒

  • Name
    Signature
    Type
    string
    Description

    使用 HmacSHA1 + Base64 生成的签名,请参考如何获取 API 认证参数

部分支持的交易对

dbkey说明
btcswapusdt:okcoinfuturesOKX BTC 永续合约
ethswapusdt:okcoinfuturesOKX ETH 永续合约
solswapusdt:okcoinfuturesOKX SOL 永续合约
btcswapusdt:binanceBinance BTC 永续合约
ethswapusdt:binanceBinance ETH 永续合约

返回数据

  • Name
    code
    Type
    string
    Description

    状态码

  • Name
    msg
    Type
    string
    Description

    返回消息

  • Name
    data
    Type
    array
    Description

    最新成交数据

    • Name
      timestamp
      Type
      string
      Description

      成交时间戳(毫秒,字符串格式)

    • Name
      price
      Type
      string
      Description

      成交价格(字符串格式)

    • Name
      amount
      Type
      string
      Description

      成交数量(字符串格式)

    • Name
      side
      Type
      string
      Description

      成交方向,"buy" 表示买入,"sell" 表示卖出

    • Name
      tradeId
      Type
      string
      Description

      成交ID,交易所提供的唯一标识符

请求

GET
/upgrade/v2/futures/trade-data
curl -G https://open.bbx.com/api/upgrade/v2/futures/trade-data \
  -d dbkey=btcswapusdt:okcoinfutures \
  -d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
  -d "SignatureNonce=RANDOM_NONCE" \
  -d "Timestamp=CURRENT_TIMESTAMP" \
  -d "Signature=YOUR_SIGNATURE"

响应

{
  "code": "0",
  "msg": "success",
  "data": [
    {
      "timestamp": "1750402519156",
      "price": "104672.1",
      "amount": "0.07",
      "side": "buy",
      "tradeId": "1600028593"
    },
    {
      "timestamp": "1750402519477",
      "price": "104672.1",
      "amount": "0.25",
      "side": "buy",
      "tradeId": "1600028594"
    },
    {
      "timestamp": "1750402519832",
      "price": "104672.1",
      "amount": "0.02",
      "side": "buy",
      "tradeId": "1600028595"
    }
  ]
}

数据特点:

  • 完整性: 包含完整的成交明细,包括价格、数量、方向等信息
  • 时序性: 数据按时间戳排序,支持精确的时间范围查询
  • 大容量: 支持大批量数据查询,最多1000条记录

使用场景:

  • 交易分析: 分析特定时间段的成交活跃度和价格变化
  • 市场监控: 实时监控交易所的成交情况
  • 量化策略: 为量化交易提供精确的成交数据支持
  • 价格发现: 通过成交数据分析价格形成机制

注意事项:

  • 推荐使用 limit 参数控制返回数据量,避免单次查询过大
  • 长时间范围查询可能返回大量数据,建议分批次获取
  • 数据按照交易所原始时间戳排序,确保时序准确性

您对本页面是否满意?