NAV Navbar
json

更新日志

版本 时间 更新内容
V0.1.6
2023 JUL 1
* orders、trades 相关接口和 websocket 频道添加手续费抵扣字段
V1.1.5
2023 MAR 15
* 使用费率等级, 废弃下面接口里面分费率.
GET /spot/v1/configs
* 输出 GET /spot/v1/account_configs
V1.1.4
2023 FEB 17
* GET /um/v1/accounts 响应添加字段 total_future_value, total_option_value, future_value
V1.1.3
2022 JAN 18
* API跟pair/currency有关的接口增加字段: display name, 给界面展示使用.
V1.1.2
2022 DEC 15
* GET /spot/v1/user/trades 和websocket trade 频道增加 label
* 新接口 GET /spot/v1/market/summary
V1.1.1
2022 JUN 2
* K线增加精度(minutes): 360, 720
V1.1.0
2022-04-22
* GET /spot/v1/accounts 不再显示USDC余额(USDC已经被移除)
* 币对查询 GET /spot/v1/instruments 添加 active 参数以及返回添加 display_status 字段。
V1.0.7
2022-01-20
* 现货支持批量下单/改单
V1.0.6
2021-11-11
* 统一保证金模式下,下单新增价格区间限制
* 统一保证金模式下市价单转化为banded-market订单.
V1.0.5
2021-08-10
* websocket order_book频道新增推送频率fixed100ms
* websocket新增RPC: cancel_on_disconnect
V1.0.4
2021-07-20
* 接口 POST /spot/v1/ordersPOST /spot/v1/amend_orders 新增 self_trading_mode字段. 默认值为0(不开启自成交,如果出现自成交的情况会撤销taker单,用户如果不关心自成交功能可以忽略self_trading_mode字段)
* 接口POST /spot/v1/amend_orders 新增 mmp 字段以支持修改订单MMP
* 为了支持自成交交易,接口GET /spot/v1/user/trades去掉 offset 参数和has_more分页信息.
* 如果用户有自成交, 那么接口GET /spot/v1/user/trades返回的trade_id不是唯一的,存在两笔trade拥有相同的trade_id,不同的taker/maker order_id.
V1.0.3
2021-07-01
* 新增 GET /spot/v1/system/cancel_only_status
* 增加文档 GET /spot/v1/instruments步长/最小值输出实际精度
* 新增 GET /spot/v1/mmp_state, POST /spot/v1/update_mmp_config, POST /spot/v1/reset_mmp, websocket mmp_frozen 频道
V1.0.2
2021-06-15
* POST /spot/v1/ordersPOST /spot/v1/amend_orders 的相应数据返回更新后的price,qty,cancel_reason
* 添加 qty_min 限制,这是base currency的最小单位,不再用以前的 qty_step
* 添加 invite-debateinvite-rebate-refund 两种资产流水类型
* 充值失败和撤销提币类型改为 bad-depositwithdraw-revert 两种资产流水类型,不用原来的 deposit-rollbackwithdraw-refund
* 在POST /spot/v1/orders文档部分,添加buy-market订单状态说明
* 新增 cod REST API: POST /spot/v1/user_configs/codGET /spot/v1/user_configs/cod
V1.0.0
2021-05-26
* 初始中文版本

介绍

欢迎访问bit.com的API文档,您可以通过API形式获取市场数据、完成交易、管理您的账户。
API文档包含3个部分:文档左侧为目录;中间为API接口说明,右侧为示例代码。
如何联系我们:
网站:https://www.bit.com
用户支持:[email protected]
VIP服务:[email protected]
Telegram中文服务:https://t.me/bitcom_exchange_cn

做市商项目

欢迎广大做市商参与BIT长期做市项目。
提供以下信息发送邮件至: [email protected]
1、BIT账户信息;
2、除邮箱外的有效联系方式;
邮件里需注明所申请的做市商类别 (可多选):
• BIT现货做市商申请
• BIT交割合约做市商申请
• BIT永续合约做市商申请
• BIT期权合约做市商申请
为鼓励做市商为平台提供更好的流动性,可以享受交易手续费优惠。具体做市责任及手续费申请后提供。
*做市商项目的最终解释权归BIT所有。

用户手册

在bit.com 我们提供数字资产现货、合约、期权等衍生品交易服务。 有两种方式可以调用我们的API接口:Rest 和 Websocket。

测试环境访问地址

生产环境访问地址

访问限制

为了保证系统运行效率,bit.com实施API访问限流措施。公有接口按IP进行频率限制,私有接口按UID进行频率限制。当请求频率超限时,会返加“429 too many requests” 提示。每个UID的API限制参数可在bit.com网站的交易中心页面进行查看。如需提高限制参数,请联系我们的用户支持([email protected])。
API接口调用次数按类别计算,该类别下的接口一起共享api访问频率限制。如现货公有接口共8个,这8个接口1秒内调用的次数之和不能超过10次。

账户模式使用指引

Bit.com现支持两种账户类型,经典模式(Classic mode)和统一保证金模式(Unified margin account mode)。不同模式主要影响账户数据和交易日志的获取。用户需进行账户类型查询后,根据自己的账户类型,使用不同接口。 统一交易账户以下简写为UM(Unified margin trade account)账户。
统一保证金模式以下简写为UM(Unified margin account mode)模式。

查询自己的账户类型及相关配置

统一保证金模式下的钱包功能

统一保证金模式下的交易功能

统一保证金模式下的订阅功能

鉴权

私有接口必填字段


如果鉴权失败,会返回错误码412“AkID is valid”。

签名算法

    #########
    # Python code to calc BIT.COM API signature
    #########
    import hashlib
    import hmac

    def encode_list(self, item_list):
        list_val = []
        for item in item_list:
            obj_val = self.encode_object(item)
            list_val.append(obj_val)
        sorted_list = sorted(list_val)
        output = '&'.join(sorted_list)
        output = '[' + output + ']'
        return output

    def encode_object(self, obj):
        if isinstance(obj, (str, int)):
            return obj

        # treat obj as dict
        sorted_keys = sorted(obj.keys())
        ret_list = []
        for key in sorted_keys:
            val = obj[key]
            if isinstance(val, list):
                list_val = self.encode_list(val)
                ret_list.append(f'{key}={list_val}')
            elif isinstance(val, dict):
                # call encode_object recursively
                dict_val = self.encode_object(val)
                ret_list.append(f'{key}={dict_val}')
            elif isinstance(val, bool):
                bool_val = str(val).lower()
                ret_list.append(f'{key}={bool_val}')
            else:
                general_val = str(val)
                ret_list.append(f'{key}={general_val}')

        sorted_list = sorted(ret_list)
        output = '&'.join(sorted_list)
        return output

    def get_signature(self, http_method, api_path, param_map):
        str_to_sign = api_path + '&' + self.encode_object(param_map)
        print('str_to_sign = ' + str_to_sign)
        sig = hmac.new(self.secret_key.encode('utf-8'), str_to_sign.encode('utf-8'), digestmod=hashlib.sha256).hexdigest()
        return sig

    #########
    # END
    #########

  1. 请求参数:POST为JSON,其余部分为查询字符串
  2. 对签名进行编码,对于简单的json对象,请按字母顺序对参数进行排序,并把他们用“&”连接,如'param1=value1&param2=value2', then get str_to_sign = api_path + '&' + 'param1=value1&param2=value2'
  3. 对嵌套数组对象,对每个对象进行编码,并按字母顺序进行排序,使用“&”符号连接,并用[ ]括起来,如 str_to_sign = api_path + '&' + 'param1=value1&array_key1=[array_item1&array_item2]', 参见下面的例子
  4. 签名使用哈希算法,hex(hmac_sha256(str_to_sign, secret_key))
  5. 在请求参数中添加签名字段:对查询字符串,添加“&signature=YOUR_SIGNATURE”, 对JOSN请求体, 添加 {'signature':YOUR_SIGNATURE}


































GET 请求示例:

*Secret Key: eabc3108-dd2b-43df-a98d-3e2054049b73
*HTTP method: GET
*API Path: /v1/margins
*Query string: price=8000&qty=30&instrument_id=BTC-PERPETUAL&timestamp=1588242614000
*得到 str_to_sign = /v1/margins&instrument_id=BTC-PERPETUAL&price=8000&qty=30&timestamp=1588242614000

> echo -n "/v1/margins&instrument_id=BTC-PERPETUAL&price=8000&qty=30&timestamp=1588242614000" | openssl dgst -sha256 -hmac "eabc3108-dd2b-43df-a98d-3e2054049b73"

> e3be96fdd18b5178b30711e16d13db406e0bfba089f418cf5a2cdef94f4fb57d

sig = hex(hmac_sha256(str_to_sign, secret_key)) = e3be96fdd18b5178b30711e16d13db406e0bfba089f418cf5a2cdef94f4fb57d

*最后JSON请求体为: { "instrument_id": "BTC-27MAR20-9000-C", "order_type": "limit", "price": "0.021", "qty": "3.14", "side": "buy", "time_in_force": "gtc", "stop_price": "", "stop_price_trigger": "", "auto_price": "", "auto_price_type": "", "timestamp": 1588242614000, "signature": "e3be96fdd18b5178b30711e16d13db406e0bfba089f418cf5a2cdef94f4fb57d" }

POST 请求示例:

Secret Key: eabc3108-dd2b-43df-a98d-3e2054049b73
HTTP method: POST
API Path: /v1/orders
JSON body:
{ "instrument_id": "BTC-27MAR20-9000-C", "order_type": "limit", "price": "0.021", "qty": "3.14", "side": "buy", "time_in_force": "gtc", "stop_price": "", "stop_price_trigger": "", "auto_price": "", "auto_price_type": "", "timestamp": 1588242614000 }

得到 str_to_sign = /v1/orders&auto_price=&auto_price_type=&instrument_id=BTC-27MAR20-9000-C&order_type=limit&price=0.021&qty=3.14&side=buy&stop_price=&stop_price_trigger=&time_in_force=gtc&timestamp=1588242614000

> echo -n "/v1/orders&auto_price=&auto_price_type=&instrument_id=BTC-27MAR20-9000-C&order_type=limit&price=0.021&qty=3.14&side=buy&stop_price=&stop_price_trigger=&time_in_force=gtc&timestamp=1588242614000" | openssl dgst -sha256 -hmac "eabc3108-dd2b-43df-a98d-3e2054049b73"

> 34d9afa68830a4b09c275f405d8833cd1c3af3e94a9572da75f7a563af1ca817

sig = hex(hmac_sha256(str_to_sign, secret_key)) = 34d9afa68830a4b09c275f405d8833cd1c3af3e94a9572da75f7a563af1ca817

最后JSON请求体为: { "instrument_id": "BTC-27MAR20-9000-C", "order_type": "limit", "price": "0.021", "qty": "3.14", "side": "buy", "time_in_force": "gtc", "stop_price": "", "stop_price_trigger": "", "auto_price": "", "auto_price_type": "", "timestamp": 1588242614000, "signature": "34d9afa68830a4b09c275f405d8833cd1c3af3e94a9572da75f7a563af1ca817" }

POST 请求带 boolean 字段

例如以POST /v1/orders 为例 (post_only 字段),

例子

request

得到 string to sign

POST 请求带 array 字段

for item in object_array:
    str_list.add(encode(item))
str_list.sorted()
str_to_sign = '&'.join(str_list)

以 POST /v1/blocktrades 为例:

私钥是 eabc3108-dd2b-43df-a98d-3e2054049b73

例子

request

得到 string to sign

接口目录

路径 方法 描述 范围 限速归类 权限
/spot/v1/orders POST 下单 private 现货交易接口 现货交易
/spot/v1/cancel_orders POST 取消订单 private 现货交易接口 现货交易
/spot/v1/amend_orders POST 修改订单 private 现货交易接口 现货交易
/spot/v1/update_mmp_config POST 更新 MMP 设置 private 现货交易接口 现货交易
/spot/v1/reset_mmp POST 重置 MMP 状态 private 现货交易接口 现货交易
/spot/v1/user_configs/cod POST 更新 cod 设置 private 现货交易接口 现货交易
/spot/v1/open_orders GET 未结订单 private 现货其他接口 读取
/spot/v1/orders GET 订单历史 private 现货其他接口 读取
/spot/v1/user/trades GET 用户交易记录 private 现货其他接口 读取
/spot/v1/accounts GET 现货账户信息 private 现货其他接口 读取
/spot/v1/transactions GET 现货交易日志 private UM 其他接口 读取
/um/v1/account_mode GET 查询账户类型 private UM 其他接口 读取
/um/v1/accounts GET 统一 UM 账户信息 private UM 其他接口 读取
/um/v1/transactions GET 统一 UM 交易日志 private 现货其他接口 读取
/um/v1/interest_records GET 查询利息记录 private UM 其他接口 读取
/spot/v1/ws/auth GET 获取 websocket 的 token private 现货其他接口 读取
/spot/v1/mmp_state GET 查询 Mmp 状态 private 现货其他接口 读取
/spot/v1/user_configs/cod GET 查询 cod 配置 private 现货其他接口 读取
/spot/v1/system/time GET 查询服务时间戳 public 现货公有接口 /
/spot/v1/system/version GET 查询 API 版本 public 现货公有接口 /
/spot/v1/system/cancel_only_status GET 查询 cancel only 状态 public 现货公有接口 /
/spot/v1/instruments GET 查询产品列表 public 现货公有接口 /
/spot/v1/orderbooks GET 查询市场深度 public 现货公有接口 /
/spot/v1/market/trades GET 查询市场最新交易 public 现货公有接口 /
/spot/v1/klines GET 查询 Kline public 现货公有接口 /
/spot/v1/tickers GET 查询市场 ticker public 现货公有接口 /
/spot/v1/market/summary GET 查询市场价格汇总信息 public 现货公有接口 /
/um/v1/index_price GET 查询指数价格 public UM 公有接口 /
/um/v1/loan_rates GET 查询借币利率 public UM 公有接口 /

API SDK

Python

Python REST API (现货,USDT本位&USD本位) python-umapi

Go

Go API (币本位) go-api

Java

Java API for (现货,USDT本位&USD本位) java-api

系统接口

查询服务器时间

GET /spot/v1/system/time

curl "https://betaspot-api.bitexch.dev/spot/v1/system/time"

返回数据

{
  "code": 0,
  "message": "",
  "data": 1587884283175
}

查询服务器时间

请求参数

None

返回数据

字段名称 数据类型 说明
data integer 服务器时间戳

查询API版本

GET /spot/v1/system/version

curl "https://betaspot-api.bitexch.dev/spot/v1/system/version"

返回数据

{
  "code": 0,
  "message": "",
  "data": "v1.0"
}

查询API版本。

请求参数

None

返回数据

字段名称 数据类型 说明
data string API版本

查询 cancel only 状态

GET /spot/v1/system/cancel_only_status

curl "https://betaapi.bitexch.dev/spot/v1/system/cancel_only_status"

返回数据


{
    "code": 0,
    "message": "",
    "data": {
        "status": 0,
        "remain_ms": 0
    }
}

当bit.com在进行系统维护、升级等特殊时期,整个系统会处于只允许撤销订单,不能下新订单的状态(即cancel only状态)。此接口用于查询系统是否处于cancel-only 状态,还有多长时间结束。

status
status=1: cancel-only生效中
status=0: cancel-only已经结束,可以下单

remain_ms
Cancel-only 还有多长时间结束(毫秒)

请求参数

None

返回数据

字段名称 数据类型 说明
status integer Cancel-only 状态
remain_ms integer Cancel-only 还有多长时间结束(毫秒)

公共市场数据

