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 keySecret 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:
Sort the parameters in ASCII order and include the request timestamp timestamp:
Use the secretKey
to encrypt the sorted request parameters using HMAC SHA256, resulting in:
Constructing HTTP Requests
Use X-ACCESS-KEY to store the access key information and pass it in the header as a parameter.
Use X-SIGNATURE to store the generated signature and pass it in the header as a parameter.
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.
Common Error Codes
1xxx (Access Failure)
2xxx (Business Failure)
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
data
long
Server timestamp
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
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
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
symbol
string
Yes
Trading pair
Response Fields
tickerPrice
decimal
Latest trade price
Response Example
K-Line Data
HTTP Request
POST
/v1/market/kline
Authentication: No
Rate Limit: 5 requests/second
Request Parameters
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
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
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
symbol
string
Yes
Trading pair
depth
integer
Yes
Number of depth levels to return
Maximum 50 levels
Response Fields
symbol
string
Trading pair
bids
array
Buy order book depth list
asks
array
Sell order book depth list
timestamp
datetime
Time
Response Example
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
coin
string
No
Currency
Response Fields
coin
string
Currency
balance
decimal
Available balance
frozenBalance
decimal
Frozen balance
isLock
string
Whether locked
Response Example
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
coin
string
Yes
Currency
startTime
long
Yes
Start time (ms)
endTime
long
Yes
End time (ms)
Response Fields
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
Current Orders
HTTP Request
POST
/v1/trade/openOrder
Authentication: Yes
Rate Limit: 10 requests/second
Request Parameters
symbol
string
Yes
Trading pair
direction
integer
Yes
Order direction (0-Buy; 1-Sell)
Response Fields
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
Historical Orders (Within 3 Months)
HTTP Request
POST
/v1/trade/history
Authentication: Yes
Rate Limit: 10 requests/second
Request Parameters
symbol
string
Yes
Trading pair
startTime
long
Yes
Start time (ms)
endTime
long
Yes
End time (ms)
Response Fields
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
Spot Order Placement
HTTP Request
POST
/v1/trade/order
Authentication: Yes
Rate Limit: 20 requests/second
Request Parameters
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
data
string
Order ID
Response Example
Cancel Order
HTTP Request
POST
/v1/trade/cancel
Authentication: Yes
Rate Limit: 20 requests/second
Request Parameters
orderId
string
Yes
Order ID
Response Example
Rebate List
HTTP Request
POST
/v1/account/rebateInfo
Authentication: Yes
Rate Limit: 5 requests/second
Request Parameters
Response Fields
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
User Information
HTTP Request
POST
/v1/account/uInfo
Authentication: Yes
Rate Limit: 5 requests/second
Request Parameters
Response Fields
uid
long
User UID
string
Email address
mobile
string
Mobile number
parentUid
long
Inviter's UID
Response Example
Spot WebSocket
Request URL wss://api.hibt0.com/user-open-api/ws
Order Book Depth
Authentication: No
Push Frequency: 500ms
Request Parameters
topic
string
true
/spot/depth/BTC/USDT
method
string
true
Request Example
Response Fields
symbol
string
Trading pair
bids
array
Buy-side order book
asks
array
Sell-side order book
time
long
time
Response Example
Real-Time Market Data
Authentication: No
Push Frequency: 500ms
Request Example
Response Fields
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
Latest Transactions
Authentication: No
Push Frequency: 1000ms
Request Example
Response Fields
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
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 apong
is received, it indicates that the connection is normal; otherwise, resubscription is required.
Request Parameters
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
Response Fields
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
Last updated