Spot Trading

API for spot trading by regular users

Preparation for Access

Trading Pairs

A trading pair consists of a base currency and a quote currency. For example, in the trading pair BTC/USDT, BTC is the base currency and USDT is the quote currency.

Applying for an API Key

To apply for an API Key, access the Hibt app on your mobile device, go to the personal settings page, and find the API management section. After successful creation, be sure to note the following information:

  • Access Key: The API access key

  • Secret Key: The key used for signature authentication and encryption (only visible during application)

  • Password: Used for managing the API

API Authentication

Public APIs are used for retrieving basic information and market data. Public APIs do not require authentication to be called.

Private APIs are used for trading and account management. Each private request must be signed using your API Secret Key for verification.

REST API

https://api.hibt0.com/user-open-api

Signature Authentication

Private interfaces, except for public ones (such as basic information and market data), must use your API Key for encryption to verify whether the parameters or parameter values have been altered during transmission. Each API Key needs to have the appropriate permissions to access the corresponding interfaces. Every newly created API Key must be assigned permissions. Before using an interface, make sure your API Key has the required permissions.

The contents required for a valid request are as follows:

  • Method request URL: For example, https://api.hibt0.com/open-api/v1/trade/order.

  • API access key (X-ACCESS-KEY): The Access Key from the API Key you applied for.

  • Request timestamp (X-TIMESTAMP): The millisecond timestamp at the time of the request, used during the signature process.

  • Required and optional parameters: Each method has a set of required and optional parameters that define the API call. You can view these parameters and their meanings in the description of each method.

  • Signature: The value calculated via encryption to ensure the signature is valid and has not been tampered with. For the security of your API Key, the signature for parameters expires 5 minutes after generation.

  • Signature Required Parameter: For interfaces requiring signature authentication, the reqTime parameter must be included (its value is the latest server time, which can be obtained via the **/v1/common/systemTime** interface).

Encryption Method

To calculate the signature, the request must be normalized first, because when using HMAC for signature calculation, the result will be completely different for different contents. Therefore, before performing the signature calculation, please normalize the request. The following is an example of a request to query the details of an order:

Order request URL:

https://api.hibt0.com/user-open-api/v1/trade/order?amount=0.12&direction=ASK&price=7126.4285&symbol=BTC/USDT&reqTime=1672502400000

Sort the parameters in ASCII order and include the request timestamp timestamp:

amount=0.12&direction=ASK&price=7126.4285&reqTime=1672502400000&symbol=BTC/USDT&timestamp=1672502400000

Use the secretKey to encrypt the sorted request parameters using HMAC SHA256, resulting in:

550ac73ace8c34372e0e1dd6631e890c7bd16697af8bb4e2908e966b50aba4e0

Constructing HTTP Requests

  1. Use X-ACCESS-KEY to store the access key information and pass it in the header as a parameter.

  2. Use X-SIGNATURE to store the generated signature and pass it in the header as a parameter.

  3. Use X-TIMESTAMP to store the request timestamp and pass it in the header as a parameter.

Request Methods

Currently, there are only two methods: GET and POST.

  • GET requests: All parameters are included in the path parameters.

  • POST requests: All parameters are sent in the request body in form-data format.

Response Format

All APIs return data in JSON format. At the top level of the JSON response, there are three fields: message, code, and data. The first two fields represent the request status and information, while the actual business data is contained in the data field.

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

Common Error Codes

1xxx (Access Failure)

2xxx (Business Failure)

Error Code
Description

0

Success

1001

API request rate limit exceeded

1101

API Key authentication failed

1102

Secret key decryption failed

1103

Access IP not in the whitelist

2001

Parameter is empty

2002

Time range error

2003

Request time parameter is empty

2004

Request time expired

2101

Account does not exist

2102

API Key does not exist

2103

Trading pair does not exist

2201

User API Key disabled

2202

IP disabled

2203

API expired

2204

Insufficient API permissions

9999

Other exceptions, refer to message

Spot API

Basic Information API

Server Time

HTTP Request

  • GET /v1/common/systemTime

Authentication: No

Rate Limit: 100 requests/second

Request Parameters

This endpoint does not accept any parameters.

Response Fields

Field Name
Data Type
Description

data

long

Server timestamp

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

All Trading Pair Information

HTTP Request

  • GET /v1/common/symbols

Authentication: No