获取币对

GET /spot/v1/instruments

curl "https://betaspot-api.bitexch.dev/spot/v1/instruments"

返回数据

{
    "code": 0,
    "message": "",
    "data": [
        {
            "pair": "BTC-USDT",
            "base_currency": "BTC",
            "quote_currency": "USDT",
            "price_step": "0.01",
            "qty_step": "0.000001",
            "qty_min": "0.0001",
            "quote_qty_step": "0.00000001",
            "quote_qty_min": "10",
            "taker_fee_rate": "0.00070000",
            "maker_fee_rate": "0.00020000",
            "groups": [
                "1",
                "10",
                "100",
                "1000"
            ],
            "group_steps": [
                "0.01000000",
                "0.10000000",
                "1.00000000",
                "10.00000000"
            ],
            "status": 1,
            "display_status": 1
        },
        {
            "pair": "ETH-USDT",
            "base_currency": "ETH",
            "quote_currency": "USDT",
            "price_step": "0.01",
            "qty_step": "0.0001",
            "qty_min": "0.001",
            "quote_qty_step": "0.00000001",
            "quote_qty_min": "10",
            "taker_fee_rate": "0.00070000",
            "maker_fee_rate": "0.00020000",
            "groups": [
                "1",
                "10",
                "100",
                "1000"
            ],
            "group_steps": [
                "0.01000000",
                "0.10000000",
                "1.00000000",
                "10.00000000"
            ],
            "status": 1,
            "display_status": 1
        }
    ]
}

获取交易币对的列表,查询各币对的交易限制和价格步长等信息。

请求参数

参数名称 数据类型 是否必填 默认值 说明
active string false "true" 是否查询活跃币对

返回数据

字段名称 数据类型 说明
pair string 币对名称
base_currency string 交易货币币种
quote_currency string 计价货币币种
price_step string 交易价格步长,交易价格必须为步长的整数倍(输出实际精度)
qty_step string 交易数量步长,交易数量必须为步长的整数倍(输出实际精度)
qty_min string 最小交易数量 (base currency, 输出实际精度)
quote_qty_step string 计价货币交易数量步长,计价货币数量必须为步长的整数倍(输出实际精度)
quote_qty_min string 计价货币最小交易量(输出实际精度)
taker_fee_rate string Taker手续费率(已废弃,目前使用vip费率等级)
maker_fee_rate string Maker手续费率(已废弃,目前使用vip费率等级)
groups string array 聚合倍数(用于websocket订单频道聚合使用)返回一串价格步长,如[1,10,50,100]
group_steps string array 聚合步长
status int 币对状态, 1=活跃, 2=不活跃
display_status int 页面展示状态 (内部使用, 1=展示, 2=隐藏)

获取指数

GET /um/v1/index_price

curl "https://betaapi.bitexch.dev/um/v1/index_price?currency=BTC&quote_currency=USDT"

返回数据

{
    "code": 0,
    "message": "",
    "data": [
        {
            "index_name": "BTC-USDT",
            "index_price": "50000"
        }
    ]
}

获取以USD或USDT为计价币种的指数。

支持币对:

USD: BTC-USD, ETH-USD, BCH-USD

USDT: BTC-USDT, ETH-USDT, BCH-USDT, USDC-USDT

币种参数为非必填,如果币种传入为空,则返回某计价币种下的所有币对指数。

查询参数

参数名称 数据类型 是否必填 默认值 说明
currency string false "" 币种
quote_currency string true "" 计价币种(目前支持USD和USDT)

返回数据

参数名称 数据类型 说明
index_name string 指数名称
index_price string 指数价格

查询借币利率

GET /um/v1/loan_rates

curl "https://betaapi.bitexch.dev/um/v1/loan_rates?currency=ETH"

返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "currency": "ETH",
        "last_hour_rate": "0.03000000"
    }
}

获取过去最近一小时的借币利率。

查询参数

参数名称 数据类型 是否必填 默认值 说明
currency string false "" 币种

返回数据

参数名称 数据类型 说明
currency string 币种
last_hour_rate string 过去一小时的平均借币利率

获取市场深度

GET /spot/v1/orderbooks

curl "https://betaspot-api.bitexch.dev/spot/v1/orderbooks?pair=BTC-USDT"

返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "pair": "BTC-USDT",
        "timestamp": 1585299600000,
        "asks": [
            ["60000", "3.00000000"],
            ["60030", "0.70000000"],
            ["60100", "18.00000000"]
        ],
        "bids": [
            ["59992", "0.30000000"],
            ["59990", "2.00000000"],
            ["59987", "5.60000000"]
        ]
    }
}

根据币对获取市场深度。

请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string true "" 币对名称
level int false 5 深度层数,范围:[1,50]

返回数据

字段名称 数据类型 说明
pair string 币对名称
timestamp integer 时间戳
asks string Asks队列 [price, qty]
bids string Bids队列 [price, qty]

获取市场成交记录

GET /spot/v1/market/trades

curl "https://betaspot-api.bitexch.dev/spot/v1/market/trades?pair=BTC-USDT&start_time=1617243797588&end_time=1617596597588"

返回数据

{
    "code": 0,
    "message": "",
    "data": [
        {
            "created_at": 1617592997588,
            "trade_id": "7",
            "pair": "BTC-USDT",
            "price": "61030.00000000",
            "qty": "0.02000000",
            "side": "sell"
        }
    ]
}

获取市场成交记录。

请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string true "" 币对名称
start_time integer false one month ago 起始时间戳
end_time integer false now 结束时间戳
count int false 100 返回数(默认100,最大500条)

返回数据

字段名称 数据类型 说明
trade_id integer 交易ID
pair string 币对名称
created_at integer 成交时间戳
price string 成交价格
qty string 成交数量
side string 交易方向

获取K线

GET /spot/v1/klines

curl "https://betaspot-api.bitexch.dev/spot/v1/klines?pair=BTC-USDT&start_time=1585296000000&end_time=1585596000000&timeframe_min=30"

返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "close": [
            60050
        ],
        "high": [
            60100
        ],
        "low": [
            60008
        ],
        "open": [
            60030
        ],
        "timestamps": [
            1585296000000
        ],
        "volume": [
            310.2
        ]
    }
}

按照币对获取K线数据。 K线接口返回6个序列数据:开盘价序列、最高价序列、最低价序列、收盘价序列、时间戳序列和交易量序列

支持K线周期:

K线周期 说明
1 1 分钟
3 3 分钟
5 5 分钟
15 15 分钟
30 30 分钟
60 60 分钟
240 240 分钟
1d 1天
1w 1周(自然周)
1m 1月(自然月)

请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string true "" 币对名称
start_time integer true one month ago 起始时间戳
end_time integer true now 结束时间戳
timeframe_min string true "" K线周期
count int false 500 返回数(默认500,最大1000条)

返回数据

字段名称 数据类型 说明
open float array 开盘价
high float array 最高价
low float array 最低价
close float array 收盘价
timestamps float array 时间戳
volume float array 成交量

获取行情信息

GET /spot/v1/tickers

curl "https://betaspot-api.bitexch.dev/spot/v1/tickers?pair=BTC-USDT"

返回数据

{
    "code": 0,
    "message": "",
    "data":{
        "time":1589126498813,
        "pair":"BTC-USDT",
        "best_bid":"60050.00000000",
        "best_ask":"60020.00000000",
        "best_bid_qty":"13.50000000",
        "best_ask_qty":"21.00000000",
        "last_price":"60030.00000000",
        "last_qty":"30.00000000",
        "open24h":"60040.00000000",
        "high24h":"60100.00000000",
        "low24h":"60000.00000000",
        "price_change24h":"0.03000000",
        "volume24h":"300.00000000",
        "quote_volume24h":"18000000.00000000"
    }

}

通过币对获取行情数据。

请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string true "" 币对名称

返回数据

字段名称 数据类型 说明
pair string 币对名称
last_price string 最新成交价
last_qty string 最新成交量
open24h string 24小时开盘价
high24h string 24小时最高价
low24h string 24小时最低价
volume24h string 24小时成交量
quote_volume24h string 24小时计价币种成交量
price_change24h string 24小时价格变化
best_bid string 最佳买入价
best_ask string 最佳卖出价
best_bid_qty string 最佳买入数量
best_ask_qty string 最佳卖出数量

获取市场价格汇总信息

GET /spot/v1/market/summary

curl "https://betaspot-api.bitexch.dev/spot/v1/market/summary?quote_ccy=USD"

返回数据

{
    "code": 0,
    "message": "",
    "data":[
        {
            "time":1589126498813,
            "pair":"BTC-USD",
            "best_bid":"60050.00000000",
            "best_ask":"60020.00000000",
            "best_bid_qty":"13.50000000",
            "best_ask_qty":"21.00000000",
            "last_price":"60030.00000000",
            "last_qty":"30.00000000",
            "open24h":"60040.00000000",
            "high24h":"60100.00000000",
            "low24h":"60000.00000000",
            "price_change24h":"0.03000000",
            "volume24h":"300.00000000",
            "quote_volume24h":"18000000.00000000"
        }, 
        {
            "time":1589126498814,
            "pair":"ETH-USD",
            "best_bid":"3050.00000000",
            "best_ask":"3020.00000000",
            "best_bid_qty":"13.50000000",
            "best_ask_qty":"21.00000000",
            "last_price":"3030.00000000",
            "last_qty":"30.00000000",
            "open24h":"3040.00000000",
            "high24h":"3100.00000000",
            "low24h":"3000.00000000",
            "price_change24h":"0.03000000",
            "volume24h":"300.00000000",
            "quote_volume24h":"900000.00000000"
        }
    ]


}

通过计价货币币种获取市场价格汇总信息。

请求参数

字段名称 数据类型 是否必填 默认值 说明
quote_ccy string true "" 计价货币币种

返回数据

字段名称 数据类型 说明
pair string 币对名称
last_price string 最新成交价
last_qty string 最新成交量
open24h string 24小时开盘价
high24h string 24小时最高价
low24h string 24小时最低价
volume24h string 24小时成交量
quote_volume24h string 24小时计价币种成交量
price_change24h string 24小时价格变化
best_bid string 最佳买入价
best_ask string 最佳卖出价
best_bid_qty string 最佳买入数量
best_ask_qty string 最佳卖出数量

账户信息


查询账户模式

GET /um/v1/account_mode


curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaapi.bitexch.dev/um/v1/account_mode?timestamp=1589521383462&signature=30f7cf5c8018f5dfee515533e25a1813e9120be7898b62fb85a2f4129f3e9528"

返回数据


// account_mode = Um
{
    "code": 0,
    "message": "",
    "data": {
        "user_id": 1,
        "account_mode": "um",
        "auto_borrow": true,
        "um_risk_mode": "regular",
        "classic_accounts": []
    }
}

// account_mode = classic
{
    "code": 0,
    "message": "",
    "data": {
        "user_id": 1,
        "account_mode": "classic",
        "auto_borrow": false,
        "um_risk_mode": "",
        "classic_accounts": [
            {
                "currency": "BCH",
                "classic_risk_mode": "portfolio_margin"
            },
            {
                "currency": "BTC",
                "classic_risk_mode": "portfolio_margin"
            },
            {
                "currency": "ETH",
                "classic_risk_mode": "portfolio_margin"
            }
        ]
    }
}

查询账户类型。账户类型有两类:经典模式和统一UM模式。另外还有迁移中的临时状态。

查询参数

None

返回数据

字段名称 数据类型 说明
user_id int 用户ID
account_mode string 账户模式
auto_borrow bool 是否自动借币
um_risk_mode string 统一模式下 风控模式 (当账户类型为统一模式时有效)
classic_accounts array 经典模式下分币种的风控模式(当账户类型为经典模式时有效)
字段名称 数据类型 说明
currency string 币种
classic_risk_mode string 风控模式

现货账户信息

GET /spot/v1/accounts


curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaspot-api.bitexch.dev/spot/v1/accounts?timestamp=1589521383462&signature=30f7cf5c8018f5dfee515533e25a1813e9120be7898b62fb85a2f4129f3e9528"

返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "user_id": "1001",
        "balances": [
          {
            "currency": "BTC",
            "available":"99.59591877",
            "frozen":"0.00000000"
          }
        ]
    }
}

请求参数

返回数据

字段名称 数据类型 说明
user_id string 用户ID
balances array 余额
字段名称 数据类型 说明
currency string 币种名称
available string 可用余额
frozen string 冻结余额

现货交易日志

GET /spot/v1/transactions

curl -H "X-Bit-Access-Key: ak-8e97ac6c-8075-4a94-b2bb-38bd537619fa" "https://betaspot-api.bitexch.dev/spot/v1/transactions?currency=BTC&type=trade-recv&limit=2&timestamp=1620369292928&signature=35d76033f6e251ce85524ec4310417fd555953fff00cd33f3a94e3d27d062965" 


返回数据

{
    "code": 0,
    "message": "",
    "data": [
        {
            "tx_time": 1619688616411,
            "ccy": "BTC",
            "tx_type": "trade-recv",
            "change": "0.09970000",
            "balance": "0.99700000",
            "price": "58000.00000000",
            "fee_paid": "0.00030000",
            "trade_id": "557364",
            "order_id": "236142",
            "pair": "BTC-USDT",
            "order_side": "buy",
            "remark": ""
        },
        {
            "tx_time": 1619688616411,
            "ccy": "BTC",
            "tx_type": "trade-recv",
            "change": "0.09970000",
            "balance": "0.89730000",
            "price": "58000.00000000",
            "fee_paid": "0.00030000",
            "trade_id": "557363",
            "order_id": "236142",
            "pair": "BTC-USDT",
            "order_side": "buy",
            "remark": ""
        }
    ],
    "page_info": {
        "has_more": true
    }
}

请求参数

字段名称 数据类型 是否必填 默认值 说明
currency string true "" 币种名称
start_time integer false 0 起始时间戳
end_time integer false 0 结束时间戳
type string false "" 交易日志类型
offset int false 1 分页偏移(第一页为1)
limit int false 100 分页大小

返回数据

字段名称 数据类型 说明
tx_time integer 时间戳
ccy string 币种名称
tx_type string 交易日志类型
change string 账户变动
balance string 变动后余额
price string 成交价格(只针对trade相关的交易日志)
fee_paid string 手续费
order_id string 订单ID
trade_id string 交易ID
pair string 币对名称
order_side string 订单方向
remark string 备注

统一UM账户信息

GET /um/v1/accounts


curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaapi.bitexch.dev/um/v1/accounts?timestamp=1589521383462&signature=30f7cf5c8018f5dfee515533e25a1813e9120be7898b62fb85a2f4129f3e9528"

返回数据


