币币交易
公共
安全类型: None
公共下方的接口不需要API-key或者签名就能自由访问
测试连接
GET
https://openapi.xxx.com/sapi/v1/ping
测试REST API的连通性
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/TestConnectivity.java
服务器时间
GET
https://openapi.xxx.com/sapi/v1/time
服务器时间
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/CheckServerTime.java
币对列表
GET
https://openapi.xxx.com/sapi/v1/symbols
市场支持的币对集合
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/PairsList.java
Response:
名称 | 类型 | 例子 | 描述 |
symbol | string |
| 币对名称 |
baseAsset | string |
| base货币 |
quoteAsset | string |
| 计价货币 |
pricePrecision | integer |
| 价格精度 |
quantityPrecision | integer |
| 数量精度 |
行情
安全类型: None
行情下方的接口不需要API-Key或者签名就能自由访问
订单薄
GET
https://openapi.xxx.com/sapi/v1/depth
市场订单薄深度信息
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/Depth.java
Query Parameters
Name | Type | Description |
---|---|---|
limit* | integer | 默认100; 最大100 |
symbol* | string | 币对名称 E.g. BTCUSDT |
Response:
名称 | 类型 | 例子 | 描述 |
time | long |
| 当前时间(Unix Timestamp, 毫秒ms) |
bids | list | 如下 | 订单薄买盘信息 |
asks | list | 如下 | 订单薄卖盘信息 |
bids和asks所对应的信息代表了订单薄的所有价格以及价格对应的数量的信息, 由最优价格从上倒下排列
名称 | 类型 | 例子 | 描述 |
' ' | float |
| 价格 |
' ' | float |
| 当前价格对应的数量 |
行情ticker
GET
https://openapi.xxx.com/sapi/v1/ticker
24小时价格变化数据
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/Ticker.java
Query Parameters
Name | Type | Description |
---|---|---|
symbol* | string | 币对名称 E.g. |
Response:
名称 | 类型 | 例子 | 描述 |
time | long |
| 时间戳 |
high | float |
| 最高价 |
low | float |
| 最低价 |
last | float |
| 最新价 |
vol | float |
| 交易量 |
open | float |
| 开盘价 |
最近成交
GET
https://openapi.xxx.com/sapi/v1/trades
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/RecentTradesList.java
Query Parameters
Name | Type | Description |
---|---|---|
symbol* | string | 币对名称 E.g. |
limit* | string | 默认100; 最大1000 |
Response:
名称 | 类型 | 例子 | 描述 |
| float |
| 交易价格 |
| long |
| 当前Unix时间戳,毫秒(ms) |
| float |
| 数量(张数) |
| string |
| 主动单方向 |
K线/蜡烛图数据
GET
https://openapi.xxx.com/sapi/v1/klines
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/KlineCandlestickData.java
Query Parameters
Name | Type | Description |
---|---|---|
symbol* | string | 币对名称 E.g. |
interval* | string | k线图区间, 可识别发送的值为: |
limit* | integer | 默认100; 最大300 |
Response:
名称 | 类型 | 例子 | 描述 |
| long |
| 开始时间戳,毫秒(ms) |
| float |
| 开盘价 |
| float |
| 收盘价 |
| float |
| 最高价 |
| float |
| 最低价 |
| float |
| 成交量 |
交易
安全类型: TRADE
交易下方的接口都需要签名和API-key验证
创建新订单
POST
https://openapi.xxx.com/sapi/v1/order
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/NewOrder.java
限速规则: 100次/2s
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Request Body
Name | Type | Description |
---|---|---|
symbol* | string | 币对名称 E.g. |
volume* | number | 订单数量 |
side* | string | 订单方向, |
type* | string | 订单类型, |
price | number | 订单价格, 对于 |
newClientOrderId | string | 客户端订单标识 |
recvWindow | integer | 时间窗口 |
Response:
名称 | 类型 | 例子 | 描述 |
| long |
| 订单ID(系统生成) |
| string |
| 订单ID(自己发送的) |
| string |
| 币对名称 |
| integer |
| 订单创建时间 |
| float |
| 订单价格 |
| float |
| 订单数量 |
| float |
| 已经成交订单数量 |
| string |
| 订单类型 |
| string |
| 订单方向。可能出现的值只能为: |
| string |
| 订单状态。可能出现的值为: |
创建测试订单
POST
https://openapi.xxx.com/sapi/v1/order/test
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/TestNewOrder.java
创建和验证新订单, 但不会送入撮合引擎
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Request Body
Name | Type | Description |
---|---|---|
recvWindow | integer | 时间窗口 |
symbol* | string | 币对名称 E.g. |
volume* | number | 订单数量 |
side* | string | 订单方向, |
type* | string | 订单类型, |
price | number | 订单价格, 对于 |
newClientOrderId | string | 客户端订单标识 |
批量下单
POST
https://openapi.xxx.com/sapi/v1/batchOrders
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/BatchOrders.java
限速规则: 50次/2s 一个批量最多10个订单
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Request Body
Name | Type | Description |
---|---|---|
orders* | array | 批量订单信息 最多10条 |
symbol* | string | 币对名称 E.g. |
Resquest orders
field:
orders
field:名称 | 类型 | 例子 | 描述 |
| folat | 1000 | 价格 |
| folat | 20.1 | 数量 |
| string |
| 方向 |
| string |
| 类型 |
订单查询
GET
https://openapi.xxx.com/sapi/v1/order
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/QueryOrder.java
限速规则: 20次/2s
Query Parameters
Name | Type | Description |
---|---|---|
orderId* | string | 订单id |
newClientOrderId | string | 客户端订单标识 |
symbol* | string | 币对名称 E.g. |
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Response:
名称 | 类型 | 例子 | 描述 |
| long |
| 订单ID(系统生成) |
| string |
| 订单ID(自己发送的) |
| string |
| 币对名称 |
| float |
| 订单价格 |
| float |
| 订单数量 |
| float |
| 已经成交订单数量 |
| float |
| 订单已经成交的平均价格 |
| string |
| 订单类型。可能出现的值只能为: |
| string |
| 订单方向。可能出现的值只能为: |
| string |
| 订单状态。可能出现的值为: |
撤销订单
POST
https://openapi.xxx.com/sapi/v1/cancel
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/CancelOrder.java
限速规则: 100次/2s
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Request Body
Name | Type | Description |
---|---|---|
orderId* | string | 订单id |
newClientOrderId | string | 客户端订单标识 |
symbol* | string | 币对名称 E.g. |
Response:
名称 | 类型 | 例子 | 描述 |
| long |
| 订单ID(系统生成 |
| string |
| 订单ID(自己发送的) |
| string |
| 币对名称 |
| string |
| 订单状态。可能出现的值为: |
批量撤销订单
POST
https://openapi.xxx.com/sapi/v1/batchCancel
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/BatchCancelOrders.java
限速规则: 50次/2s 一次批量最多10个订单
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Request Body
Name | Type | Description |
---|---|---|
symbol* | string | 币对名称 E.g. |
orderIds* | array | 要取消的订单id集合 |
当前订单
GET
https://openapi.xxx.com/sapi/v1/openOrders
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/CurrentOpenOrders.java
限速规则: 20次/2s
Query Parameters
Name | Type | Description |
---|---|---|
symbol* | string | 币对名称 E.g. |
limit* | integer | 默认100; 最大1000 |
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Response:
名称 | 类型 | 例子 | 描述 |
| long |
| 订单ID(系统生成) |
| string |
| 订单ID(自己发送的) |
| string |
| 币对名称 |
| float |
| 订单价格 |
| float |
| 订单数量 |
| float |
| 已经成交订单数量 |
| float |
| 订单已经成交的平均价格 |
| string |
| 订单类型。可能出现的值只能为: |
| string |
| 订单方向。可能出现的值只能为: |
| string |
| 订单状态。可能出现的值为: |
交易记录
GET
https://openapi.xxx.com/sapi/v1/myTrades
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/Trades.java
限速规则: 20次/2s
Query Parameters
Name | Type | Description |
---|---|---|
symbol* | string | 币对名称 E.g. |
limit* | string | 默认100; 最大1000 |
fromId* | integer | 从这个tradeId开始检索 |
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Response:
名称 | 类型 | 例子 | 描述 |
| string |
| 币种名称(交易对) |
| integer |
| 交易ID |
| long |
| 买方订单ID |
| long |
| 卖方订单ID |
| integer |
| 交易时间戳 |
| float |
| 交易数量 |
| number |
| 交易时间戳 |
| bool |
|
|
| bool |
|
|
| string |
| 交易手续费币种 |
| number |
| 交易手续费 |
账户
安全类型: USER_DATA
账户下方的接口都需要签名和API-key验证
账户信息
GET
https://openapi.xxx.com/sapi/v1/account
Demo:
https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/AccountInformation.java
限速规则: 20次/2s
Headers
Name | Type | Description |
---|---|---|
X-CH-SIGN* | string | 签名 |
X-CH-APIKEY* | string | 您的API-key |
X-CH-TS* | integer | 时间戳 |
Response:
名称 | 类型 | 描述 |
|
| 余额集合 |
balances
field:
名称 | 类型 | 例子 | 描述 |
| string |
| 币种名称 |
| float | 1000.30 | 可用 |
| float | 400 | 冻结 |
Last updated