Rate Limit: 5 requests/second

Request Parameters

This endpoint does not accept any parameters.

Response Fields

Field Name
Data Type
Description

symbol

string

Trading pair

baseCoinScale

integer

Precision for the quoted currency

coinScale

integer

Precision for the base currency

priceScale

integer

Price precision

baseSymbol

string

Base currency

coinSymbol

string

Quote currency

minTurnover

decimal

Minimum order transaction amount

minVolume

decimal

Minimum order quantity

maxVolume

decimal

Maximum order quantity

enable

integer

Whether trading is supported (0-No; 1-Yes)

Response Example

{
  "message": "success",
  "code": "0",
  "data": [
    {
      "symbol": "BTC/USDT", // 交易对
      "baseCoinScale": 4, // 计价币数量精度
      "coinScale": 4, // 商品币数量精度
      "priceScale": 2, // 价格精度
      "baseSymbol": "USDT", // 基础币
      "coinSymbol":"BTC", // 计价币
      "minTurnover": 10, // 最小挂单成交额
      "minVolume": 0.001, // 最小下单量
      "maxVolume": 50, // 最大下单量
      "enable":  1 // 是否启用
    },
    {
      "symbol": "ETH/USDT",
      "baseCoinScale": 4,
      "coinScale": 4,
      "baseSymbol": "USDT",
      "coinSymbol":"ETH",
      "minTurnover": 10,
      "minVolume": 0.01,
      "maxVolume": 500,
      "enable": 1
    }
  ]
}

Latest Trade Price

This endpoint provides the latest trade price for a trading pair.

HTTP Request

  • GET /v1/market/ticker/price

Authentication: No

Rate Limit: 10 requests/second

Request Parameters

Parameter
Data Type
Required
Description

symbol

string

Yes

Trading pair

Response Fields

Field Name
Data Type
Description

tickerPrice

decimal

Latest trade price

Response Example

{
  "message": "success",
  "code": "0",
  "data": {
    "tickerPrice": 40000
  }
}

K-Line Data

HTTP Request

  • POST /v1/market/kline

Authentication: No

Rate Limit: 5 requests/second

Request Parameters

Parameter
Data Type
Required
Description

symbol

string

true

Trading pair

period

string

true

Time intervals: "1min", "5min", "15min", "30min", "60min", "4hour", "1day", "1week", "1mon", "1year"

size

int

false

Number of data points to retrieve, default is 100, max is 500

from

long

true

Start time (ms)

to

long

true

End time (ms)

Response Fields

Field Name
Data Type
Description

openPrice

decimal

Opening price

highestPrice

decimal

Highest price

lowestPrice

decimal

Lowest price

closePrice

decimal

Closing price

time

long

K-line timestamp (ms)

volume

decimal

Trading volume

turnover

decimal

Trading turnover

Response Example

{
  "message": "success",
  "code": "0",
  "data": [
    {
      "openPrice": "123456",
      "highestPrice": "45678",
      "lowestPrice": 0.5,
      "closePrice": 0.1,
      "volume": 0.1,
      "time": 1672502400000,
      "turnover": 1.2
    }
  ]
}

Order Book Depth Data

This endpoint returns the current order book depth data for a specified trading pair.

HTTP Request

  • GET /v1/market/depth

Authentication: No

Rate Limit: 10 requests/second

Request Parameters

Parameter
Data Type
Required
Description
Value Range

symbol

string

Yes

Trading pair

depth

integer

Yes

Number of depth levels to return

Maximum 50 levels

Response Fields

Field Name
Data Type
Description

symbol

string

Trading pair

bids

array

Buy order book depth list

asks

array

Sell order book depth list

timestamp

datetime

Time

Response Example

{
  "message": "success",
  "code": "0",
  "data": {
      "symbol" : "BTC/USDT",
      "timestamp" : "1723199363658",
      "bids" : [ [ "36074.99", "0.27225537" ], [ "36074.81", "0.00967628" ] ],
      "asks" : [ [ "36075.06", "0.55858424" ], [ "36075.24", "0.22475193" ] ]
  }
}

Account Balance

This endpoint returns the balance information for a specified currency.

HTTP Request

  • POST /v1/account/balance

Authentication: Yes

Rate Limit: 5 requests/second

Request Parameters

Parameter
Data Type
Required
Description

coin

string

No