{
    "code": 0,
    "message": "",
    "data": {
        "user_id": 481554,
        "created_at": 1649923879505,
        "total_collateral": "3170125.05978108",
        "total_margin_balance": "3170125.05978108",
        "total_available": "3169721.64891398",
        "total_initial_margin": "403.41086710",
        "total_maintenance_margin": "303.16627631",
        "total_initial_margin_ratio": "0.00012725",
        "total_maintenance_margin_ratio": "0.00009563",
        "total_liability": "0.00000000",
        "total_unsettled_amount": "-0.84400340",
        "total_future_value": "1.26000000",
        "total_option_value": "0.00000000",
        "spot_orders_hc_loss": "0.00000000",
        "total_position_pnl": "1225.53245820",
        "details": [
            {
                "currency": "BTC",
                "equity": "78.13359310",
                "liability": "0.00000000",
                "index_price": "41311.20615385",
                "cash_balance": "78.13360190",
                "margin_balance": "78.13359310",
                "available_balance": "78.12382795",
                "initial_margin": "0.00976516",
                "spot_margin": "0.00000000",
                "maintenance_margin": "0.00733859",
                "potential_liability": "0.00000000",
                "interest": "0.00000000",
                "interest_rate": "0.07000000",
                "pnl": "0.02966586",
                "total_delta": "0.48532539",
                "session_rpl": "0.00001552",
                "session_upl": "-0.00003595",
                "option_value": "0.00000000",
                "option_pnl": "0.00000000",
                "option_session_rpl": "0.00000000",
                "option_session_upl": "0.00000000",
                "option_delta": "0.00000000",
                "option_gamma": "0.00000000",
                "option_vega": "0.00000000",
                "option_theta": "0.00000000",
                "future_value": "1.23000000",
                "future_pnl": "0.02966586",
                "future_session_rpl": "0.00001552",
                "future_session_upl": "-0.00003595",
                "future_session_funding": "0.00001552",
                "future_delta": "0.48532539",
                "future_available_balance": "76.72788921",
                "option_available_balance": "76.72788921",
                "unsettled_amount": "-0.00002043",
                "usdt_index_price": "41311.20615385"
            },
            {
                "currency": "ETH",
                "equity": "1.99960000",
                "liability": "0.00000000",
                "index_price": "3119.01923077",
                "cash_balance": "1.99960000",
                "margin_balance": "1.99960000",
                "available_balance": "1.99960000",
                "initial_margin": "0.00000000",
                "spot_margin": "0.00000000",
                "maintenance_margin": "0.00000000",
                "potential_liability": "0.00000000",
                "interest": "0.00000000",
                "interest_rate": "0.07000000",
                "pnl": "0.00000000",
                "total_delta": "0.00000000",
                "session_rpl": "0.00000000",
                "session_upl": "0.00000000",
                "option_value": "0.00000000",
                "option_pnl": "0.00000000",
                "option_session_rpl": "0.00000000",
                "option_session_upl": "0.00000000",
                "option_delta": "0.00000000",
                "option_gamma": "0.00000000",
                "option_vega": "0.00000000",
                "option_theta": "0.00000000",
                "future_value": "0.03000000",
                "future_pnl": "0.00000000",
                "future_session_rpl": "0.00000000",
                "future_session_upl": "0.00000000",
                "future_session_funding": "0.00000000",
                "future_delta": "0.00000000",
                "future_available_balance": "1.99960000",
                "option_available_balance": "1.99960000",
                "unsettled_amount": "0.00000000",
                "usdt_index_price": "3119.01923077"
            }
        ],
        "usdt_total_collateral": "3170125.05978108",
        "usdt_total_margin_balance": "3170125.05978108",
        "usdt_total_available": "3169721.64891398",
        "usdt_total_initial_margin": "403.41086710",
        "usdt_total_maintenance_margin": "303.16627631",
        "usdt_total_initial_margin_ratio": "0.00012725",
        "usdt_total_maintenance_margin_ratio": "0.00009563",
        "usdt_total_liability": "0.00000000",
        "usdt_total_unsettled_amount": "-0.84400340"
    }
}



UM用户,用此接口获取统一交易账户信息。

PM total_initial_margin_ratio 公式
true (total_im + spot_haircut_loss) / collateral
false (total_im + spot_haircut_loss) / margin_balance

1)如果分子和分母都为0,返回0。
2)否则如果分母 <=0, 返回 "infinity".
3)返回分子/分母

PM total_maintenance_margin_ratio 公式
true total_maintenance_margin / collateral
false total_maintenance_margin / margin_balance

1)如果分子和分母都为0,返回0。
2)否则如果分母 <=0, 返回 "infinity".
3)返回分子/分母

请求参数

参数名称 数据类型 是否必填 默认值 说明
with_linear_pair_margins string false "" linear_pair_margins字段中返回按正向币对分类的保证金数值. 仅支持Portfolio Margin下返回.

返回数据

字段名称 数据类型 说明
user_id int 用户ID
created_at int 时间戳(查询时刻)
total_collateral string 账户维度USD总担保品金额
total_margin_balance string 账户维度USD总保证金余额
total_available string 账户维度USD总可用余额
total_initial_margin string 账户维度USD总初始保证金
total_maintenance_margin string 账户维度USD总维持保证金
total_initial_margin_ratio string 账户维度USD总初始保证金率,可能会返回"infinity"
total_maintenance_margin_ratio string 账户维度USD总维持保证金率,可能会返回"infinity"
total_liability string 账户维度USD总负债
total_unsettled_amount string 账户维度USD总待结金额
total_future_value string 期货总市值
total_option_value string 期权总市值
spot_orders_hc_loss string 现货挂单损失
total_position_pnl string 账户维度USD损益 [SUM(ccy.pnl * ccy.index-price)]
details array 分币种账户信息
usdt_total_collateral string (兼容旧字段) 等于 total_collateral
usdt_total_margin_balance string (兼容旧字段) 等于 total_margin_balance
usdt_total_available string (兼容旧字段) 等于 total_available
usdt_total_initial_margin string (兼容旧字段) 等于 total_initial_margin
usdt_total_maintenance_margin string (兼容旧字段) 等于 total_maintenance_margin
usdt_total_initial_margin_ratio string (兼容旧字段) 等于 total_initial_margin_ratio
usdt_total_maintenance_margin_ratio string (兼容旧字段) 等于 total_maintenance_margin_ratio
usdt_total_liability string (兼容旧字段) 等于 total_liability
usdt_total_unsettled_amount string (兼容旧字段) 等于 total_unsettled_amount
字段名称 数据类型 说明
currency string 币种
equity string 权益
liability string 负债
index_price string USD指数价格
usdt_index_price string (兼容旧字段) 等于 index_price
cash_balance string 现金余额
margin_balance string 保证金余额
available_balance string 可用余额
initial_margin string 初始保证金
spot_margin string 现货冻结金额
maintenance_margin string 维持保证金
potential_liability string 潜在负债
interest string 借币利息
interest_rate string 借币利率
pnl string 币种维度损益
total_delta string 账户delta总值
session_rpl string 已实现损益
session_upl string 未实现损益
option_value string 期权市值
option_pnl string 期权损益
option_session_rpl string 期权已实现损益
option_session_upl string 期权未实现损益
option_delta string 期权delta
option_gamma string 期权gamma
option_vega string 期权vega
option_theta string 期权theta
future_value string 期货市值
future_pnl string 期货损益
future_session_rpl string 期货已实现损益
future_session_upl string 期货未实现损益
future_session_funding string 期货funding
future_delta string 期货delta
future_available_balance string 期货最大可用余额
option_available_balance string 期权最大可用余额
unsettled_amount string 待结金额

当请求中有with_linear_pair_margins=true参数时, 在linear_pair_margins字段中返回一个数组. 仅支持Portfolio Margin下返回.

字段名称 数据类型 说明
pair string 正向币对名称
initial_margin string 币对初始保证金
maintenance_margin string 币对维持保证金

统一UM账户交易日志

GET /um/v1/transactions

curl -H "X-Bit-Access-Key: ak-8e97ac6c-8075-4a94-b2bb-38bd537619fa" "https://betaapi.bitexch.dev/um/v1/transactions?currency=BTC&type=trade-recv&limit=2&timestamp=1620369292928&signature=35d76033f6e251ce85524ec4310417fd555953fff00cd33f3a94e3d27d062965" 


返回数据

{
    "code": 0,
    "message": "",
    "data": [
        {
            "tx_time": 1631240595162,
            "tx_type": "deposit",
            "ccy": "BTC",
            "instrument_id": "",
            "direction": "",
            "qty": "3.20000000",
            "price": "",
            "position": "",
            "fee_paid": "0.00000000",
            "fee_rate": "",
            "funding": "",
            "change": "3.20000000",
            "balance": "107.00000000",
            "order_id": "",
            "trade_id": "",
            "remark": ""
        },
        {
            "tx_time": 1630722195162,
            "tx_type": "spot-trade-recv",
            "ccy": "BTC",
            "instrument_id": "BTC-USDT",
            "direction": "buy",
            "qty": "2.00000000",
            "price": "60000.00000000",
            "position": "",
            "fee_paid": "0.00030000",
            "fee_rate": "0.00000000",
            "funding": "",
            "change": "2.00000000",
            "balance": "102.00000000",
            "order_id": "9001",
            "trade_id": "3001",
            "remark": ""
        }
    ],
    "page_info": {
        "has_more": false
    }
}

查询统一交易账户的交易日志。

查询参数

参数名称 数据类型 是否必填 默认值 说明
currency string false "" 币种
instrument_id string false "" 产品名称
start_time integer false Three month ago 起始时间戳
end_time integer false Now 结束时间戳
type string false "" UM交易日志类型
offset int false 1 分页偏移(第一页为1)
limit int false 100 分页大小

返回数据

参数名称 数据类型 说明
tx_time integer 时间戳
tx_type string UM交易日志类型
ccy string 币种
instrument_id string 产品名称
direction string 方向: buy/sell
qty string 数量
price string 交易价格 (针对trade交易类型有效)
position string 期权/期货仓位
fee_paid string 手续费
fee_rate string 手续费率
funding string 资金费用
change string 账户变动
cash_flow string 现金流(现货cash_flow=change, 期权/期货请参考期权/期货的transactions文档)
balance string 变动后的余额
order_id string 订单ID
trade_id string 交易ID
remark string 备注

查询计息记录

GET /um/v1/interest_records


curl -H "X-Bit-Access-Key: ak-8e97ac6c-8075-4a94-b2bb-38bd537619fa" "https://betaapi.bitexch.dev/um/v1/interest_records?currency=BTC&timestamp=1631669478618&signature=3d4685f07751cd51f42ee631938f189cbe6e9712cc6d559881e5b3b6d1ba1224" 

返回数据

{
    "code": 0,
    "message": "",
    "data": [
        {
            "currency": "BTC",
            "time": 1631559600000,
            "loan_rate": "0.00300000",
            "liability": "100.00000000",
            "interest": "1.05000000"
        },
        {
            "currency": "BTC",
            "time": 1631556000000,
            "loan_rate": "0.00300000",
            "liability": "100.00000000",
            "interest": "1.06000000"
        },
        {
            "currency": "BTC",
            "time": 1631552400000,
            "loan_rate": "0.00300000",
            "liability": "100.00000000",
            "interest": "1.07000000"
        }
    ],
    "page_info": {
        "has_more": true
    }
}

只有UM模式用户可启用借币功能。此接口用于获取统一保证金UM账户的计息记录。

查询参数

参数名称 数据类型 是否必填 默认值 说明
currency string true "" 币种
start_time integer false One month ago 起始时间戳
end_time integer false Now 结束时间戳
offset int false 1 分页偏移(第一页为1)
limit int false 100 分页大小

返回数据

参数名称 数据类型 说明
currency string 币种
time integer 计息时间戳
loan_rate string 计息利率
liability string 计息负债
interest string 利息

开启或关闭COD(Cancel On Disconnect)

POST /spot/v1/user_configs/cod

curl -X POST "https://betaspot-api.bitexch.dev/spot/v1/user_configs/cod" -H "Content-Type: application/json" -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113"  -d '{"cod":true, "timestamp": 1590572422557, "signature": "3c8c2271a58e3d11dfbd262a6be40ebdd07e8f394a002db0065068b36bc66d5a"}'

返回数据

{
    "code": 0,
    "message": "",
    "data": {
    }
}

开启或关闭COD, 如果COD是开启状态, 同时全部私有频道的连接都断开的话, 这个账户的所有未结订单都会被撤销

请求参数

字段名称 数据类型 是否必填 默认值 说明
cod bool true "" 开启或关闭COD

返回数据

None


查询COD配置

GET /spot/v1/user_configs/cod

curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaspot-api.bitexch.dev/spot/v1/user_configs/cod?timestamp=1588932548594&signature=d642b046b247bf00ba285bb260582aadf33e98d2b47d26479b99cc1a7941f807"

返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "cod": true
    }
}

查询COD配置

请求参数

返回数据

字段名称 数据类型 说明
cod bool COD是否开启

查询MMP状态

GET /spot/v1/mmp_state

curl -H "X-Bit-Access-Key: ak-96cc0cbd-c501-448f-a32d-21228bc9648f" "https://betaspot-api.bitexch.dev/spot/v1/mmp_state?timestamp=1600050649936&signature=3a3c511ab776674c4a8db31135f22c8bf2bc5aac4eb0070c8c4d577e89e01643" 

返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "mmp_enabled": true,
        "mmp_user_configurable": true,
        "mmp_data": [
            {
                "pair": "BTC-USDT",
                "mmp_config": {
                    "window_ms": 2000,
                    "frozen_period_ms": 10000,
                    "qty_limit": "30.00000000",
                    "delta_limit": "10.00000000"
                },
                "mmp_state": {
                    "mmp_frozen_until_ms": -1,
                    "mmp_frozen": false
                }
            }
        ]
    }
} 

查询MMP状态.

mmp_enabled
MMP是否开启.

mmp_user_configurable
用户是否可以更改MMP配置, 如果为true,用户可以调用 POST /spot/v1/update_mmp_config

mmp_data
MMP 配置参数和状态列表,针对每一个交易对:

mmp_frozen_until_ms
mmp_frozen_until_ms 显示冻结状态.
mmp_frozen_until_ms > 0: 冻结到指定时间戳,或者手动reset MMP解冻
mmp_frozen_until_ms = 0: 冻结直到reset MMP解冻
mmp_frozen_until_ms = -1: 解冻状态

mmp_frozen
显示MMP是否已经冻结.

请求参数

None

返回数据

字段名称 数据类型 说明
mmp_enabled bool MMP 是否开启
mmp_user_configurable bool 用户是否可以修改MMP配置
mmp_data array MMP配置和状态列表(如下)
字段名称 数据类型 说明
window_ms integer MMP滚动时间窗口
frozen_period_ms integer MMP冻结时间窗口
qty_limit string MMP数量上限 (in base currency, e.g. BTC)
delta_limit string MMP delta 上限 (in base currency, e.g. BTC)
字段名称 数据类型 说明
mmp_frozen_until_ms integer MMP冻结时间戳
mmp_frozen bool MMP是否冻结

更新MMP配置

POST /spot/v1/update_mmp_config

curl -X POST "https://betaspot-api.bitexch.dev/spot/v1/update_mmp_config" -H "Content-Type: application/json" -H "X-Bit-Access-Key: ak-96cc0cbd-c501-448f-a32d-21228bc9648f"  -d '{"pair": "BTC-USDT", "window_ms": 20000, "frozen_period_ms": 30000, "qty_limit": "1000.00000000", "delta_limit": "1000.00000000", "timestamp": 1600050944127, "signature": "661b535fa878633718922fd90b419de4b5d9ae447833876b91bc8bcc7906e0f3"}' 

返回数据

{
    "code": 0,
    "message": "",
    "data": "ok"
}    

更新MMP配置参数 仅当mmp.user_configurable = true, 可以调用此函数,否则返回错误。

MMP冻结状态会触发当 qty >= qty_limit 或者 abs(delta) >= delta_limit.

window_ms: MMP 滚动时间窗口
frozen_period_ms: MMP 冻结时间窗口
qty_limit: MMP 数量上限 (in base currency, e.g. BTC)
delta_limit: MMP delta 上限 (in base currency, e.g. BTC)




请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string true "" 交易对
window_ms integer true 0 MMP 滚动时间窗口
frozen_period_ms integer true 0 MMP 冻结时间窗口
qty_limit string true "" MMP 数量上限 (in base currency, e.g. BTC)
delta_limit string true "" MMP delta 上限 (in base currency, e.g. BTC)