Currency

Response Fields

Field Name
Data Type
Description

coin

string

Currency

balance

decimal

Available balance

frozenBalance

decimal

Frozen balance

isLock

string

Whether locked

Response Example

{
  "message": "success",
  "code": "0",
  "data": [
    {
      "coin": "USDT",
      "balance": 1000,
      "frozenBalance": 1000,
      "isLock": "IS_FALSE"
    },{
      "coin": BTC,
      "balance": 1,
      "frozenBalance": 0.01,
      "isLock": "IS_TRUE"
    }
  ]
}

Bill List

This endpoint returns the bill list data for a specified currency.

HTTP Request

  • POST /v1/account/bill

Authentication: Yes

Rate Limit: 5 requests/second

Request Parameters

Parameter
Data Type
Required
Description

coin

string

Yes

Currency

startTime

long

Yes

Start time (ms)

endTime

long

Yes

End time (ms)

Response Fields

Field Name
Data Type
Description

uid

long

User UID

firstLevelBillType

string

Primary bill type, e.g., 2 for trades

secondLevelBillType

string

Secondary bill type name, e.g., 1 for deposit, 4 for spot buy, 5 for spot sell

tradeType

int

Trade type; e.g., 1 for spot trading

amount

decimal

Amount

coinUnit

string

Currency

createTime

long

Creation time (ms)

Response Example

{
  "message": "success",
  "code": "0",
  "data": [
    {
      "uid": "123456",
      "firstLevelBillType": 2,
      "secondLevelBillType: 4,
      "tradeType: 1,
      "amount: 15.00,
      "coinUnit": "USDT",
      "createTime": 1672502400000
    }
  ]
}

Current Orders

HTTP Request

  • POST /v1/trade/openOrder

Authentication: Yes

Rate Limit: 10 requests/second

Request Parameters

Parameter
Data Type
Required
Description

symbol

string

Yes

Trading pair

direction

integer

Yes

Order direction (0-Buy; 1-Sell)

Response Fields

Field Name
Data Type
Description

orderId

string

Order ID

clOrdId

string

Client-defined order ID

price

decimal

Order price

avgPrice

decimal

Average trade price

amount

decimal

Order quantity

tradedAmount

decimal

Quantity traded

turnover

decimal

Trade amount (traded quantity * trade price)

symbol

string

Trading pair

baseSymbol

string

Quote currency

coinSymbol

string

Base currency

direction

integer

Direction (0-Buy; 1-Sell)

status

integer

Status (0-Pending; 1-Completed; 2-Canceled; 3-Expired; 4-Partially Filled)

type

integer

Type (0-Market; 1-Limit)

completedTime

long

Order completion time

canceledTime

long

Order cancellation time

time

long

Order creation time

Response Example

{
  "message": "success",
  "code": "0",
  "data": [
    {
      "orderId": "E1677194831589408768",
      "clOrdId": "1677AAA",
      "price": 35000,
      "avgPrice": 0,
      "amount": 0.1,
      "tradedAmount": 0,
      "turnover": 0,
      "symbol": "BTC/USDT",
      "baseSymbol": "USDT",
      "coinSymbol": "BTC",
      "direction": 0,
      "status": 0,
      "type": 1,
      "completedTime": 1672502400000,
      "canceledTime": 1672502400000,
      "time": 1672502400000
    },{
      "orderId": "E1677269378757951488",
      "clOrdId": "1677AAA",
      "price": 2000,
      "avgPrice": 0,
      "amount": 1,
      "tradedAmount": 0,
      "turnover": 0,
      "symbol": "ETH/USDT",
      "baseSymbol": "USDT",
      "coinSymbol": "ETH",
      "direction": 1,
      "status": 0,
      "type": 1,
      "completedTime": 1672502400000,
      "canceledTime": 1672502400000,
      "time": 1672502400000
    }
  ]
}

Historical Orders (Within 3 Months)

HTTP Request

  • POST /v1/trade/history

Authentication: Yes

Rate Limit: 10 requests/second

Request Parameters

Parameter
Data Type
Required
Description

symbol

string

Yes

Trading pair

startTime

long

Yes

Start time (ms)

endTime

long

Yes

End time (ms)

Response Fields

Field Name
Data Type
Description

orderId

string

Order ID

clOrdId

string

Client-defined order ID

price

decimal

Order price