返回数据

字段名称 数据类型 说明
data string ok

重置MMP状态

POST /spot/v1/reset_mmp

curl -X POST "https://betaspot-api.bitexch.dev/spot/v1/reset_mmp" -H "Content-Type: application/json" -H "X-Bit-Access-Key: ak-96cc0cbd-c501-448f-a32d-21228bc9648f"  -d '{"pair": "BTC-USDT", "timestamp": 1600050689085, "signature": "992507afc30728c2bc55d7bf7f47e76126ce3f40ddebc205594877381c4374fa"}' 

返回数据

{
    "code": 0,
    "message": "",
    "data": "ok"
}    

重置MMP状态(解冻),用户可以继续下MMP订单。

请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string true "" 交易对

返回数据

字段名称 数据类型 说明
data string ok

查询现货用户配置

GET /spot/v1/account_configs

curl -H "X-Bit-Access-Key: ak-8628663d-678c-49b0-8d4e-a8691152a2d0" "https://betaspot-api.bitexch.dev/spot/v1/account_configs?timestamp=1678345228345&signature=0ff4933fb920e498514168f58848b8dc72570825f78adf4d9c9ca37a8e59ff96" 

返回数据


{
    "code": 0,
    "message": "",
    "data": {
        "user_id": "51140",
        "customize_open_counts": false,
        "max_open_order_count_all": 500,
        "max_open_order_count_pair": 200,
        "customize_fee_rates": false,
        "pair_config_list": [
            {
                "pair": "BTC-USD",
                "taker_fee_rate": "0.01500000",
                "maker_fee_rate": "0.01000000",
                "display_name": "BTC-USD",
                "fee_rate_class": {
                    "pair": "BTC-USD",
                    "taker_fee_rate": "0.01500000",
                    "maker_fee_rate": "0.01000000",
                    "source": "vip",
                    "taker_basic": "0.00070000",
                    "maker_basic": "0.00020000",
                    "taker_user_defined": "",
                    "maker_user_defined": "",
                    "taker_vip_level": "0.01500000",
                    "maker_vip_level": "0.01000000",
                    "has_vip_level": true,
                    "vip_level": 1
                }
            }
        ],
        "parent_user_id": "0"
    }
}

查询现货用户配置.

请求参数

NONE

返回数据

字段名称 数据类型 说明
user_id string 用户ID
customize_open_counts bool 是否定制 open order counts 参数
max_open_order_count_all string 最大全局未结订单数量
max_open_order_count_pair string 最大币对未结订单数量
customize_fee_rates bool 是否定制费率(已废弃,目前使用 vip 费率等级)
parent_user_id string 母账户ID
字段名称 数据类型 说明
pair string 币对
display_name string 显示名称
taker_fee_rate string taker 费率(已废弃,目前使用 vip 费率等级)
maker_fee_rate string maker 费率(已废弃,目前使用 vip 费率等级)
fee_rate_class.pair string 币对
fee_rate_class.taker_basic string 产品的 taker 费率
fee_rate_class.maker_basic string 产品的 maker 费率
fee_rate_class.taker_user_defined string 定制的 taker 费率
fee_rate_class.maker_user_defined string 定制的 maker 费率
fee_rate_class.taker_vip_level string VIP 级别的 taker 费率
fee_rate_class.maker_vip_level string VIP 级别的 maker 费率
fee_rate_class.has_vip_level bool 用户是否有 VIP 级别
fee_rate_class.vip_level int VIP 级别
fee_rate_class.source string 费率来源
fee_rate_class.taker_fee_rate string 最终生效的 taker 费率
fee_rate_class.maker_fee_rate string 最终生效的 maker 费率

订单管理

下单

POST /spot/v1/orders


curl -X POST "https://betaspot-api.bitexch.dev/spot/v1/orders" -H "Content-Type: application/json" -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113"  -d '{"pair": "BTC-USDT", "price": "60000", "qty": "3", "side": "buy", "time_in_force": "gtc", "mmp":false, "self_trading_mode": 0,  "timestamp": 1589523989378, "signature": "68b658eb68f4ce529623bb4505f5c1c6408b37064a9a5f2102d08088e59d917c"}' 


返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "order_id": "17552314",
        "created_at": 1589523803017,
        "updated_at": 1589523803017,
        "user_id": "51140",
        "pair": "BTC-USDT",
        "order_type": "limit",
        "side": "buy",
        "price": "60000",
        "qty": "3.00000000",
        "quote_qty": "0.00000000",
        "time_in_force": "gtc",
        "avg_price": "0.00000000",
        "filled_qty": "0.00000000",
        "status": "open",
        "taker_fee_rate": "0.00050000",
        "maker_fee_rate": "0.00020000",
        "cancel_reason": "",
        "label":"hedge",
        "source": "api",
        "post_only": false,
        "reject_post_only": false,
        "mmp": false,
        "is_liquidation": false,
        "is_um": true,
        "fee": "0.000000000000",
        "fee_ccy": "BTC",
        "fee_deduction_enabled": true,
        "fee_in_deduction_ccy": "3.000000000000",
        "fee_deduction_ccy": "TONCOIN",
        "fee_deduction_rate": "0.101100000000"
    }
}

价格规则:
* 市价下单:"price"价格字段需为空,不可填写
* 限价下单: "price"价格字段必须写入有效价格

数量规则:
* 限价单和市价单的卖单应在"qty"字段填下单数量,单位为基准货币(如币对BTC-USDT基准货币为BTC)
* 市价单的买单应在"quote_qty"字段填下单数量,单位为计价货币(如币对BTC-USDT计价货币为USDT),它是目标交易数量。
* 市价单的买单:"quote_qty"字段不可为空,"qty"字段必须为空。以BTC-USDT币对为例,USDT为计价货币,quote_qty 应为USDT的数量。 * 限价单或市价单的卖单:"qty"字段不可为空,"quote_qty"字段必须为空。
* 在订单查询时,quote_qty字段仅对市价单买单有值。
* 市价单的买单,订单查询返回filled_qty成交数量字段,单位为基准货币(没有filled_quote_qty字段),交易量=avg_price平均价格*filled_qty成交数量,由于订单类型为ioc,所以成交金额可能会比请求的quote_qty报价数量要少。市价单的生效时间字段应为'ioc'类型。

费用币种:
费用币种与购入币种相同
假设买入BTC-USDT币对, 费用币种为BTC
假设卖出BTC-USDT币对,费用币种为USDT

布尔类型字段的使用:
布尔类型字段的字符串中不要加引号
正确示例: {"post_only": true}
错误示例: {"post_only": "true"}





请求参数

字段名称 数据类型 是否必填 默认值 描述
pair string true "" 币对名称
qty string true "" 订单数量(限价单和市价单卖单必填)
quote_qty string true "" 计价币种订单数量(市价单买单必填)
side string true "" 订单方向
price string false "0.0" 订单价格(限价单必填,市价单不填)
order_type string false "limit" 订单类型
time_in_force string false "gtc" 生效时间
label string false "" 用户方唯一订单Label,由用户方维护
post_only bool false false 是否post only单
如果 reject_post_only = true, post only单进不了orderbook就会被撤销.
如果 reject_post_only = false, post only单进不了orderbook就会被修改价格。
reject_post_only bool false false 作为maker挂单时不支持改价。当"post_only"为'是'时,该字段有效。
mmp bool false false 是否为mmp单。
self_trading_mode int false 0 自成交模式

返回数据

字段名称 数据类型 说明
order_id string 订单ID
created_at integer 创建时间戳
updated_at integer 更新时间戳
user_id string 用户ID
pair string 币对名称
order_type string 订单类型
side string 订单方向
price string 订单价格
qty string 订单数量
quote_qty string 计价币种订单数量(仅对经典模式市价单买单有效)
time_in_force string 生效时间
avg_price string 平均成交价
filled_qty string 成交数量
status string 订单状态
taker_fee_rate string Taker手续费率
maker_fee_rate string Maker手续费率
cancel_reason string Order cancel reason
label string 用户方唯一订单ID,由用户方维护
post_only bool 是否为post only单。post_only单则支持仅作为maker挂单,不立即成交。限价单且生效时间类型为'gtc'时该字段有效。
reject_post_only bool 仅post_only单时该设置生效。若是reject单,作为maker挂单时不支持改价,反之支持改价。
source string 订单来源
mmp bool 是否为mmp单
is_liquidation bool 是否强平单
is_um bool 是否Um模式订单
fee string 手续费
fee_ccy string 手续费单位
fee_deduction_enabled bool 是否启用手续费抵扣
fee_in_deduction_ccy string 手续费,以抵扣币种计
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例

批量下单

POST /spot/v1/batchorders


curl -X POST "https://betaapi.bitexch.dev/spot/v1/batchorders" -H "Content-Type: application/json" -H "X-Bit-Access-Key: ak-96cc0cbd-c501-448f-a32d-21228bc9648f"  -d '{"orders_data": [{"pair": "BTC-USDT", "price": "50000", "qty": "0.1", "side": "buy"}, {"pair": "ETH-USDT", "price": "4000", "qty": "2", "side": "sell"}], "timestamp": 1596782252388, "signature": "0b8b64d2f35f9742a17af4ee0b993d0248a27a98f320abbfe8e7316f184e30d5"}' 


返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "orders": [
            {
                "order_id": "175523432",
                "created_at": 1589523803017,
                "updated_at": 1589523803017,
                "user_id": "51140",
                "pair": "BTC-USDT",
                "order_type": "limit",
                "side": "buy",
                "price": "50000.10000000",
                "qty": "0.10000000",
                "quote_qty": "0.00000000",
                "time_in_force": "gtc",
                "avg_price": "0.00000000",
                "filled_qty": "0.00000000",
                "status": "open",
                "taker_fee_rate": "0.00050000",
                "maker_fee_rate": "0.00020000",
                "cancel_reason": "",
                "label":"hedge",
                "source": "api",
                "post_only": false,
                "reject_post_only": false,
                "mmp": false,
                "is_liquidation": false,
                "is_um": true,
                "fee": "0.000000000000",
                "fee_ccy": "BTC",
                "fee_deduction_enabled": true,
                "fee_in_deduction_ccy": "3.000000000000",
                "fee_deduction_ccy": "TONCOIN",
                "fee_deduction_rate": "0.101100000000",
                "error_code": 0,
                "error_msg": ""
            },
            {
                "order_id": "175523436",
                "created_at": 1589523803038,
                "updated_at": 1589523803038,
                "user_id": "51140",
                "pair": "ETH-USDT",
                "order_type": "limit",
                "side": "buy",
                "price": "4000.00000000",
                "qty": "0.10000000",
                "quote_qty": "0.00000000",
                "time_in_force": "gtc",
                "avg_price": "0.00000000",
                "filled_qty": "0.00000000",
                "status": "open",
                "taker_fee_rate": "0.00050000",
                "maker_fee_rate": "0.00020000",
                "cancel_reason": "",
                "label":"",
                "source": "api",
                "post_only": false,
                "reject_post_only": false,
                "mmp": false,
                "is_liquidation": false,
                "is_um": true,
                "fee": "0.000000000000",
                "fee_ccy": "BTC",
                "fee_deduction_enabled": true,
                "fee_in_deduction_ccy": "3.000000000000",
                "fee_deduction_ccy": "TONCOIN",
                "fee_deduction_rate": "0.101100000000",
                "error_code": 0,
                "error_msg": ""
            }
        ]
    }
}

批量下单。
提供订单数组,订单信息同下单接口POST /spot/v1/orders。
批量下单最大下单数为10。


请求参数

字段名称 数据类型 是否必填 默认值 说明
orders_data array true Order request list(see below)
字段名称 数据类型 是否必填 默认值 说明
pair string true "" 币对名称
qty string true "" 订单数量(限价单和市价单卖单必填)
quote_qty string true "" 计价币种订单数量(市价单买单必填)
side string true "" 订单方向
price string false "0.0" 订单价格(限价单必填,市价单不填)
order_type string false "limit" 订单类型
time_in_force string false "gtc" 生效时间
label string false "" 用户方唯一订单ID,由用户方维护
post_only bool false false 是否为post only单。post_only单则支持仅作为maker挂单,不立即成交。限价单且生效时间类型为'gtc'时该字段有效。
reject_post_only bool false false 仅post_only单时该设置生效。若是reject单,作为maker挂单时不支持改价,反之支持改价。
mmp bool false false 是否为mmp单。
self_trading_mode int false 0 自成交模式

返回数据

字段名称 数据类型 说明
order_id string 订单ID
created_at integer 创建时间戳
updated_at integer 更新时间戳
user_id string 用户ID
pair string 币对名称
order_type string 订单类型
side string 订单方向
price string 订单价格
qty string 订单数量
quote_qty string 计价币种订单数量(仅对经典模式市价单买单有效)
time_in_force string 生效时间
avg_price string 平均成交价
filled_qty string 成交数量
status string 订单状态
taker_fee_rate string Taker手续费率
maker_fee_rate string Maker手续费率
cancel_reason string Order cancel reason
label string 用户方唯一订单ID,由用户方维护
post_only bool 是否为post only单。post_only单则支持仅作为maker挂单,不立即成交。限价单且生效时间类型为'gtc'时该字段有效。
reject_post_only bool 仅post_only单时该设置生效。若是reject单,作为maker挂单时不支持改价,反之支持改价。
source string 订单来源
mmp bool 是否为mmp单
is_liquidation bool 是否强平单
is_um bool 是否Um模式订单
fee string 手续费
fee_ccy string 手续费单位
fee_deduction_enabled bool 是否启用手续费抵扣
fee_in_deduction_ccy string 手续费,以抵扣币种计
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例

撤销订单

POST /spot/v1/cancel_orders


curl -X POST "https://betaspot-api.bitexch.dev/spot/v1/cancel_orders" -H "Content-Type: application/json" -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113"  -d '{"order_id": "44092860", "timestamp": 1590572422557, "signature": "3c8c2271a58e3d11dfbd262a6be40ebdd07e8f394a002db0065068b36bc66d5a"}' 



返回数据

{
    "code": 0,
    "message": "",
    "data":{
        "num_cancelled": 1,
        "order_ids": [44092860]
    }
}

取消订单参数规则: * 只输入order_id:支持输入一个订单号,只支持撤销指定订单
* 只输入pair:支持输入币对名称,可撤销该币对所有挂单
* 只输入label:支持输入label,可同时撤销label对应的所有订单
* 3个参数均为空:撤销该用户所有挂单
* 只能输入0或者1个参数, 同时输入多个参数会返回错误

请求参数

字段名称 数据类型 是否必填 默认值 说明
order_id string false "" 订单ID
pair string false "" 币对名称
label string false "" 用户方唯一订单ID,由用户方维护

返回数据

字段名称 数据类型 说明
num_cancelled integer 成功撤销订单数
order_ids array 撤单成功的订单ID

修改订单

POST /spot/v1/amend_orders


curl -X POST "https://betaspot-api.bitexch.dev/spot/v1/amend_orders" -H "Content-Type: application/json" -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113"  -d '{"order_id": "1206764", "price": "60010", "timestamp": 1590760362688, "signature": "a74dda0f2bdaf1e1587a5e7577a281497cb66607166bd3b7e0cc4c805c750bf1"}' 



返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "order_id": "1206764",
        "created_at": 1589523803017,
        "updated_at": 1589523803017,
        "user_id": "51140",
        "pair": "BTC-USDT",
        "order_type": "limit",
        "side": "buy",
        "price": "60010",
        "qty": "3.00000000",
        "quote_qty": "0.00000000",
        "time_in_force": "gtc",
        "avg_price": "0.00000000",
        "filled_qty": "0.00000000",
        "status": "open",
        "taker_fee_rate": "0.00050000",
        "maker_fee_rate": "0.00020000",
        "cancel_reason": "",
        "label":"hedge",
        "source": "api",
        "post_only": false,
        "reject_post_only": false,
        "mmp": false,
        "is_liquidation": false,
        "is_um": false,
        "fee": "0.000000000000",
        "fee_ccy": "BTC",
        "fee_deduction_enabled": true,
        "fee_in_deduction_ccy": "3.000000000000",
        "fee_deduction_ccy": "TONCOIN",
        "fee_deduction_rate": "0.101100000000"
    }
}

支持修改订单的价格、数量、MMP。
订单ID为必填参数。
以下参数必须至少提供一个: 价格,数量,MMP。

请求参数

字段名称 数据类型 是否必填 默认值 说明
order_id string true "" 订单
price string false "" 新的订单价格
qty string false "" 新的订单数量
mmp boolean false "" 订单是否在MMP机制下处理
self_trading_mode int false 0 自成交模式

返回数据

字段名称 数据类型 说明
order_id string 订单ID
created_at integer 创建时间戳
updated_at integer 更新时间戳
user_id string 用户ID
pair string 币对名称
order_type string 订单类型
side string 订单方向
price string 订单价格
qty string 订单数量
quote_qty string 计价币种订单数量(仅对经典模式市价单买单有效)
time_in_force string 生效时间
avg_price string 平均成交价
filled_qty string 成交数量
status string 订单状态
taker_fee_rate string Taker手续费率
maker_fee_rate string Maker手续费率
cancel_reason string Order cancel reason
label string 用户方唯一订单ID,由用户方维护
post_only bool 是否为post only单。post_only单则支持仅作为maker挂单,不立即成交。限价单且生效时间类型为'gtc'时该字段有效。
reject_post_only bool 仅post_only单时该设置生效。若是reject单,作为maker挂单时不支持改价,反之支持改价。
source string 订单来源
mmp bool 是否为mmp单
is_liquidation bool 是否强平单
is_um bool 是否Um模式订单
fee string 手续费
fee_ccy string 手续费单位
fee_deduction_enabled bool 是否启用手续费抵扣
fee_in_deduction_ccy string 手续费,以抵扣币种计
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例

批量修改订单

POST /spot/v1/amend_batchorders


curl -X POST "https://betaapi.bitexch.dev/spot/v1/amend_batchorders" -H "Content-Type: application/json" -H "X-Bit-Access-Key: ak-96cc0cbd-c501-448f-a32d-21228bc9648f"  -d '{"orders_data": [{"order_id": "572083", "price": "14000", "qty": "1.1"}, {"order_id": "invalid-order-id", "price": "15000", "qty": "0.2"}], "timestamp": 1597313835731, "signature": "c8b5fddd5f2cfa1517854dc54c51e7c3b79af91f0927ea1389ba43dbeee45652"}' 


返回数据

{
    "code": 0,
    "message": "",
    "data": {
        "orders": [
            {
                "order_id": "572083",
                "created_at": 1589523803017,
                "updated_at": 1589523803017,
                "user_id": "51140",
                "pair": "BTC-USDT",
                "order_type": "limit",
                "side": "buy",
                "price": "14000.00000000",
                "qty": "1.10000000",
                "quote_qty": "0.00000000",
                "time_in_force": "gtc",
                "avg_price": "0.00000000",
                "filled_qty": "0.00000000",
                "status": "open",
                "taker_fee_rate": "0.00050000",
                "maker_fee_rate": "0.00020000",
                "cancel_reason": "",
                "label":"hedge",
                "source": "api",
                "post_only": false,
                "reject_post_only": false,
                "mmp": false,
                "is_liquidation": false,
                "is_um": false,
                "fee": "0.000000000000",
                "fee_ccy": "BTC",
                "fee_deduction_enabled": true,
                "fee_in_deduction_ccy": "3.000000000000",
                "fee_deduction_ccy": "TONCOIN",
                "fee_deduction_rate": "0.101100000000",
                "error_code": 0,
                "error_msg": ""
            },
            {
                "order_id": "",
                "created_at": 0,
                "updated_at": 0,
                "user_id": "",
                "pair": "",
                "order_type": "",
                "side": "",
                "price": "",
                "qty": "",
                "quote_qty": "",
                "time_in_force": "",
                "avg_price": "",
                "filled_qty": "",
                "status": "",
                "taker_fee_rate": "",
                "maker_fee_rate": "",
                "cancel_reason": "",
                "label":"",
                "source": "",
                "post_only": false,
                "reject_post_only": false,
                "mmp": false,
                "is_liquidation": false,
                "is_um": false,
                "fee": "0.000000000000",
                "fee_ccy": "BTC",
                "fee_deduction_enabled": true,
                "fee_in_deduction_ccy": "3.000000000000",
                "fee_deduction_ccy": "TONCOIN",
                "fee_deduction_rate": "0.101100000000",
                "error_code": 18100113,
                "error_msg": "order id is invalid : invalid-order-id"
            }
        ]
    }
}

批量修改订单。
对每一个请求:
订单ID为必填参数。
以下参数必须至少提供一个: price,qty.mmp, 同时需要指定 self_trading_mode(默认0)
批量改单最大订单数为10。


请求参数

字段名称 数据类型 是否必填 默认值 说明
orders_data array true Amend request list(see below)
字段名称 数据类型 是否必填 默认值 说明
order_id string true "" 订单
price string false "" 新的订单价格
qty string false "" 新的订单数量
mmp boolean false "" 订单是否在MMP机制下处理
self_trading_mode int false 0 自成交模式

返回数据

字段名称 数据类型 说明
order_id string 订单ID
created_at integer 创建时间戳
updated_at integer 更新时间戳
user_id string 用户ID
pair string 币对名称
order_type string 订单类型
side string 订单方向
price string 订单价格
qty string 订单数量
quote_qty string 计价币种订单数量(仅对经典模式市价单买单有效)
time_in_force string 生效时间
avg_price string 平均成交价
filled_qty string 成交数量
status string 订单状态
taker_fee_rate string Taker手续费率
maker_fee_rate string Maker手续费率
cancel_reason string Order cancel reason
label string 用户方唯一订单ID,由用户方维护
post_only bool 是否为post only单。post_only单则支持仅作为maker挂单,不立即成交。限价单且生效时间类型为'gtc'时该字段有效。
reject_post_only bool 仅post_only单时该设置生效。若是reject单,作为maker挂单时不支持改价,反之支持改价。
source string 订单来源
mmp bool 是否为mmp单
is_liquidation bool 是否强平单
is_um bool 是否Um模式订单
fee string 手续费
fee_ccy string 手续费单位
fee_deduction_enabled bool 是否启用手续费抵扣
fee_in_deduction_ccy string 手续费,以抵扣币种计
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例
error_code int 订单请求错误码: 0为成功,否则为失败
error_msg string 订单请求错误信息

查询未结订单

GET /spot/v1/open_orders

curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaspot-api.bitexch.dev/spot/v1/open_orders?pair=BTC-USDT&i&timestamp=1589523178651&signature=2092cebba4f082f9c8718344cdad9bed83950b5fe90b3a875b708898bfd89b20" 


返回数据

{
    "code": 0,
    "message": "",
    "data": [{
        "order_id": "7718222",
        "created_at": 1589202185000,
        "updated_at": 1589460149000,
        "user_id": "51140",
        "pair": "BTC-USDT",
        "order_type": "limit",
        "side": "buy",
        "price": "60000",
        "qty": "3.00000000",
        "quote_qty": "0.00000000",
        "time_in_force": "gtc",
        "avg_price": "0.00000000",
        "filled_qty": "0.00000000",
        "status": "open",
        "taker_fee_rate": "0.00050000",
        "maker_fee_rate": "0.00020000",
        "cancel_reason": "",
        "label":"hedge",
        "source": "api",
        "post_only": false,
        "reject_post_only": false,
        "mmp": false,
        "is_liquidation": false,
        "is_um": true,
        "fee": "0.000000000000",
        "fee_ccy": "BTC",
        "fee_deduction_enabled": true,
        "fee_in_deduction_ccy": "3.000000000000",
        "fee_deduction_ccy": "TONCOIN",
        "fee_deduction_rate": "0.101100000000"
    }]  
}

获取未结订单。

请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string false "" 币对名称

返回数据

字段名称 数据类型 说明
order_id string 订单ID
created_at integer 创建时间戳
updated_at integer 更新时间戳
user_id string 用户ID
pair string 币对名称
order_type string 订单类型
side string 订单方向
price string 订单价格
qty string 订单数量
quote_qty string 计价币种订单数量(仅对经典模式市价单买单有效)
time_in_force string 生效时间
avg_price string 平均成交价
filled_qty string 成交数量
status string 订单状态
taker_fee_rate string Taker 手续费率
maker_fee_rate string Maker 手续费率
cancel_reason string Order cancel reason
label string 用户方唯一订单ID,由用户方维护
post_only bool 是否为post only单。post_only单则支持仅作为maker挂单,不立即成交。限价单且生效时间类型为'gtc'时该字段有效。
reject_post_only bool 仅post_only单时该设置生效。若是reject单,作为maker挂单时不支持改价,反之支持改价。
source string 订单来源
mmp bool 是否为mmp单
is_liquidation bool 是否强平单
is_um bool 是否Um模式订单
fee string 手续费
fee_ccy string 手续费单位
fee_deduction_enabled bool 是否启用手续费抵扣
fee_in_deduction_ccy string 手续费,以抵扣币种计
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例

查询订单记录

GET /spot/v1/orders

curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaspot-api.bitexch.dev/spot/v1/orders?pair=BTC-USDT&order_id=7718222&start_time=1585270800000&end_time=1589522084000&i&timestamp=1589523178651&signature=2092cebba4f082f9c8718344cdad9bed83950b5fe90b3a875b708898bfd89b20" 


返回数据

{
    "code": 0,
    "message": "",
    "data": [{
        "order_id": "7718222",
        "created_at": 1589202185000,
        "updated_at": 1589460149000,
        "user_id": "51140",
        "pair": "BTC-USDT",
        "order_type": "limit",
        "side": "buy",
        "price": "60000",
        "qty": "3.00000000",
        "quote_qty": "0.00000000",
        "time_in_force": "gtc",
        "avg_price": "0.00000000",
        "filled_qty": "0.00000000",
        "status": "cancelled",
        "taker_fee_rate": "0.00050000",
        "maker_fee_rate": "0.00020000",
        "cancel_reason": "",
        "label":"hedge",
        "source": "api",
        "post_only": false,
        "reject_post_only": false,
        "mmp": false,
        "is_liquidation": false,
        "is_um": true,
        "fee": "0.000000000000",
        "fee_ccy": "BTC",
        "fee_deduction_enabled": true,
        "fee_in_deduction_ccy": "3.000000000000",
        "fee_deduction_ccy": "TONCOIN",
        "fee_deduction_rate": "0.101100000000"
    }],
    "page_info": {
        "has_more": false
    }      
}

查询用户订单记录。
查询参数优先级:订单ID>订单起始ID>查询起始时间
输入订单ID时,则忽略其他参数;同时输入订单起始ID和起始时间时,则忽略查询时间。

请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string false "" 币对名称
order_id string false "" 订单ID
label string false "" 订单label
start_time integer false one month ago 查询时间段起始时间戳
end_time integer false now 查询时间段结束时间戳
start_id integer false 起始订单ID
end_id integer false 结束订单ID
offset int false 1 分页偏移(第一页为1)
limit int false 100 分页大小

返回数据

字段名称 数据类型 说明
order_id string 订单ID
created_at integer 创建时间戳
updated_at integer 更新时间戳
user_id string 用户ID
pair string 币对名称
order_type string 订单类型
side string 订单方向
price string 订单价格
qty string 订单数量
qquote_qty string 计价币种订单数量(仅对经典模式市价单买单有效)
time_in_force string 生效时间
avg_price string 平均成交价
filled_qty string 成交数量
status string 订单状态
taker_fee_rate string Taker 手续费率
maker_fee_rate string Maker 手续费率
cancel_reason string Order cancel reason
label string 用户方唯一订单ID,由用户方维护
post_only bool 是否为post only单。post_only单则支持仅作为maker挂单,不立即成交。限价单且生效时间类型为'gtc'时该字段有效。
reject_post_only bool 仅post_only单时该设置生效。若是reject单,作为maker挂单时不支持改价,反之支持改价。
source string 订单来源
mmp bool 是否为mmp单
is_liquidation bool 是否强平单
is_um bool 是否Um模式订单
fee string 手续费
fee_ccy string 手续费单位
fee_deduction_enabled bool 是否启用手续费抵扣
fee_in_deduction_ccy string 手续费,以抵扣币种计
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例

查询用户交易记录

GET /spot/v1/user/trades

curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaspot-api.bitexch.dev/spot/v1/user/trades?pair=BTC-USDT&order_id=17551020&start_time=1585270800000&end_time=1589522084000&count=10&timestamp=1589523590679&signature=c4788e3a77b6000424b55067f9ba38009b34d12e482b1c80186756857c869bb5" 


返回数据

{
    "code": 0,
    "message": "",
    "data": [{
        "user_id": 51130,
        "trade_id": "23210268",
        "order_id": "17551020",
        "pair": "BTC-USDT",
        "qty": "2.00000000",
        "price": "60000",
        "fee_rate": "0.00050000",
        "side": "buy",
        "created_at": 1589521371000,
        "order_type": "limit",
        "is_taker": true,
        "label": "",
        "fee": "0.00100000",
        "fee_ccy": "TONCOIN",
        "is_fee_deducted": true,
        "fee_deduction_ccy": "TONCOIN",
        "fee_deduction_rate": "0.101100000000",
        "fee_deduction_ccy_index": "1.372980000000"
    }]
}

查询用户交易记录。


请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string false "" 币对名称
order_id string false "" 订单ID
start_time integer false one month ago 起始时间戳
end_time integer false now 结束时间戳
start_id integer false 起始Trade ID
end_id integer false 结束Trade ID
count int false 100 返回记录条数,最大1000

返回数据

字段名称 数据类型 说明
user_id integer 用户 ID
order_id string 订单ID
trade_id string 交易ID
pair string 币对名称
created_at integer 创建时间戳
order_type string 订单类型
side string 订单方向
price string 成交价格
qty string 成交数量
fee_rate string 手续费率
is_taker boolean 是否taker
label string 这笔交易记录的订单label
fee string 手续费
fee_ccy string 手续费单位
is_fee_deducted bool 是否启用手续费抵扣
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例
fee_deduction_ccy_index string 手续费抵扣币种的指数价格

查询聚合用户交易记录

GET /spot/v1/aggregated/trades

curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaspot-api.bitexch.dev/spot/v1/aggregated/trades?pair=BTC-USDT&order_id=17551020&start_time=1585270800000&end_time=1589522084000&count=10&timestamp=1589523590679&signature=c4788e3a77b6000424b55067f9ba38009b34d12e482b1c80186756857c869bb5" 


返回数据

{
    "code": 0,
    "message": "",
    "data": [{
        "user_id": 51130,
        "trade_id": "23210268",
        "order_id": "17551020",
        "pair": "BTC-USDT",
        "qty": "2.00000000",
        "price": "60000",
        "fee_rate": "0.00050000",
        "side": "buy",
        "created_at": 1589521371000,
        "order_type": "limit",
        "is_taker": true,
        "label": "",
        "fee": "0.00100000",
        "fee_ccy": "TONCOIN",
        "is_fee_deducted": true,
        "fee_deduction_ccy": "TONCOIN",
        "fee_deduction_rate": "0.101100000000",
        "fee_deduction_ccy_index": "1.372980000000"
    }]
}