avgPrice

decimal

Average trade price

amount

decimal

Order quantity

tradedAmount

decimal

Quantity traded

turnover

decimal

Trade amount (traded quantity * trade price)

symbol

string

Trading pair

baseSymbol

string

Quote currency

coinSymbol

string

Base currency

direction

integer

Direction (0-Buy; 1-Sell)

status

integer

Status (0-Pending; 1-Completed; 2-Canceled; 3-Expired; 4-Partially Filled)

type

integer

Type (0-Market; 1-Limit)

completedTime

long

Order completion time

canceledTime

long

Order cancellation time

time

long

Order creation time

Response Example

{
  "message": "success",
  "code": "0",
  "data": [
    {
      "orderId": "E1677226372826791936",
      "clOrdId": "1677AAA",
      "price": 35000,
      "avgPrice": 35000,
      "amount": 0.1,
      "tradedAmount": 0.1,
      "turnover": 3500,
      "symbol": "BTC/USDT",
      "baseSymbol": "USDT",
      "coinSymbol": "BTC",
      "direction": 0,
      "status": 1,
      "type": 1,
      "completedTime": 1672502400000,
      "canceledTime": 1672502400000,
      "time": 1672502400000
    },{
      "orderId": "E1677261905426776064",
      "clOrdId": "1677AAA",
      "price": 2000,
      "avgPrice": 2000,
      "amount": 1,
      "tradedAmount": 1,
      "turnover": 2000,
      "symbol": "ETH/USDT",
      "baseSymbol": "USDT",
      "coinSymbol": "ETH",
      "direction": 1,
      "status": 1,
      "type": 1,
      "completedTime": 1672502400000,
      "canceledTime": 1672502400000,
      "time": 1672502400000
    }
  ]
}

Spot Order Placement

HTTP Request

  • POST /v1/trade/order

Authentication: Yes

Rate Limit: 20 requests/second

Request Parameters

Parameter
Data Type
Required
Description

symbol

string

Yes

Trading pair

price

decimal

Yes

Price (set to 0 for market orders)

amount

decimal

Yes

Quantity (Market Buy: amount in quote currency, e.g., USDT; Market Sell: quantity of base currency to sell)

direction

integer

Yes

Direction (0-Buy; 1-Sell)

type

integer

Yes

Type (0-Market; 1-Limit)

Response Fields

Field Name
Data Type
Description

data

string

Order ID

Response Example

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

Cancel Order

HTTP Request

  • POST /v1/trade/cancel

Authentication: Yes

Rate Limit: 20 requests/second

Request Parameters

Parameter
Data Type
Required
Description

orderId

string

Yes

Order ID

Response Example

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

Rebate List

HTTP Request

  • POST /v1/account/rebateInfo

Authentication: Yes

Rate Limit: 5 requests/second

Request Parameters

Response Fields

Field Name
Data Type
Description

invitedUID

long

Invited user's UID

parentUID

long

Inviter's (parent) UID

createTime

long

Creation time (ms)

coin

string

Rebate coin type

rebateAmount

decimal

Rebate amount

rebateUsdtAmount

decimal

Rebate amount in equivalent USDT

Response Example

{
  "message": "success",
  "code": "0",
  "data": [
    {
      "invitedUID": "123456",
      "parentUID": "45678",
      "coin": "BTC",
      "rebateAmount": 0.1,
      "rebateUsdtAmount": 0.1,
      "createTime": 1672502400000
    }
  ]
}

User Information

HTTP Request

  • POST /v1/account/uInfo

Authentication: Yes

Rate Limit: 5 requests/second

Request Parameters

Response Fields

Field Name
Data Type
Description

uid

long

User UID

email

string

Email address

mobile

string

Mobile number

parentUid

long

Inviter's UID

Response Example

{
  "message": "success",
  "code": "0",
  "data": 
    {
      "uid": "123456",
      "email": "45678@qq.com",
      "mobile": 13800138000,
      "parentUid": 45678
    }
}

Spot WebSocket

Request URL wss://api.hibt0.com/user-open-api/ws

Order Book Depth

Authentication: No

Push Frequency: 500ms

Request Parameters

Parameter
Data Type
Required
Description
Value Range

topic

string

true

/spot/depth/BTC/USDT

method

string

true

Request Example