查询当前用户和所有子账户的交易记录。


请求参数

字段名称 数据类型 是否必填 默认值 说明
pair string false "" 币对名称
start_time integer false one month ago 起始时间戳
end_time integer false now 结束时间戳
start_id integer false 起始Trade ID
end_id integer false 结束Trade ID
count int false 100 返回记录条数,最大1000

返回数据

字段名称 数据类型 说明
user_id integer 用户 ID
order_id string 订单ID
trade_id string 交易ID
pair string 币对名称
created_at integer 创建时间戳
order_type string 订单类型
side string 订单方向
price string 成交价格
qty string 成交数量
fee_rate string 手续费率
is_taker boolean 是否taker
label string 这笔交易记录的订单label
fee string 手续费
fee_ccy string 手续费单位
is_fee_deducted bool 是否启用手续费抵扣
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例
fee_deduction_ccy_index string 手续费抵扣币种的指数价格

钱包

Bit.com有三种类型的账户:现货账户,合约账户和余额账户。三种账户可使用API进行互相划转,余额账户和合约账户可通过API进行提现,余额账户只能通过页面提现。子账户不能通过API进行转账,只能通过WEB页面进行转账,子母账户之间的转账只能由母账户发起,子账户不可发起提现。

提现

POST /v1/wallet/spot-withdraw

curl -X POST "https://betaapi.bitexch.dev/v1/wallet/spot-withdraw" -H "Content-Type: application/json" -H "X-Bit-Access-Key: Your Access Key" -d '{"currency": "BTC", "address": "Your address", "amount": "1.2", "pwd": "Your password", "timestamp": 1589523989378, "signature": "signature"}'

返回数据


{
    "code": 0,
    "message": "",
    "data": {
        "withdraw_id": "b61c2b93-8a25-44d4-9715-023cce61dc50"
    }
}

从现货账户向外提取资金。提现地址首先要在bit.com网站的提现页面 设置为白名单地址。资金密码pwd字段需要通过base64(sha256(pwd))进行编码。例如,假设密码是123456,编码后的密码为“jZae727K08KaOmKSgOaGzww/XVqGr/PKEgIMkjrcbJI=”

请求参数

字段名称 数据类型 是否必填 默认值 说明
currency string true "" 币种, BTC
address string true "" 提现的目标地址
amount string true "" 提现金额
pwd string true "" 资金密码
chain string false "" 链名 提现USDT时,要提到USDTERC应填ETH,要提到USDTTRE应填TRX

返回数据

字段名称 数据类型 说明
withdraw_id string 提现订单ID, 可用于后续的查询

查询提现记录

GET /v1/wallet/spot-withdrawals

curl -H "X-Bit-Access-Key: Your Access Key" "https://betaapi.bitexch.dev/v1/wallet/spot-withdrawals?currency=BTC&limit=10&offset=0&timestamp=1589522687689&signature=signature"

返回数据


{
    "code": 0,
    "data": {
        "items": [{
            "address": "mfaFpdVCb6UFS5AXUhC8VGXgj9dnJ37nLP",
            "amount": "0.001",
            "code": 0,
            "confirmations": 0,
            "currency": "BTC",
            "fee": "0.00001",
            "state": "confirmed",
            "transaction_id": "52e1537002f51acbf5f52b9dfeab6a9e7cc185a669cda2573e768420b0839523",
            "created_at": 1608606000000,
            "updated_at": 1608606000000,
            "is_onchain": true
        }, {
            "address": "mfaFpdVCb6UFS5AXUhC8VGXgj9dnJ37nLP",
            "amount": "0.11",
            "code": 13100100,
            "confirmations": 0,
            "currency": "BTC",
            "fee": "0.00001",
            "state": "rejected",
            "transaction_id": "",
            "created_at": 1608606000000,
            "updated_at": 1608606000000,
            "is_onchain": false
        }]
    }
}

指定币种,查询现货账户的提现记录。

请求参数

字段名称 数据类型 是否必填 默认值 说明
currency String true "" 币种名称
limit int false 10 分页大小,最大50
offset int false 1 分页偏移
withdraw_id string false "" 提现订单ID

返回数据

字段名称 数据类型 说明
code int 错误码,0代表正常,其他值代表失败
state string 提现状态
address string 提现目标地址
amount string 提现金额
confirmations int 确认数,如果是内部地址,由于不会上链,一直为0
currency string 币种
fee string 提现手续费
transaction_id string 链上交易哈希
created_at int 订单创建时间戳
updated_at int 订单更新时间戳
is_onchain bool 订单是否上链(内部地址提现不上链)

查询充值记录

GET /v1/wallet/spot-deposits

curl -H "X-Bit-Access-Key: Your Access Key" "https://betaapi.bitexch.dev/v1/wallet/spot-deposits?currency=BTC&limit=10&offset=0&timestamp=1589522687689&signature=signature"

返回数据


{
    "code": 0,
    "data": {
        "items": [{
            "address": "mfaFpdVCb6UFS5AXUhC8VGXgj9dnJ37nLP",
            "amount": "0.001",
            "code": 0,
            "confirmations": 0,
            "currency": "BTC",
            "state": "confirmed",
            "transaction_id": "52e1537002f51acbf5f52b9dfeab6a9e7cc185a669cda2573e768420b0839523",
            "created_at": 1608606000000,
            "updated_at": 1608606000000,
            "is_onchain": true
        }]
    }
}

指定币种,查询现货账户的充值记录。

请求参数

字段名 类型 是否必填 默认值 说明
currency String true "" 币种名称
limit int false 10 分页大小,最大50
offset int false 1 分页偏移

返回数据

字段名称 数据类型 说明
code int 错误码,0代表正常,其他值代表失败
state string 充值状态
address string 充值来源地址
amount string 充值金额
confirmations int 确认数,如果是内部地址,由于不会上链,一直为0
currency string 币种
transaction_id string 链上交易哈希
created_at int 订单创建时间戳
updated_at int 订单更新时间戳
is_onchain bool 订单是否上链(内部地址充值不上链)

转账

POST /v1/wallet/transfer

curl -X POST "https://betaapi.bitexch.dev/v1/wallet/transfer" -H "Content-Type: application/json" -H "X-Bit-Access-Key: Your Access Key" -d '{"currency": "BTC", "amount": "1.2", "type": 1, "timestamp": 1589523989378, "signature": "signature"}'

返回数据


{
    "code": 0,
    "message": ""
}

Bit.com有三种类型的账户:现货账户,合约账户和余额账户。三种账户可使用API进行互相划转。子母账户之间转账只可由母账户发起,子账户不能通过API进行转账,只能通过WEB页面进行转账。

请求参数

字段名 类型 是否必填 默认值 说明
currency string true 币种名称
amount string true 转账金额
type int true 转账类型 1.现货到合约,2.合约到现货,3.现货到余额, 4.余额到现货,5.余额到现货,6.余额到合约

转账记录查询

GET /v1/wallet/transfer

curl -H "X-Bit-Access-Key: Your Access Key" "https://betaapi.bitexch.dev/v1/wallet/transfer?currency=BTC&count=10&offset=0&timestamp=1589522687689&signature=signature"

返回数据


{
    "code": 0,
    "data": {
        "items": [{
            "status": "done",
            "currency": "BTC",
            "amount": "1.2",
            "type": 1,
            "created_at": 1608606000000,
            "id": "123"
        }, {
            "status": "done",
            "currency": "ETH",
            "amount": "1.2",
            "type": 2,
            "created_at": 1608606000000,
            "id": "124"
        }]
    }
}

### 请求参数

字段名 类型 是否必填 默认值 说明
currency string false 币种名称
limit int false 10 分页大小,最大50
offset int false 1 分页偏移

返回数据

字段名称 数据类型 说明
status string 转账状态 失败/成功/处理中
type int 转账类型
currency string 币种名称
amount string 转账金额
created_at int 转账创建时间戳
order_id string 转账订单ID

Websocket 数据订阅

数据订阅基于websocket协议。用户可以在建立websocket连接后发送请求订阅数据。

连接建立后如果30秒内没有订阅任何数据,系统将关闭该连接。

所有订阅数据按以下结构返回。

字段名称 类型 说明
channel string 频道名称
timestamp integer 时间戳(服务器返回时间)
data object 数据内容
module string [spot, um] 订阅数据所属模块

订阅管理

Request

{
    "type":"subscribe",
    "pairs":[
        "BTC-USDT",
    ],
    "channels":[
        "depth",
        "ticker",
        "kline.5",
        "order",
        "account"
    ],
    "interval": "100ms",
    "token":"be4ffcc9-2b2b-4c3e-9d47-68bf062cf651"
}

Response (success)

{
    "channel":"subscription",
    "timestamp":1587921122970,
    "data":{
        "code":0,
        "subscription":[
            "depth",
            "ticker",
            "kline.5"
        ]
    }
}

Response (failure)

{
    "channel":"subscription",
    "timestamp":1587921122970,
    "data":{
        "code":13200302,
        "message":"auth failed: invalid token"
    }
}

websocket连接建立后,用户可以发送请求订阅频道以获取相应的数据推送。频道分为公共频道和私有频道,私有频道首次订阅前需要先获取认证token,填入订阅请求,鉴权通过后就能收到数据推送。

每个频道有不同的订阅参数,订阅时需根据频道订阅要求填写相应的参数,详情参考后面的频道说明。

用户可以通过设置参数interval控制推送频率。当设置为raw时,频道有数据更新立刻就会推送。当设置为100ms时,则会把该频道100ms内的更新聚合后推送。当设置为fixed100ms时,按100ms固定时间间隔进行推送(仅部分频道支持)。

订阅后会收到订阅结果。当订阅请求包含多个频道,而其中部分订阅失败时,将返回两条消息:一条是订阅失败的原因,一条是成功订阅的频道列表。

当不再需要订阅某个频道数据时,用户可以发送取消订阅请求来实现。

查询参数

字段名称 类型 说明
type string 订阅/取消订阅[subscribe, unsubscribe]
channels string[] 频道列表
pairs string[] 币种列表
interval string [raw, 100ms, fixed100ms] 默认为raw
token string 订阅私有频道的认证token

关于interval参数设置

Response

字段名称 类型 说明
code integer 0表示成功, 非0表示失败
message string 错误消息,订阅失败时返回
subscription string[] 订阅成功的频道列表

获取认证Token

GET /spot/v1/ws/auth

Request

curl -H "X-Bit-Access-Key: ak-ba3bd026-29e6-443b-8eb6-d2ea3b607113" "https://betaspot-api.bitexch.dev/spot/v1/ws/auth?timestamp=1588996062516&signature=9ed1dd821cc6464d2cfc5bf9614df1f22611c977b513e1ffde864a673b6915f0" 

Response

{
    "code":0,
    "message":"",
    "data":{
        "token":"be4ffcc9-2b2b-4c3e-9d47-68bf062cf651"
    }
}

订阅私有频道需要先通过本接口GET /spot/v1/ws/auth(REST)获取认证token,然后将其填入websocket的订阅请求。

token只能使用一次,服务器验证后即丢弃,所以没有被盗用风险,重连需要重新申请token。

每个连接只需要鉴权一次,鉴权通过后新的订阅请求无需再填写token(后续private请求中的token会被丢弃,因此不同用户不能共享同一个private websocket连接)。

查询参数

None

返回数据

字段名称 类型 说明
token string 私有频道认证token

心跳

协议标准

根据RFC 6455, websocket协议实现了PING/PONG消息,用以确认websocket连接保持活动状态。

服务器每分钟通过websocket连接向客户端发送PING消息,客户端收到后应答PONG。如果服务器在一分钟内没收到PONG,则认为连接不正常将连接关闭。

客户端也可向服务器发送PING消息,通过检测是否收到PONG,确认该连接数据收发正常。

PING或者PONG都是控制帧。PING消息的opcode为0x9,PONG消息的opcode为0xA。可参考Websocket协议说明

自定义PING/PONG

由于部分客户端封装所限不支持按需发送控制帧,因此在协议标准外提供了一套自定义基于payload的PING/PONG。详细参考“Websocket RPC - PING”

频道目录

频道名称 范围 订阅参数 说明
depth public pairs 市场深度数据的快照和增量变化
order_book.{group}.{depth} public pairs 指定层数的订单簿快照
depth1 public pairs 订单簿的第一层价格
ticker public pairs 市场最新成交价格和最近24小时交易统计信息
kline.{resolution} public pairs K线数据
trade public pairs 指定币对的最新成交信息
market_trade public 市场上所有币对的最新成交信息
index_price public pairs 指定币对的指数价格
account private 用户的账户信息
um_account private UM账户信息
order private 用户的订单信息
user_trade private 用户的交易信息
mmp_frozen private MMP冻结事件

市场深度频道(depth)

Request

{
    "type":"subscribe",
    "pairs":[
        "BTC-USDT"
    ],
    "channels":[
        "depth"
    ],
    "interval": "100ms"
}

Response (snapshot)

{
    "channel":"depth",
    "timestamp":1587929552250,
    "module":"spot",
    "data":{
        "type":"snapshot",
        "pair":"BTC-USDT",
        "sequence":9,
        "bids":[
            [
                "0.08000000",
                "0.10000000"
            ]
        ],
        "asks":[
            [
                "0.09000000",
                "0.20000000"
            ]
        ]
    }
}

Response (update)

{
    "channel":"depth",
    "timestamp":1587930311331,
    "module":"spot",
    "data":{
        "type":"update",
        "pair":"BTC-USDT",
        "sequence":10,
        "prev_sequence":9,
        "changes":[
            [
                "sell",
                "0.08500000",
                "0.10000000"
            ]
        ]
    }
}

depth频道推送市场深度的快照和增量变化,包括snapshotupdate两种类型的消息。snapshot类型表示当前订单簿的快照,update类型表示深度变更信息。

订阅成功后将首先发送一个快照消息,再发送深度变更消息。当出现异常时会重新发送快照消息。

快照消息包括买价和卖价价格深度,每一层深度由价格和数量组成。

更新消息包含sequenceprev_sequencesequence表示本次更新序号,prev_sequence表示前一次更新序号。如果前一次更新序号等于上一条消息的本次更新序号,则意味着没有消息丢失。

更新消息的变更列表,每一个变更都由方向、价格和数量组成。当数量为0时表示从订单簿中删除该层。

频道信息

频道名称 权限 订阅参数 推送频率
depth public pairs [raw, 100ms]

返回数据

字段名称 类型 说明
type string [snapshot, update]两种类型:快照、深度变更
pair string 币种名称
sequence integer 订单簿更新序号
asks array of [price, quantity] 卖价, price(价格)和quantity(数量)都是string类型。仅快照类型消息返回
bids array of [price, quantity] 买价, price(价格)和quantity(数量)都是string类型。仅快照类型消息返回
prev_sequence integer 前1次消息的更新序号。仅更新类型消息返回
changes array of [side, price, quantity] 深度更新列表。side(方向)、price(价格)、quantity(数量)都是string类型。数量为0表示删除该层。仅更新类型消息返回

订单簿频道(order_book)

Request

{
    "type":"subscribe",
    "pairs":[
        "BTC-USDT"
    ],
    "channels":[
        "order_book.1.10"
    ],
    "interval": "100ms"
}

Response

{
    "channel":"order_book.1.10",
    "timestamp":1587930311331,
    "module":"spot",
    "data":{
        "pair":"BTC-USDT",
        "sequence":3,
        "timestamp":1587930311330,
        "asks":[
            [
                "37557.59000000",
                "0.00052800"
            ]
        ],
        "bids":[
            [
                "37553.49000000",
                "1.22120100"
            ],
            [
                "37553.48000000",
                "0.21730000"
            ]
        ]
    }
}

order_book频道根据指定的聚合倍数和深度层数,按价格聚合后,推送指定层数的订单簿快照。

订单簿包括买价和卖价深度,每一层深度由价格和数量组成。

频道信息

频道名称 权限 订阅参数 推送频率
order_book.{group}.{depth} public pairs [raw, 100ms, fixed100ms]

订阅order_book频道需要在频道名称中指定聚合倍数group和深度层数depth

订单薄聚合实例

假设价格步长 price_step = 0.01
原始深度:
bids: [[0.13, 3], [0.19, 7], [0.26, 5], [0.77, 12.3]]

订单频道信息为 orderbook.10.5, 聚合后价格步长aggregation price level = 0.01 * 10 = 0.1
聚合后深度:
bids: [[0.1, 10], [0.2, 5], [0.7, 12.3]]

返回数据

| 字段名称 | 类型 | 说明 | | :------ - | :------------------------- | :---------------------------------- | | pair | string | 币对名称 | | sequence | integer | 订单簿更新序号 | | timestamp | integer | 订单簿更新时间戳 | | asks | array of [price, quantity] | 卖价, price(价格)和quantity(数量)都是string类型 | | bids | array of [price, quantity] | 买价, price(价格)和quantity(数量)都是string类型 |

一层价格频道(depth1)

Request

{
    "type":"subscribe",
    "pairs":[
        "BTC-USDT"
    ],
    "channels":[
        "depth1"
    ],
    "interval": "100ms"
}

Response

{
    "channel":"depth1",
    "timestamp":1587932635873,
    "module":"spot",
    "data":{
        "pair":"BTC-USDT",
        "best_ask":"37557.59000000",
        "best_ask_qty":"0.00052800",
        "best_bid":"37553.49000000",
        "best_bid_qty":"0.22120100",
    }
}

depth1频道推送1层的买价/卖价信息。

频道信息

频道名称 权限 订阅参数 推送频率
depth1 public pairs [raw, 100ms]

返回数据

字段名称 类型 说明
pair string 币对名称
best_ask string 最优卖价,如果为空则说明无卖单
best_ask_qty string 最优卖价数量
best_bid string 最优买价,如果为空则说明无买单
best_ask_qty string 最优买价数量

市场交易信息统计频道(ticker)

Request

{
    "type":"subscribe",
    "pairs":[
        "BTC-USDT"
    ],
    "channels":[
        "ticker"
    ],
    "interval": "100ms"
}

Response

{
    "channel":"ticker",
    "timestamp":1589126498813,
    "module":"spot",
    "data":{
        "time":1589126498800,
        "pair":"BTC-USDT",
        "best_bid":"50200.50000000",
        "best_ask":"50201.00000000",
        "best_bid_qty":"2.30000000",
        "best_ask_qty":"0.80000000",
        "last_price":"50200.80000000",
        "last_qty":"0.10000000",
        "open24h":"50500.00000000",
        "high24h":"50500.00000000",
        "low24h":"50100.00000000",
        "price_change24h":"-0.00592475",
        "volume24h":"0.10000000",
        "quote_volume24h":"5020.08000000"
    }
}

ticker频道推送市场最新成交价格和最近24小时交易统计信息。

频道信息

频道名称 权限 订阅参数 推送频率
ticker public pairs [raw, 100ms]

返回数据

Name Type Description
pair string 币对名称
last_price string 最新成交价
last_qty string 最新成交量
open24h string 24小时开盘价
high24h string 24小时最高价
low24h string 24小时最低价
volume24h string 24小时交易量
quote_volume24h string 报价币种 24小时交易量
price_change24h string 24小时价格变动量
best_bid string 最优买价
best_ask string 最优卖价
best_bid_qty string 最优买入数量
best_ask_qty string 最优卖出数量
time integer 时间戳

K线频道(kline)

Request

{
    "type":"subscribe",
    "pairs":[
        "BTC-USDT"
    ],
    "channels":[
        "kline.5"
    ],
    "interval": "100ms"
}

Response

{
    "channel":"kline.5",
    "timestamp":1587979850118,
    "module":"spot",
    "data":{
        "pair":"BTC-USDT",
        "tick":1587979800000,
        "open":"37737.50000000",
        "low":"37737.50000000",
        "high":"37737.50000000",
        "close":"37737.50000000",
        "volume":"0.00000000"
    }
}

kline频道推送K线数据。如果在当前周期内没有发生过交易,则开盘价、收盘价、最高价、最低价会以前一个周期的收盘价填充。

频道信息

频道名称 权限 订阅参数 推送频率
kline.{timeframe} public pairs [raw, 100ms]

订阅K线频道需要在频道名称中指定K线时间周期timeframe.

支持的K线周期:

时间周期 类型
1 1 分钟
3 3 分钟
5 5 分钟
15 15 分钟
30 30 分钟
60 60 分钟
240 240 分钟
360 360 分钟
720 720 分钟
1d 1天
1w 1周(自然周)
1m 1月(自然月)

返回数据

字段名称 类型 说明
pair string 币对名称
tick integer 统计周期开始时间
open string 开盘价
close string 收盘价
high string 最高价
low string 最低价
volume string 成交量

交易频道(trade)

Request

{
    "type":"subscribe",
    "pairs":[
        "BTC-USDT"
    ],
    "channels":[
        "trade"
    ],
    "interval": "100ms"
}

Response

{
    "channel":"trade",
    "timestamp":1588997059735,
    "module":"spot",
    "data":[
        {
            "trade_id":"2388418",
            "pair":"BTC-USDT",
            "price":"37557.01800000",
            "qty":"0.10000000",
            "side":"buy",
            "created_at":1588997060000
        }
    ]
}

trade频道推送指定产品的最新成交信息。

频道信息

频道名称 权限 订阅参数 推送频率
trade public pairs [raw, 100ms]

返回数据

字段名称 类型 说明
pair string 币对名称
trade_id string 交易ID
price string 成交价
qty string 成交数量
side string Taker交易方向
created_at integer 成交时间戳

市场交易频道(market_trade)

Request

{
    "type":"subscribe",
    "channels":[
        "market_trade"
    ],
    "interval": "100ms"
}

Response

{
    "channel":"market_trade",
    "timestamp":1588997059735,
    "module":"spot",
    "data":[
        {
            "trade_id":"2388418",
            "pair":"BTC-USDT",
            "price":"37557.01800000",
            "qty":"0.10000000",
            "side":"buy",
            "created_at":1588997060000
        }
    ]
}

market_trade频道推送市场上所有产品的最新成交信息。

频道信息

频道名称 权限 订阅参数 推送频率
market_trade public [raw, 100ms]

返回数据

字段名称 类型 说明
pair string 币对名称
trade_id string 交易ID
price string 成交价格
qty string 成交数量
side string Taker交易方向
created_at integer 成交时间戳

指数价格频道(index_price)

Request

{
    "type":"subscribe",
    "pairs":[
        "BTC-USDT"
    ],
    "channels":[
        "index_price"
    ],
    "interval": "100ms"
}

Response

{
    "channel":"index_price",
    "timestamp":1644462011011,
    "module":"spot",
    "data":{
        "index_name":"BTC-USDT",
        "index_price":"43789.28666667"
    }
}

index_price频道推送指定币对的指数价格。

频道信息

频道名称 权限 订阅参数 推送频率
index_price public pairs [raw, 100ms]

返回数据

字段名称 类型 说明
index_name string 币对名称
index_price string 指数价格

账户信息频道(account)

Request

{
    "type":"subscribe",
    "channels":[
        "account"
    ],
    "interval": "100ms",
    "token":"6d501ded-3c40-4697-b390-218a54b9de19"
}

Response

{
    "channel":"account",
    "timestamp":1589031930115,
    "module":"spot",
    "data":{
        "user_id": "1001",
        "balances": [
          {
            "currency": "BTC",
            "available":"99.59591877",
            "frozen":"0.00000000"
          }
        ]
    }
}

经典用户,订阅account频道接收推送用户的账户信息。

频道信息

频道名称 权限 订阅参数 推送频率
account private [raw, 100ms]

返回数据

字段名称 类型 说明
user_id string 用户ID
balances array of Balance 余额列表
名称 类型 说明
currency string 币种
available string 可用余额
frozen string 冻结余额

统一UM账户信息频道(um_account)

Request

{
    "type":"subscribe",
    "channels":[
        "um_account"
    ],
    "interval": "100ms",
    "token":"6d501ded-3c40-4697-b390-218a54b9de19"
}

Response

{
    "channel":"um_account",
    "timestamp":1632439007081,
    "module":"um",
    "data": {
        "user_id": 1,
        "created_at": 1632642549581,
        "usdt_total_collateral": "200.00000000",
        "usdt_total_margin_balance": "190.00000000",
        "usdt_total_available": "80.00000000",
        "usdt_total_initial_margin": "90.00000000",
        "usdt_total_maintenance_margin": "120.00000000",
        "usdt_total_initial_margin_ratio": "0.60000000",
        "usdt_total_maintenance_margin_ratio": "0.60000000",
        "usdt_total_liability": "8060000.00000000",
        "usdt_total_unsettled_amount": "322143.95604395",
        "spot_orders_hc_loss": "30.00000000",
        "details": [
            {
                "currency": "BTC",
                "equity": "100.00000000",
                "liability": "0.00000000",
                "usdt_index_price": "40000.00000000",
                "cash_balance": "100.00000000",
                "margin_balance": "100.00000000",
                "available_balance": "50.00000000",
                "initial_margin": "20.00000000",
                "spot_margin": "30.00000000",
                "maintenance_margin": "80.00000000",
                "potential_liability": "0.00000000",
                "interest": "1.00000000",
                "interest_rate": "0.01000000",
                "pnl": "0.11538462",
                "total_delta": "0.38461538",
                "session_rpl": "10.00000000",
                "session_upl": "0.11538462",
                "option_value": "0.00000000",
                "option_pnl": "0.00000000",
                "option_session_rpl": "0.00000000",
                "option_session_upl": "0.00000000",
                "option_delta": "0.00000000",
                "option_gamma": "0.00000000",
                "option_vega": "0.00000000",
                "option_theta": "0.00000000",
                "future_pnl": "0.11538462",
                "future_session_rpl": "10.00000000",
                "future_session_upl": "0.11538462",
                "future_session_funding": "10.00000000",
                "future_delta": "0.38461538",
                "future_available_balance": "0.00200000",
                "option_available_balance": "0.00200000",
                "unsettled_amount": "9.11538462"
            },
            {
                "currency": "USDT",
                "equity": "-8000000.00000000",
                "liability": "8000000.00000000",
                "usdt_index_price": "1.00000000",
                "cash_balance": "-8000000.00000000",
                "margin_balance": "-8000000.00000000",
                "available_balance": "0.00000000",
                "initial_margin": "0.00000000",
                "spot_margin": "0.00000000",
                "maintenance_margin": "0.00000000",
                "potential_liability": "8000000.00000000",
                "interest": "300.00000000",
                "interest_rate": "0.00500000",
                "pnl": "0.00000000",
                "total_delta": "0.00000000",
                "session_rpl": "0.00000000",
                "session_upl": "0.00000000",
                "option_value": "0.00000000",
                "option_pnl": "0.00000000",
                "option_session_rpl": "0.00000000",
                "option_session_upl": "0.00000000",
                "option_delta": "0.00000000",
                "option_gamma": "0.00000000",
                "option_vega": "0.00000000",
                "option_theta": "0.00000000",
                "future_pnl": "0.00000000",
                "future_session_rpl": "0.00000000",
                "future_session_upl": "0.00000000",
                "future_session_funding": "0.00000000",
                "future_delta": "0.00000000",
                "future_available_balance": "0.00000000",
                "option_available_balance": "0.00000000",
                "unsettled_amount": "-300.00000000"
            }
        ]
    }
}

统一UM用户,订阅um_account频道推送统一保证金用户的账户信息。

频道信息

频道名称 权限 订阅参数 推送频率
um_account private [raw, 100ms]

返回数据

字段名称 类型 说明
user_id int 用户ID
created_at int 时间戳(查询时刻)
usdt_total_collateral string 账户维度USDT总担保品金额
usdt_total_margin_balance string 账户维度USDT总保证金余额
usdt_total_available string 账户维度USDT总可用余额
usdt_total_initial_margin string 账户维度USDT总初始保证金
usdt_total_maintenance_margin string 账户维度USDT总维持保证金
usdt_total_initial_margin_ratio string 账户维度USDT总初始保证金率,可能会返回"infinity"
usdt_total_maintenance_margin_ratio string 账户维度USDT总维持保证金率,可能会返回"infinity"
usdt_total_liability string 账户维度USDT总负债
usdt_total_unsettled_amount string 账户维度USDT总待结金额
spot_orders_hc_loss string 现货挂单损失
details array of Detail 分币种账户信息
字段名称 类型 说明
currency string 币种
equity string 权益
liability string 负债
usdt_index_price string USDT指数价格
cash_balance string 现金余额
margin_balance string 保证金余额
available_balance string 可用余额
initial_margin string 始初保证金
spot_margin string 现货冻结金额
maintenance_margin string 维持保证金
potential_liability string 潜在负债
interest string 借币利息
interest_rate string 借币利率
pnl string 总损益
total_delta string 账户delta总值
session_rpl string 已实现损益
session_upl string 未实现损益
option_value string 期权市值
option_pnl string 期权损益
option_session_rpl string 期权已实现损益
option_session_upl string 期权未实现损益
option_delta string 期权delta
option_gamma string 期权gamma
option_vega string 期权vega
option_theta string 期权theta
future_pnl string 期货损益
future_session_rpl string 期货已实现损益
future_session_upl string 期货未实现损益
future_session_funding string 期货funding
future_delta string 期货delta
future_available_balance string 期货最大可用余余额
option_available_balance string 期权最大可用余额
unsettled_amount string 待结金额

用户订单频道(order)

Request

{
    "type":"subscribe",
    "channels":[
        "order"
    ],
    "interval": "100ms",
    "token":"6d501ded-3c40-4697-b390-218a54b9de19"
}

Response

{
    "channel":"order",
    "timestamp":1587994934089,
    "module":"spot",
    "data":[
        {
            "order_id":"1590",
            "created_at":1587870609000,
            "updated_at":1587870609000,
            "user_id":"51140",
            "pair":"BTC-USDT",
            "order_type":"limit",
            "side":"buy",
            "price":"0.16000000",
            "qty":"0.50000000",
            "time_in_force":"gtc",
            "avg_price":"0.16000000",
            "filled_qty":"0.10000000",
            "status":"open",
            "taker_fee_rate":"0.00050000",
            "maker_fee_rate":"0.00020000",
            "label":"hedge",
            "mmp": false,
            "fee": "0.000000000000",
            "fee_ccy": "BTC",
            "fee_deduction_enabled": true,
            "fee_in_deduction_ccy": "3.000000000000",
            "fee_deduction_ccy": "TONCOIN",
            "fee_deduction_rate": "0.101100000000"
        }
    ]
}

order频道推送用户的订单信息。

频道信息

频道名称 权限 订阅参数 推送频率
order private [raw, 100ms]

返回数据