{
  "topic": "/spot/depth/BTC/USDT",// /spot/depth/symbol
  "method":"SUBSCRIBE"
}

Response Fields

Field Name
Data Type
Description

symbol

string

Trading pair

bids

array

Buy-side order book

asks

array

Sell-side order book

time

long

time

Response Example

{
  "data": {
    "asks": [
      ["104539.7", "0.78920499"],
      ["104539.8", "0.84600278"],
      ["104539.9", "0.84761218"],
      ["104540.1", "0.70833188"],
      ["104540.2", "1.92720935"]
    ],
    "bids": [
      ["104539.0", "0.79127465"],
      ["104538.9", "0.56433672"],
      ["104538.7", "0.66290532"],
      ["104538.6", "0.66611411"],
      ["104538.5", "1.20910389"]
    ],
    "symbol": "BTC/USDT",
    "time": 1734344532790
  },
  "topic": "/spot/depth/BTC/USDT"
}

Real-Time Market Data

Authentication: No

Push Frequency: 500ms

Request Example

{
  "method": "SUBSCRIBE",
  "topic": "/spot/thumb/BTC/USDT"
}

Response Fields

Field Name
Data Type
Description

symbol

string

Trading pair

open

string

24-hour opening price

high

string

24-hour highest price

low

string

24-hour lowest price

close

string

24-hour closing price

chg

string

24-hour price change %

change

string

24-hour price change

volume

string

24-hour trading volume

turnover

string

24-hour trading amount

Response Example

{
  "data": {
    "change": "2148.3",
    "chg": "0.0211",
    "close": "104400",
    "high": "106648",
    "low": "102147.5",
    "open": "102251.7",
    "price": "104400",
    "symbol": "BTC/USDT",
    "turnover": "121939376.554075",
    "volume": "1169.3656799256694"
  },
  "topic": "/spot/thumb/BTC/USDT"
}

Latest Transactions

Authentication: No

Push Frequency: 1000ms

Request Example

{
  "method":"SUBSCRIBE",
  "topic": "/spot/trade/BTC/USDT"
}

Response Fields

Field Name
Data Type
Description

symbol

string

Trading pair

amount

string

trade amount

price

string

trade price

side

integer

trade side:0=buiy,1=sell

time

long

trade time

turnover

string

trade turnover

Response Example

{
    "data": [
        {
            "amount": "0.0000992",
            "price": "104592.5",
            "side": 1,
            "symbol": "BTC/USDT",
            "time": 1734345158326,
            "turnover": "10.3755768"
        }
    ],
    "topic": "/spot/trade/BTC/USDT"
}

Order Information

Authentication: accessKey

Push Frequency: Real-Time

To subscribe to this topic, it is necessary to maintain a connection in order to receive real-time messages. Therefore, the client needs to send a ping request every 15 seconds. When a pong is received, it indicates that the connection is normal; otherwise, resubscription is required.

Request Parameters

Parameter
Data Type
Required
Description
Value Range

topic

string

true

/spot/order/{uid}

UID from userinfo

method

string

true

SUBSCRIBE/UNSUBSCRIBE

accessKey

string

true

user access key

sign

string

true

uid sign data

Request Example

{
  "topic": "/spot/order/198931902000XXXX",
  "method":"SUBSCRIBE",
  "accessKey":"xxxx",
  "sign":"xxx"
}

Response Fields

Field Name
Data Type
Description

symbol

string

Trading pair

orderId

string

Order ID

amount

string

Order quantity,buy base amount,sell coin amount

baseSymbol

string

Settlement currency

coinSymbol

string

Trading currency

side

integer

0: Buy, 1: Sell

status

integer

1:Completed,2:Canceled

price

string

Order price,market order is 0

time

long

Creation time (ms)

tradedAmount

string

Executed quantity

turnover

string

Executed amount

type

integer

0: Market order, 1: Limit order

uid

long

UID

Response Example

{
    "data": {
        "amount": "6",
        "baseSymbol": "USDT",
        "coinSymbol": "BTC",
        "orderId": "E1868931253529608267",
        "price": "0",
        "side": 0,
        "status": 1,
        "symbol": "BTC/USDT",
        "time": 1734422908562,
        "tradedAmount": "0.000056108851171272",
        "turnover": "6",
        "type": 0,
        "uid": 1989319020001465
    },
    "topic": "/spot/order/198931902000xxxx"
}

Last updated