字段名称 类型 说明
pair string 币对名称
order_id string 订单ID
created_at integer 创建时间戳
updated_at integer 更新时间戳
user_id string 用户ID
qty string 订单数量
filled_qty string 成交数量
price string 订单价格
avg_price string 平均成交价
side string 订单方向
order_type string 订单类型
time_in_force string 生效时间
status string 订单状态
taker_fee_rate string Taker 手续费率
maker_fee_rate string Maker 手续费率
label string 用户侧自定义订单ID
mmp bool 是否 mmp 订单
fee string 手续费
fee_ccy string 手续费单位
fee_deduction_enabled bool 是否启用手续费抵扣
fee_in_deduction_ccy string 手续费,以抵扣币种计
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例

用户交易频道(user_trade)

Request

{
    "type":"subscribe",
    "channels":[
        "user_trade"
    ],
    "interval": "100ms",
    "token":"6d501ded-3c40-4697-b390-218a54b9de19"
}

Response

{
    "channel":"user_trade",
    "timestamp":1588997059737,
    "module":"spot",
    "data":[
        {
            "trade_id":"2388418",
            "order_id":"1384232",
            "pair":"BTC-USDT",
            "qty":"0.10000000",
            "price":"0.01800000",
            "fee_rate":"0.00050000",
            "side":"buy",
            "created_at":1588997060000,
            "is_taker":true,
            "order_type":"limit",
            "label": "",
            "fee": "0.00100000",
            "fee_ccy": "TONCOIN",
            "is_fee_deducted": true,
            "fee_deduction_ccy": "TONCOIN",
            "fee_deduction_rate": "0.101100000000",
            "fee_deduction_ccy_index": "1.372980000000"
        }
    ]
}

user_trade频道推送用户的交易信息。

频道信息

频道名称 权限 订阅参数 推送频率
user_trade private [raw, 100ms]

返回数据

字段名称 类型 说明
order_id string 订单 ID
trade_id string 交易 ID
pair string 币对名称
order_type string 订单类型
side string 订单方向
price string 订单价格
qty string 订单数量
fee_rate string 手续费率
is_taker boolean 是否为taker
created_at integer 创建时间戳
label string 订单Label
fee string 手续费
fee_ccy string 手续费单位
is_fee_deducted bool 是否启用手续费抵扣
fee_deduction_ccy string 手续费抵扣币种
fee_deduction_rate string 手续费抵扣减免比例
fee_deduction_ccy_index string 手续费抵扣币种的指数价格

MMP冻结事件频道(mmp_frozen)

Request

{
    "type":"subscribe",
    "channels":[
        "mmp_frozen"
    ],
    "interval": "100ms",
    "token":"6d501ded-3c40-4697-b390-218a54b9de19"
}

Response

{
    "channel":"mmp_frozen",
    "timestamp":1599277666000,
    "module":"spot",
    "data":{
        "pair":"BTC-USDT",
        "frozen_until_ms":1599277929000
    }
}

mmp_frozen频道推送MMP冻结事件。

frozen_until_ms 显示冻结状态。
frozen_until_ms > 0: 冻结到指定时间戳,或者手动reset MMP解冻
frozen_until_ms = 0: 冻结直到reset MMP解冻

频道信息

频道名称 权限 订阅参数 推送频率
mmp_frozen private [raw, 100ms]

返回数据

字段名称 类型 说明
pair string 币对名称
frozen_until_ms integer MMP冻结时间戳

Websocket RPC

公共数据结构

Request

{
    "type":"RPC_name",
    "token":"If3Fy-o5TiOOTfvlmtryR0MTiziutYaYFkH3aRovJWWEXqCAD7CIdnbhGG5bwRqLRrGkOFEOjh0L",
    "params":{
        "param1":"hello"
    }
}

Response

{
    "type":"RPC_name",
    "result":{
        "code":0,
        "message":"",
        "data":{
            "field1":"world"
        }
    }
}

建立websocket连接后,除了数据订阅,还支持发送JSON格式的RPC请求。

首次发送私有请求需要先通过rest接口获取认证token,然后将token作为请求参数填入进行鉴权,详细参考“Websocket 数据订阅 - 获取认证Token”。

请求参数

字段名称 类型 说明
type string 请求类型
token string 私有请求认证token
params object 请求参数

返回数据

字段名称 类型 说明
type string 请求类型
result object 返回结果

result结构

字段名称 类型 说明
code integer 错误码
message string 错误信息
data object 返回数据

PING

Request

{
    "type":"ping",
    "params":{
        "id":123
    }
}

Response

{
    "type":"pong",
    "result":{
        "code":0,
        "message":"",
        "data":{
            "id":123,
            "timestamp":1632295288253
        }
    }
}

用于检测连接收发数据是否正常。客户端每隔一段时间发送一次PING请求,服务器收到后回复PONG和收到PING时的时间戳。若设定时间内未收到服务端的返回,可能是网络异常。

请求信息

名称 访问范围
ping public

请求参数

字段名称 类型 是否必须 说明
id integer 可选 客户端自定义的请求ID,服务器回复时将ID回填到PONG消息中

返回数据

字段名称 类型 说明
id integer 客户端自定义请求ID
timestamp integer 服务器收到PING时的时间戳

设置COD (cancel_on_disconnect)

Request

{
    "type":"cancel_on_disconnect",
    "token":"If3Fy-o5TiOOTfvlmtryR0MTiziutYaYFkH3aRovJWWEXqCAD7CIdnbhGG5bwRqLRrGkOFEOjh0L",
    "params":{
        "scope":"connection",
        "enable":true
    }
}

Response

{
    "type":"cancel_on_disconnect",
    "result":{
        "code":0,
        "message":"",
        "data":""
    }
}

基于连接设置开启/关闭COD (Cancel On Disconnect)。开启COD后,当websocket连接断开时,取消用户所有订单。

与rest接口 POST /v1/account_configs/cod 的差异说明:

请求信息

名称 访问范围
cancel_on_disconnect private

请求参数

字段名称 类型 是否必须 说明
scope string 可选 COD生效范围,目前只支持connection
enable bool 必须 true表示开启,false表示关闭

返回数据

None

常量定义

Account Mode

账户模式 描述
classic 经典模式
um 统一保证金模式
migrating-to-um 模式迁移中: 经典到统保
migrating-to-classic 模式迁移中: 统保到经典

Risk mode

风控模式 描述
regular 普通模式
portfolio_margin PM模式(期权/期货组合保证金模式)

Order side

订单方向 描述
buy
sell

Order Type

订单类型 描述
limit 限价单
market 市价单

Order status

订单状态 描述
pending 订单初始状态
open 订单活跃状态
filled 订单全部成交状态
cancelled 订单撤销状态

Order time in force

生效时间 描述
gtc 一直有效
fok 全部成交否则被取消
ioc 立即成交可成交部分,剩余部分取消

Transaction log type

交易日志类型 描述
trade-pay 交易-支付
trade-recv 交易-收入
fee-collection 收费
deposit 充值
bad-deposit 充值失败
withdraw 提币
withdraw-revert 撤销提币
transfer-in 账户-转入
transfer-out 账户-转出
invite-rebate 邀请返佣
invite-rebate-refund 撤销邀请返佣

Order source

订单来源 描述
api 来自API
web 来自WEB端网站
app 来自APP端网站

Self trading mode

Self-trading mode Description
0 撤销taker单(默认)
1 撤销maker单
2 允许成交

Account Mode

账户模式 描述
classic 经典模式
um 统一保证金模式
migrating-to-um 模式迁移中: 经典到统保
migrating-to-classic 模式迁移中: 统保到经典

UM transaction log type

UM交易日志类型 描述
spot-trade-pay 现货交易-支付
spot-trade-recv 现货交易-收入
deri-trade 币本位期权/期货交易
deri-delivery 币本位期权/期货交割
deri-settlement 币本位期权/期货结算
deri-socialized-fund 币本位期权/期货分摊
usdx-trade U本位期权/期货交易
usdx-delivery U本位期权/期货交割
usdx-settlement U本位期权/期货结算
usdx-socialized-fund U本位期权/期货分摊
pay-accrued-interest 支付利息
um-pex-trade-pay 自动卖币
um-pex-trade-recv 自动买币
deposit 充值
bad-deposit 充值失败
withdraw 提币
withdraw-revert 撤销提币
transfer-in 账户-转入
transfer-out 账户-转出

Feerate source

费率来源 描述
user_defined 定制(优先级最高)
vip VIP等级(成交量)
vip_manual VIP等级(手动)

错误码

错误处理

bit.com trading API 说明:


当调用bit.com的交易API时,例如 下单,编辑订单,取消订单,调用者将获得以下四种结果之一:

  1. 调用成功
  2. 调用失败
  3. 接收到响应,但是不能确定操作是成功还是失败
  4. 不能接收到响应

类型3的结果发生在bit.com的前端Web服务器未能及时从撮合引擎收到响应(由于网络问题或超时)时。 响应的形式可以为

  1. HTTP 响应"504 - Gateway Timeout": 表示故障发生在API网关层面
  2. HTTP 响应"200 - OK", 但是 JSON error code = 18500000: 表示 RPC timeout
  3. 其他形式的网络错误(如果故障发生在到达bit.com的网关之前).

当类型3的结果发生时,调用方将无法确定撮合引擎是否已接收/处理/拒绝了所发送的请求。 因此, 调用方必须发起另一个查询请求,以确认订单或帐户的状态。

Bit.com API 错误码列表:

错误码 描述
0 成功(无错误)
18100100 一般错误
18100101 不合法订单请求
18100102 不合法订单方向
18100103 不合法订单价格
18100104 不合法订单数量
18100105 不合法订单类型
18100106 不合法订单时效
18100107 获取仓位错误
18100109 获取Underlying价格失败
18100110 下单错误
18100111 序列化错误
18100112 提交创建订单请求出错
18100113 不合法订单id
18100114 获取订单错误
18100115 订单没有找到
18100116 提交撤销订单请求出错
18100117 不合法订单状态参数
18100119 获取交易记录错误
18100120 不合法创建期权请求
18100121 计算行权价错误
18100122 创建期权错误
18100123 不合法更新期权请求
18100124 不合法到期日
18100125 获取期权错误
18100126 不合法期权状态
18100127 更新期权错误
18100128 获取到期日错误
18100129 不合法交割价
18100130 期权包含有未结订单
18100131 不合法转账请求
18100132 不合法转账数量
18100133 创建转账请求错误
18100134 获取用户交易记录错误
18100135 获取转账错误
18100137 获取账户错误
18100138 获取交易记录错误
18100139 不合法的期权类型
18100141 不合法的货币
18100142 获取Underlying错误
18100143 获取Ticks错误
18100144 获取标记价格错误
18100145 获取Portfolio Margin错误
18100146 更新账户出错
18100147 获取交易日志错误
18100148 审核账户错误
18100149 交割信息错误
18100150 超过账户最大未结订单数目
18100151 超过品种最大未结订单数目
18100152 获取未结订单数目错误
18100153 创建到期日错误
18100154 更新存取Token出错
18100155 不合法的删除期权请求
18100156 删除期权出错
18100157 不合法的配置
18100158 更新配置错误
18100159 获取手续费率出错
18100160 不合法的参数
18100161 获取Orderbook出错
18100162 获取Index错误
18100163 账户信息错误
18100164 获取用户中心转账出错
18100165 不合法的用户
18100166 风险基金账户出错
18100167 风险日志错误
18100168 费用账户错误
18100169 费用日志错误
18100170 获取交割记录出错
18100171 获取风险数据出错
18100172 不合法的市场深度
18100173 到期错误
18100174 获取Orderbook统计出错
18100175 获取结算记录错误
18100176 获取Trading View数据出错
18100177 获取用户出错
18100178 保存数据出错
18100179 获取Funding图表出错
18100180 不合法的撤销订单请求
18100181 获取产品出错
18100183 获取期货产品出错
18100185 不合法的产品
18100186 平仓请求出错
18100187 获取订单保证金出错
18100188 获取限价价格出错
18100189 不合法的stop价格
18100190 获取未结stop order数目出错
18100191 超过最大stop order数目
18100192 不合法的stop价格
18100193 不合法的stop order触发类型
18100194 保存stop order失败
18100195 删除到期日出错
18100196 获取Funding Rate出错
18100197 不合法的更新到期日请求
18100198 更新到期日出错
18100199 余额不足
18100200 不合法的交易类型
18100201 获取指数数据出错
18100202 不合法的参数
18100204 不合法的分页参数
18100205 获取市场统计量出错
18100206 系统账户错误
18100210 不合法的操作员
18100211 获取接管记录出错
18100212 不合法的操作员用户id
18100213 开始接管
18100214 不合法的账户id
18100215 推出接管
18100216 绑定管理员到账户
18100217 解除绑定管理员到账户
18100218 计算组合保证金
18100223 获取接管订单出错
18100224 不合法的修改订单请求
18100225 自动价格错误
18100226 接管切换用户出错
18100227 账户被锁定
18100228 获取爆仓信息出错
18100229 记录爆仓请求出错
18100230 超过最大stop order数目
18100231 不合法的stop order状态
18100232 邮件验证码错误
18100233 电话验证码错误
18100234 Rpc错误: 修改订单失败
18100235 记录爆仓信息出错
18100236 不合法的订单角色
18100237 没有 Block Order 权限
18100238 自成交错误
18100239 不合法的时间
18100240 不合法的 Block Order 请求
18100241 接受 Block Order 出错
18100242 拒绝 Block Order 出错
18100243 计算期权维持保证金出错
18100244 减仓单错误
18100245 Block Trade 服务停止运行
18100246 获取触发价出错
18100247 获取未结订单挂单量出错
18100248 获取仓位出错
18100249 超过期权最大未结订单数目
18100250 超过期货最大未结订单数目
18100251 体验金请求出错
18100252 体验金错误
18100253 获取体验金出错
18100254 抵扣金请求出错
18100255 抵扣金错误
18100256 获取体验金活跃状态出错
18100257 获取账户配置出错
18100258 不合法的用户KYC水平
18100259 体验金重复
18100260 计算仓位出错
18100261 超过账户delta
18100262 不合法的提币请求
18100263 提币出错
18100264 不合法的用户自定义字符串
18100265 不合法的block trade来源
18100266 发送校验码出错
18100267 不合法的校验码
18100268 不合法的数字字符串
18100269 超过最大仓位
18100270 超过最大未结订单总数量
18100271 获取 Block Order出错
18100272 重复的 Blocktrade Key
18100273 创建体验金活跃记录出错
18100274 体验金超额
18100275 不合法的批量下单请求
18100276 批量订单数目错误
18100277 Rpc 批量下单出错
18100278 数据库超时
18100279 不允许接管
18100280 不合法的批量改单请求
18100281 不在未结订单列表
18100282 Rpc 批量改单出错
18100285 Mmp 错误
18100304 不合法的频道
18100305 不合法的类别
18100306 不合法的推送频率
18100314 账户模式正在迁移到Um模式
18100315 账户模式正在迁移到经典模式
18100401 不合法的地址
18100402 不是白名单地址
18100403 资金秘密错误
18100404 提币订单不存在
18100405 KYT 拒绝
18100406 提币太频繁
18100407 超过提币额度
18100408 提币金额小于最小金额
18100800 查询UserConfig错误
18200300 超过API调用限额
18200301 登陆错误
18200302 鉴权错误, 鉴权码:
17002012: 无访问此api权限
17002011: IP地址错误
17002010: 签名错误
17002014: 时间戳过期
17002006: 内部错误
18200303 超过最大连接数
18300300 无参赛
18300301 报名参赛失败
18300302 已报名参赛
18400300 只撤单阶段
18400301 正在结算中
18500000 Rpc timeout (需要调用方发查询请求确认结果,见上文)