OVERVIEW
Introduction
Welcome to HashKey MENA Exchange API Documentation!
Rest API
Our REST API offers a simple and secure way to manage orders and monitor your digital asset portfolios. The REST API can be publicly access endpoints via market data endpoints and private authenticated endpoints for trading, funding and account data which require requests to be signed.
Websocket API
Use an asynchronous method (pub/sub) approach to efficiently deliver push notifications for orders, transactions, market and other pertinent information. By subscribing to specific topics of interest, users can receive real-time updates without the need for constant polling.
Test our sandbox
Please direct any questions or feedback to [[email protected]] to obtain sandbox account.
๐ All 2FA/SMS/Email verification code is defaulted to "123456" in Sandbox environment for ease of use
1. Go to our sandbox website page:
๐ https://global.sim.hashkeydev.com/ae/en-AE
2. Go to Settings -> API Management -> Create API
3. Enter API Key name, select API permission and setup IP Access Restriction
Technical Support
General Inquiry
Operating hours: Monday to Friday, 9:00 AM to 6:00 PM HKT
Preferred method of contact๏ผ [email protected]
Please provide your inquiry in the following format:
Subject:
Environment: Production / Sandbox Inquiry
Identity: UID / Email
Request Body:
Question:
Emergency Production Trading issue
Operating hours: 7 * 24
For urgent matters during non-office hours, please log in to hashkey.com and contact our online Customer Support team via instant message widget.
REST API
Get Started
Python [POST] Order Submit sample
import time
import requests
import hashlib
import hmac
import json
from urllib.parse import urlencode
"""
####################################################################################################################################
# Test REST API
#
# Copyright: Hashkey Trading 2025 All rights reserved.
# Please note the API code is provided "As Is" basis, without warranty of any kind, either express or implied, including
# without limitation, warranties that the API code is free of defects, merchantable, non-infringing or fit for a particular purpose
####################################################################################################################################
"""
class RestAPIClient:
def __init__(self, base_url, user_key, user_secret):
"""
Initialize the RestAPIClient with base URL, user key, and user secret.
Args:
base_url (str): The base URL of the API.
user_key (str): The user key for authentication.
user_secret (str): The user secret for authentication.
"""
self.base_url = base_url
self.user_key = user_key
self.user_secret = user_secret
self.headers = {
'X-HK-APIKEY': user_key,
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
}
def get_timestamp(self):
"""
Get the current timestamp in milliseconds.
Returns:
int: The current timestamp.
"""
return int(time.time() * 1000)
def create_signature(self, content):
"""
Create HMAC signature for authentication.
Args:
content (str): The content to be signed.
Returns:
str: The HMAC signature.
"""
content_bytes = content.encode('utf-8')
hmac_digest = hmac.new(
self.user_secret.encode('utf-8'),
content_bytes,
hashlib.sha256
).hexdigest()
return hmac_digest
def place_order(self, symbol, side, order_type, quantity, price=None):
"""
Place an order.
Args:
symbol (str): The trading pair symbol (e.g., BTCUSDT).
side (str): The order side (BUY or SELL).
order_type (str): The order type (LIMIT or MARKET).
quantity (str): The order quantity.
price (str, optional): The order price (required for LIMIT orders).
Returns:
dict or None: The JSON response if successful, None otherwise.
"""
timestamp = self.get_timestamp()
data = {
"symbol": symbol,
"side": side,
"type": order_type,
"price": price,
"quantity": quantity,
"timestamp": timestamp
}
if order_type == 'MARKET':
del data['price']
data_string = urlencode(data)
signature = self.create_signature(data_string)
data['signature'] = signature
response = requests.post(
f"{self.base_url}/api/v1.1/spot/order",
headers=self.headers,
data=data
)
if response.status_code == 200:
response_json = response.json()
print("Response:")
print(json.dumps(response_json, indent=4)) # Print formatted JSON response
return response_json
else:
try:
error_json = response.json()
print("Error:")
print(json.dumps(error_json, indent=4)) # Print formatted error response
except json.JSONDecodeError:
print(f"Error: {response.status_code} - {response.text}")
return None
if __name__ == '__main__':
# Example usage:
# Create an instance of RestAPIClient with your API credentials
# For Production account please change base_url to https://api-pro.hashkey.com
api_client = RestAPIClient(
base_url="https://api-pro.sim.hashkeydev.com",
user_key="your_user_key",
user_secret="your_user_secret"
)
# Place an order with the desired parameters
api_client.place_order("BTCUSDT", "BUY", "LIMIT", "0.01", "85000")
Python [GET] Account balance sample
import time
import requests
import hashlib
import hmac
import json
"""
####################################################################################################################################
# Test REST API
#
# Copyright: Hashkey Trading 2025 All rights reserved.
# Please note the API code is provided "As Is" basis, without warranty of any kind, either express or implied, including
# without limitation, warranties that the API code is free of defects, merchantable, non-infringing or fit for a particular purpose
####################################################################################################################################
"""
class RestAPIClient:
def __init__(self, base_url, user_key, user_secret):
"""
Initialize the RestAPIClient with base URL, user key, and user secret.
Args:
base_url (str): The base URL of the API.
user_key (str): The user key for authentication.
user_secret (str): The user secret for authentication.
"""
self.base_url = base_url
self.user_key = user_key
self.user_secret = user_secret
self.headers = {
'X-HK-APIKEY': user_key,
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
}
def get_timestamp(self):
"""
Get the current timestamp in milliseconds.
Returns:
int: The current timestamp.
"""
return int(time.time() * 1000)
def create_signature(self, content):
"""
Create HMAC signature for authentication.
Args:
content (str): The content to be signed.
Returns:
str: The HMAC signature.
"""
content_bytes = content.encode('utf-8')
hmac_digest = hmac.new(
self.user_secret.encode('utf-8'),
content_bytes,
hashlib.sha256
).hexdigest()
return hmac_digest
def get_account_info(self):
"""
Get account information.
Returns:
dict or None: The JSON response if successful, None otherwise.
"""
timestamp = self.get_timestamp()
data = {
"timestamp": timestamp
}
query_string = '&'.join([f"{key}={value}" for key, value in data.items()])
signature = self.create_signature(query_string)
response = requests.get(
f"{self.base_url}/api/v1/account?{query_string}&signature={signature}",
headers=self.headers
)
if response.status_code == 200:
response_json = response.json()
print("Response:")
print(json.dumps(response_json, indent=4)) # Print formatted JSON response
return response_json
else:
try:
error_json = response.json()
print("Error:")
print(json.dumps(error_json, indent=4)) # Print formatted error response
except json.JSONDecodeError:
print(f"Error: {response.status_code} - {response.text}")
return None
if __name__ == '__main__':
# Example usage:
# Create an instance of RestAPIClient with your API credentials
# For Production account please change base_url to https://api-pro.hashkey.com
api_client = RestAPIClient(
base_url="https://api-pro.sim.hashkeydev.com",
user_key="your_user_key",
user_secret="your_user_secret"
)
# Get account information
api_client.get_account_info()
Sandbox Environment
Restful URL:
https://api-pro.sim.hashkeydev.comWebSocket:
wss://stream-pro.sim.hashkeydev.comWebsite: https://global.sim.hashkeydev.com/ae
Production Environment
Restful URL:
https://api-pro.hashkey.comWebSocket:
wss://stream-pro.hashkey.comWebsite: https://global.hashkey.com/ae
General API Information
All responses will return a JSON object or array.
Data is returned in ascending order with the earlier data displayed first and subsequent updates appearing later
All time or timestamp-related variables are measured in milliseconds (ms)
HTTP 4XXerror code indicate that the request content is invalid. This typically originates from the client's end.HTTP 429error code indicates that the request rate limit has been exceeded.HTTP 418error code when our server have detected the IP address continues to send subsequent requests after receiving429error code and is automatically blockedHTTP 5XXindicates an internal system error. This signifies that the issue originates within the trading system. When addressing this error, it's important not to immediately categorise it as a failed task. The execution status is uncertain, it could potentially be either successful or unsuccessful.For GET endpoints, parameters must be sent as query strings.
For POST, PUT, and DELETE endpoints, unless explicitly stated otherwise, parameters must be sent as query strings or in the request body with the content type set to
application/x-www-form-urlencoded.Request Parameters can be sent in any order.
If there are parameters in both query string and request body, only the parameters of query string will be used.
Access Restrictions
If any rate limit is violated, a
429error code will be returnedEach API endpoint has an associated with a specific weight, and certain endpoints may possess varying weights based on different parameters. Endpoints that consume more resources will have a higher weight assigned to them.
Upon receiving
429error code, please take precautionary steps to cease sending requests. API abuse is strictly prohibitedIt is recommended to use Websocket API to obtain corresponding real-time data as much as possible to reduce the traffic of access restrictions caused by frequent API requests.
Order Rate Limiting
Unless explicitly stated otherwise, each API Key has a default rate limit of 2 requests per second for query-related endpoints, while order-related endpoints allow 10 requests per second.
When the number of orders exceeds the set limit, a response with an HTTP CODE 429 will be received. Please wait 1 minute for the suspended period to expire.
Endpoint Security Types
Each endpoint is assigned a security type that determines how you interact with it.
The API-KEY must be passed in the REST API header as X-APIKEY.
API-KEY and SECRET-KEY are case-sensitive.
By default, API-KEY have access to all secure endpoints.
API-KEY Management
Users have to log in the exchange website and apply for an API-KEY, please make sure to remember the following information when creating an API key:
- Access key: API access key
- Secret key: The key used for signature authentication encryption (visible to the application only)
Users have to assign permissions to API-KEY. There are two kinds of permissions,
- READ-ONLY PERMISSION: read permission is used for data query interfaces such as order query, transaction query, etc.
- READ/WRITE PERMISSION: read-write permission is used for order placing, order cancelling, including transfer permission whereby user can transfer between subaccounts under the same main trading account.
Both private REST and WebSocket modes require users to authenticate the transaction through the API-KEY passed in the API header. Refer to the following Authentication chapter for the signature algorithm of the API-KEY.
Authentication
Endpoint security type
API requests are likely to be tampered during transmission through the internet. To ensure that the request remains unchanged, all private interfaces other than public interfaces (basic information, market data) must be verified by signature authentication via API-KEY to make sure the parameters or configurations are unchanged during transmission.
Each created API-KEY need to be assigned with appropriate permissions in order to access the corresponding interface. Before using the interface, users is required to check the permission type for each interface and confirm there is appropriate permissions.
| Authentication Type | Description |
|---|---|
| NONE | Endpoints are freely accessible |
| TRADE | Endpoints requires sending a valid API-KEY and signature |
| USER_DATA | Endpoints requires sending a valid API-KEY and signature |
| USER_STREAM | The endpoints requires sending a valid API-KEY |
| MARKET_DATA | The endpoints requires sending a valid API-KEY |
Signature Authentication
Signature
TRADE & USER_DATA
The SIGNED (signature required) endpoint needs to send a parameter, signature, in the query string or request body.
The endpoint is signed with HMAC SHA256. The HMAC SHA256 signature is the result of HMAC SHA256 encryption of the key. Use your secretKey as the key and totalParams as the value to complete this encryption process.
Signature is not case sensitive.
totalParams refers to concatenation of the query string and the request body.
All HTTP requests to API endpoints require authentication and authorization. The following headers should be added to all HTTP requests:
| Key | Value | Type | Description |
|---|---|---|---|
| X-APIKEY | API-KEY | string | The API Access Key you applied for |
Time-base security requirement
- For a SIGNED endpoint, an additional parameter "timestamp" needs to be included in the request. This timestamp is in milliseconds and reflect the time when the request was intitated
- An optional parameter (not mandatory) recvWindow can be used to specify the validity period of the request in milliseconds. If recvWindow is not sent as part of the request, the default value is 5000
If your timestamp is ahead of serverTime it needs to be within 1 second + serverTime
The logic of this parameter is as follows:
if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
// process request
} else {
// reject request
}
- Trading and timeliness are closely interconnected. Network can sometimes be unstable or unreliable, which can lead to inconsistent times when requests are sent to the server.
- With recvWindow, you can specify how many milliseconds the request is valid, otherwise it will be rejected by the server. > A relatively small recvWindow (5000 or less) is recommended!
Example 1: In queryString
- queryString:
symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1538323200000
- HMAC SHA256 signature:
echo -n "symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1538323200000" | openssl dgst -sha256 -hmac "lH3ELTNiFxCQTmi9pPcWWikhsjO04Yoqw3euoHUuOLC3GYBW64ZqzQsiOEHXQS76"
Shell standard output:
5f2750ad7589d1d40757a55342e621a44037dad23b5128cc70e18ec1d1c3f4c6
- curl command:
curl -H "X-HK-APIKEY: tAQfOrPIZAhym0qHISRt8EFvxPemdBm5j5WMlkm3Ke9aFp0EGWC2CGM8GHV4kCYW" -X POST 'https://$HOST/api/v1/spot/order?symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1538323200000&signature=5f2750ad7589d1d40757a55342e621a44037dad23b5128cc70e18ec1d1c3f4c6'
Example 2: In the request body
- requestBody:
symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1538323200000
- HMAC SHA256 signature:
echo -n "symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1538323200000" | openssl dgst -sha256 -hmac "lH3ELTNiFxCQTmi9pPcWWikhsjO04Yoqw3euoHUuOLC3GYBW64ZqzQsiOEHXQS76"
Shell standard output:
5f2750ad7589d1d40757a55342e621a44037dad23b5128cc70e18ec1d1c3f4c6
- curl command:
curl -H "X-HK-APIKEY: tAQfOrPIZAhym0qHISRt8EFvxPemdBm5j5WMlkm3Ke9aFp0EGWC2CGM8GHV4kCYW" -X POST 'https://$HOST/api/v1/spot/order' -d 'symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1538323200000&signature=5f2750ad7589d1d40757a55342e621a44037dad23b5128cc70e18ec1d1c3f4c6'
Example 3: mixing queryString and request body
- queryString:
symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC
- requestBody:
quantity=1&price=0.1&recvWindow=5000รtamp=1538323200000
- HMAC SHA256 signature:
echo -n "symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=0.1&recvWindow=5000×tamp=1538323200000" | openssl dgst -sha256 -hmac "lH3ELTNiFxCQTmi9pPcWWikhsjO04Yoqw3euoHUuOLC3GYBW64ZqzQsiOEHXQS76"
Shell standard output:
885c9e3dd89ccd13408b25e6d54c2330703759d7494bea6dd5a3d1fd16ba3afa
- curl command:
curl -H "X-HK-APIKEY: tAQfOrPIZAhym0qHISRt8EFvxPemdBm5j5WMlkm3Ke9aFp0EGWC2CGM8GHV4kCYW" -X POST 'https://$HOST/openapi/v1/order?symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=0.1&recvWindow=5000×tamp=1538323200000&signature=885c9e3dd89ccd13408b25e6d54c2330703759d7494bea6dd5a3d1fd16ba3afa'
Spot Trading
Order Status
- PENDING_NEW - Pending order to be NEW
- NEW - New order, pending to be filled
- PARTIALLY_FILLED - Partially filled
- PARTIALLY_CANCELED - Partially filled and Partially cancelled
- FILLED - Completed filled
- CANCELED - Order cancelled
- REJECTED - Order refers to the rejection of an order during the order matching process.
Order Types
- LIMIT - Limit order
- MARKET - Market order
- LIMIT_MAKER - Maker limit order
Order Direction
- BUY - Buy order
- SELL - Sell Order
TimeInForce
- GTC๏ผCurrently only supports limit and limit_maker orders)
- IOC๏ผCurrently supports limit and market orders)
Test New Order
POST /api/v1/spot/orderTest
The test endpoint is solely to validate the parameters of the new order, it does not send to matching engine.
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | Y | Name of instrument, e.g. "BTCUSD", "ETHUSD" |
| side | ENUM | Y | BUY or SELL |
| type | ENUM | Y | Currently offer 3 order types: * LIMIT - Limit order * MARKET - Market order * LIMIT_MAKER - Maker Limit order |
| quantity | DECIMAL | Y | Order amount in units of the instrument. Commonly known as "orderQty" |
| price | DECIMAL | C | Required for LIMIT and LIMIT_MAKER order |
| newClientOrderId | STRING | An ID defined by the client for the order, it will be automatically generated if not sent (up to 255 characters) | |
| timeInForce | ENUM | GTC for Limit order, Limit maker order and IOC for Market order | |
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
| stpMode | ENUM | C | Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKER. Default EXPIRE_TAKER if not specified. |
Response Content
{}
{}
Create Order v1.1
POST /api/v1.1/spot/order
Certain parameters are mandatory depending on the order type:
| Type | Mandatory parameters |
|---|---|
| LIMIT | quantity, price |
| MARKET | quantity or amount |
| LIMIT_MAKER | quantity, price |
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | Y | Name of instrument e.g. "BTCUSD", "ETHUSD" |
| side | ENUM | Y | BUY or SELL |
| type | ENUM | Y | Currently offer 3 order types: - LIMIT - Limit order - MARKET - Market order - LIMIT_MAKER - Maker Limit order |
| quantity | DECIMAL | C | Order quantity in units of the instrument - Limit order: Represents the amount of the base asset you want to buy or sell. For example: BTC/USD pair, if quantity is 0.5, you're ordering 0.5 BTC - Market order: Represents the amount of the base asset to buy or sell For example: BTC/USDT pair, if quantity is 0.5, you're buying 0.5 BTC worth at the market price |
| amount | DECIMAL | C | Cash amount in the units of quote asset. Market order only - Market order: Represents the amount of the quote asset you want to use for the trade For example: For BTC/USD pair, if amount = 1000, you are placing a MARKET buy order to purchase BTC using 1000 USD at the current market price. |
| price | DECIMAL | C | Required for LIMIT and LIMIT_MAKER order |
| newClientOrderId | STRING | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request. (up to 255 characters) | |
| timeInForce | ENUM | "GTC" for Limit order & Limit maker order "IOC" for Limit order & Market order "FOK" for Limit order |
|
| stpMode | ENUM | C | Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKER Default EXPIRE_TAKER if not specified. |
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
{
"accountId": "1464567707961719552",
"symbol": "ETHUSD",
"symbolName": "ETHUSD",
"clientOrderId": "99999888905",
"orderId": "1563277167764290304",
"transactTime": "1701093160541",
"price": "1900",
"origQty": "0.03",
"executedQty": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"reqAmount": "0",
"concentration": ""
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| accountId | LONG | 1467298646903017216 | Account number |
| symbol | STRING | BTCUSD | Trading pair |
| symbolName | STRING | BTCUSD | Trading pair name |
| clientOrderId | STRING | 1690084460710352 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| orderId | LONG | 1470929500342690304 | System-generated order ID (up to 20 characters) |
| transactTime | LONG | 1690084460716 | Timestamp in milliseconds |
| price | DECIMAL | 28000 | Price |
| origQty | DECIMAL | 0.01 | Quantity |
| executedQty | DECIMAL | 0 | Traded Volume |
| status | ENUM | NEW | Order status (see enumeration definition for more details) |
| timeInForce | ENUM | GTC | Duration of the order before expiring |
| type | ENUM | LIMIT | Order type (see enumeration definition for more details) |
| side | ENUM | BUY | BUY or SELL |
| reqAmount | STRING | 0 | Requested Cash amount |
| concentration | STRING | Concentration reminder message |
Create Multiple orders by Symbol v1.1
POST /api/v1.1/spot/batchOrders
Create orders in batches up to 20 orders at a time. Currently only support for same symbol.
Weight: 1
Upper Limit: 20 orders/batch
Request Parameters
curl --request POST \
--url '/api/v1.1/spot/batchOrders?timestamp=1707492562526&signature=f19400b8b39964fd596280bbf03b37d39ff858d97e522a82d4994ecddd961e71' \
--header 'X-HK-APIKEY: NuVdtBcogpRjyQ6sMMlC6KEB0xuXZbng9zXDPyT0TOWHp64UEkyIJ287bBhaW4vy' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
[
{
"symbol": "BTCUSD",
"side": "SELL",
"type": "LIMIT",
"price": "52000",
"quantity": "0.01",
"newClientOrderId": "123456789"
},
{
"symbol": "BTCUSD",
"side": "BUY",
"type": "LIMIT",
"price": "43000",
"quantity": "0.01",
"newClientOrderId": "123456790"
}
]
'
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | Y | Name of instrument e.g. "BTCUSD", "ETHUSD" |
| side | ENUM | Y | BUY or SELL |
| type | ENUM | Y | Currently offer 3 order types: - LIMIT - Limit order - MARKET - Market order - LIMIT_MAKER - Maker Limit order |
| quantity | DECIMAL | C | Order quantity in units of the instrument - Limit order: Represents the amount of the base asset you want to buy or sell. For example: BTC/USD pair, if quantity is 0.5, you're ordering 0.5 BTC - Market order: Represents the amount of the base asset to buy or sell For example: BTC/USDT pair, if quantity is 0.5, you're buying 0.5 BTC worth at the market price |
| amount | DECIMAL | C | Cash amount in the units of quote asset. Market order only - Market order: Represents the amount of the quote asset you want to use for the trade For example: For BTC/USD pair, if amount = 1000, you are placing a MARKET buy order to purchase BTC using 1000 USD at the current market price. |
| price | DECIMAL | C | Required for LIMIT and LIMIT_MAKER order |
| newClientOrderId | STRING | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request. (up to 255 characters) | |
| timeInForce | ENUM | "GTC" for Limit order & Limit maker order "IOC" for Limit order & Market order "FOK" for Limit order |
|
| stpMode | ENUM | C | Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKER Default EXPIRE_TAKER if not specified. |
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
{
"code": 0,
"result": [
{
"code": "0000",
"order": {
"accountId": "1464567707961719552",
"symbol": "BTCUSD",
"symbolName": "BTCUSD",
"clientOrderId": "122455",
"orderId": "1563289422480390912",
"transactTime": "1701094621417",
"price": "35000",
"origQty": "0.01",
"executedQty": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"reqAmount": "0"
}
},
{
"code": "0000",
"order": {
"accountId": "1464567707961719552",
"symbol": "BTCUSD",
"symbolName": "BTCUSD",
"clientOrderId": "122433",
"orderId": "1563289422622997248",
"transactTime": "1701094621434",
"price": "35000",
"origQty": "0.01",
"executedQty": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"reqAmount": "0"
}
}
],
"concentration": ""
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | INTEGER | 0 | Error code |
| result | Object Array | Batch order result | |
| -code | INTEGER | 0 | Error code of an order |
| -msg | STRING | "Create order failed" | Error message |
| -order | Object Array | Order response data | |
| order.accountId | LONG | 1467298646903017216 | Account number |
| order.symbol | STRING | BTCUSD | Trading pair |
| order.symbolName | STRING | BTCUSD | Trading pair name |
| order.clientOrderId | STRING | 1690084460710352 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| order.orderId | LONG | 1470929500342690304 | System-generated order ID (up to 20 characters) |
| order.transactTime | LONG | 1690084460716 | Timestamp in milliseconds |
| order.price | DECIMAL | 28000 | Price |
| order.origQty | DECIMAL | 0.01 | Quantity |
| order.executedQty | DECIMAL | 0 | Traded Volume |
| order.status | ENUM | NEW | Order status (see enumeration definition for more details) |
| order.timeInForce | ENUM | GTC | Duration of the order before expiring |
| order.type | ENUM | LIMIT | Order type (see enumeration definition for more details) |
| order.side | ENUM | BUY | BUY or SELL |
| order.reqAmount | STRING | 0 | Requested Cash amount |
| concentration | STRING | Concentration reminder message | |
| stpMode | ENUM | EXPIRE_TAKER | EXPIRE_TAKER Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKER Default EXPIRE_TAKER if not specified. |
Cancel Order
DELETE /api/v1/spot/order
Cancel an existing order. Either orderId or clientOrderId must be sent.
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| orderId | STRING | C | Order ID |
| clientOrderId | STRING | C | An ID defined by the client for the order |
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
{
"accountId": "1464567707961719552",
"symbol": "ETHUSD",
"clientOrderId": "99999888912",
"orderId": "1563291927536863744",
"transactTime": "1701094920045",
"price": "1900",
"origQty": "1",
"executedQty": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| accountId | LONG | 1467298646903017216 | Account number |
| symbol | STRING | BTCUSD | Trading pair |
| clientOrderId | STRING | 1690084460710352 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| orderId | LONG | 1470929500342690304 | System-generated order ID (up to 20 characters) |
| transactTime | LONG | 1690084460716 | Timestamp in milliseconds |
| price | DECIMAL | 28000 | Price |
| origQty | DECIMAL | 0.01 | Quantity |
| executedQty | DECIMAL | 0 | Traded Volume |
| status | ENUM | NEW | Order status (see enumeration definition for more details) |
| timeInForce | ENUM | GTC | Duration of the order before expiring |
| type | ENUM | LIMIT | Order type (see enumeration definition for more details) |
| side | ENUM | BUY | BUY or SELL |
Cancel All Open Orders by Symbol
DELETE /api/v1/spot/openOrders
Cancel all open orders (Same symbol only)
Weight: 1
Upper Limit: 200 orders/batch
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | BTCUSDT | Currency pair name |
| side | STRING | BUY | BUY or SELL | |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"success": true
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| success | BOOLEAN | TRUE | Whether successful |
Cancel All Open Spot Orders
DELETE /api/v1/spot/cancelAllOpenOrders
Cancel all open orders (Max 200 orders per request). If requesting via main trading account API Key, only orders from main trading account will be canceled, but not the ones from sub trading account.
Weight: 1
Upper Limit: 200 orders/batch
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | BTCUSDT | Currency pair name. Return results for all Symbols if not specified. | |
| side | STRING | BUY | BUY or SELL | |
| fromOrderId | STRING | 1470930457684189696 | From Order ID, from which order Id will the results be generated. | |
| limit | INTERGER | 20 | Default 100, Max 200. Will only return 200 results even if limit being set greater than 200. | |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"code": "0000",
"message": "success",
"timestamp": 1714406315538,
"lastOrderId": 1470930457684189700
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | STRING | 0000 | Return code of cancellation request. |
| message | STRING | success | Return message of cancellation request. Reflecting whether the request is successfully accepted (does not indicate the task is successfully completed) |
| timestamp | LONG | 1714406315538 | Timestamp when returning |
| lastOrderId | LONG | 1470930457684189700 | Last Order ID to be canceled |
Cancel Multiple Orders By OrderId
DELETE /api/v1/spot/cancelOrderByIds
Cancel orders in batches according to order IDs (Maximum of 100 orders in a single batch)
Weight: 1
Upper Limit: 100 orders/batch
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| ids | STRING | Y | 202212231234567895,202212231234567896 | Order id (multiple, separated) |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
Success
{
"code": "0000",
"result": []
}
Certain error happened
{
"code": "0000",
"result": [
{
"orderId": "1507155386372816640",
"code": "0211"
},
{
"orderId": "1507155487740667904",
"code": "0211"
}
]
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | STRING | 0000 | 0000 means request is executed |
| result | Object Array | ||
| result.orderId | STRING | 16880363408511681 | Order ID |
| result.code | STRING | 0211 | Return error code for each order (For unsuccessful order) |
Query Order
GET /api/v1/spot/order
Check a single order information
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| orderId | STRING | C | Order ID |
| origClientOrderId | STRING | C | Client order ID |
| accountId | STRING | Account ID | |
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
{
"accountId": "1649292498437183232",
"exchangeId": "301",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"clientOrderId": "1766133332140288",
"orderId": "2108873672953505280",
"price": "0",
"origQty": "0.1",
"executedQty": "0.1",
"cummulativeQuoteQty": "11292.24",
"cumulativeQuoteQty": "11292.24",
"avgPrice": "112922.4",
"status": "FILLED",
"timeInForce": "IOC",
"type": "MARKET",
"side": "SELL",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": "1766133332319",
"updateTime": "1766133332383",
"isWorking": true,
"reqAmount": "0",
"feeCoin": "",
"feeAmount": "0",
"sumFeeAmount": "0",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| accountId | STRING | 1467298646903017216 | Account number |
| exchangeId | STRING | 301 | Exchange number |
| symbol | STRING | BTCUSD | Trading pair |
| symbolName | STRING | BTCUSD | Trading pair name |
| clientOrderId | STRING | 1690084460710352 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| orderId | STRING | 1470929500342690304 | System-generated order ID (up to 20 characters) |
| price | STRING (decimal) | 28000 | Price |
| origQty | STRING (decimal) | 0.01 | Quantity |
| executedQty | STRING (decimal) | 0 | Traded Volume |
| cumulativeQuoteQty | STRING (decimal) | 0 | Cumulative volume. Commonly known as Transaction Amount |
| avgPrice | STRING (decimal) | 0 | Average traded price |
| status | STRING | NEW | Order status (see enumeration definition for more details) |
| timeInForce | STRING | GTC | Duration of the order before expiring |
| type | STRING | LIMIT | Order type (see enumeration definition for more details) |
| side | STRING | BUY | BUY or SELL |
| stopPrice | STRING (decimal) | 0.0 | Not used |
| icebergQty | STRING (decimal) | 0.0 | Not used |
| time | STRING (decimal) | 1688036585077 | Order creation Timestamp |
| updateTime | STRING (decimal) | 1688036585084 | Latest update Timestamp according to status |
| isWorking | BOOLEAN | TRUE | Not used |
| reqAmount | STRING | 0 | Requested Cash amount |
| feeCoin | STRING | USDT | (Deprecated, will return Null) Fee Currency Name |
| feeAmount | STRING | 0.006 | (Deprecated, will return 0) Fee amount |
| sumFeeAmount | STRING | 0.006 | (Deprecated, will return 0) Sum fee amount |
| ordCxlReason | STRING | Order cancel reason | |
| stpMode | STRING | EXPIRE_MAKER | Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKER Default EXPIRE_TAKER if not specified. |
Get Current Open Orders
GET /api/v1/spot/openOrders
Query current active orders
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| fromOrderId | STRING | 1470930457684189696 | Order ID | |
| symbol | STRING | BTCUSD | Currency pair. Return all if not specified. If no value specified, return entries for all symbols | |
| side | STRING | BUY | Side | |
| limit | INTEGER | 20 | Default 500, Maximum 1000 | |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"accountId": "1464567707961719552",
"exchangeId": "301",
"symbol": "ETHUSD",
"symbolName": "ETHUSD",
"clientOrderId": "99999888913",
"orderId": "1563293653459405312",
"price": "1900",
"origQty": "1",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"cumulativeQuoteQty": "0",
"avgPrice": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": "1701095125789",
"updateTime": "1701095125798",
"isWorking": true,
"reqAmount": "0"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| No | Object Array | Query result array | |
| - accountId | STRING | 1467298646903017216 | Account number |
| - exchangeId | STRING | 301 | Exchange number |
| - symbol | STRING | BTCUSD | Trading pair |
| - symbolName | STRING | BTCUSD | Trading pair name |
| - clientOrderId | STRING | 1690084460710352 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| - orderId | STRING | 1470929500342690304 | System-generated order ID (up to 20 characters) |
| - price | STRING (decimal) | 28000 | Price |
| - origQty | STRING (decimal) | 0.01 | Quantity |
| - executedQty | STRING (decimal) | 0 | Traded Volume |
| - cumulativeQuoteQty | STRING (decimal) | 0 | Cumulative volume. Commonly known as Transaction Amount |
| - avgPrice | STRING (decimal) | 0 | Average traded price |
| - status | STRING | NEW | Order status (see enumeration definition for more details) |
| - timeInForce | STRING | GTC | Duration of the order before expiring |
| - type | STRING | LIMIT | Order type (see enumeration definition for more details) |
| - side | STRING | BUY | BUY or SELL |
| - stopPrice | STRING (decimal) | 0.0 | Not used |
| - icebergQty | STRING (decimal) | 0.0 | Not used |
| - time | STRING (decimal) | 1688036585077 | Order creation Timestamp |
| - updateTime | STRING (decimal) | 1688036585084 | Latest update Timestamp according to status |
| - isWorking | BOOLEAN | TRUE | Not used |
| - reqAmount | STRING | 0 | Requested Cash amount |
| - stpMode | STRING | EXPIRE_MAKER | Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKER Default EXPIRE_TAKER if not specified. |
Get All Traded Orders
GET /api/v1/spot/tradeOrders
Retrieve all traded orders
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| fromOrderId | STRING | 1470930457684189696 | From Order Id, which is used to return orders whose orders' id are smaller than this orderId | |
| symbol | STRING | BTCUSD | Currency pair | |
| startTime | LONG | Start Timestamp | ||
| endTime | LONG | End Timestamp. Only supports the last 90 days timeframe | ||
| side | STRING | Side | ||
| limit | INTEGER | Default 500, Maximum 1000 | ||
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"accountId": "1464567707961719552",
"exchangeId": "301",
"symbol": "ETHUSD",
"symbolName": "ETHUSD",
"clientOrderId": "99999888912",
"orderId": "1563291927536863744",
"price": "1900",
"origQty": "1",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"cumulativeQuoteQty": "0",
"avgPrice": "0",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": "1701094920045",
"updateTime": "1701094949567",
"isWorking": true,
"reqAmount": "0"
},
{
"accountId": "1464567707961719552",
"exchangeId": "301",
"symbol": "ETHUSD",
"symbolName": "ETHUSD",
"clientOrderId": "99999888911",
"orderId": "1563291785660336640",
"price": "0",
"origQty": "0",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"cumulativeQuoteQty": "0",
"avgPrice": "0",
"status": "CANCELED",
"timeInForce": "IOC",
"type": "MARKET",
"side": "BUY",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": "1701094903129",
"updateTime": "1701094903140",
"isWorking": true,
"reqAmount": "10"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| No | Object Array | Query result array | |
| - accountId | STRING | 1467298646903017216 | Account number |
| - exchangeId | STRING | 301 | Exchange number |
| - symbol | STRING | BTCUSD | Trading pair |
| - symbolName | STRING | BTCUSD | Trading pair name |
| - clientOrderId | STRING | 1690084460710352 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| - orderId | STRING | 1470929500342690304 | System-generated order ID (up to 20 characters) |
| - price | STRING (decimal) | 28000 | Price |
| - origQty | STRING (decimal) | 0.01 | Quantity |
| - executedQty | STRING (decimal) | 0 | Traded Volume |
| - cumulativeQuoteQty | STRING (decimal) | 0 | Cumulative volume. Commonly known as Transaction Amount |
| - avgPrice | STRING (decimal) | 0 | Average traded price |
| - status | STRING | NEW | Order status (see enumeration definition for more details) |
| - timeInForce | STRING | GTC | Duration of the order before expiring |
| - type | STRING | LIMIT | Order type (see enumeration definition for more details) |
| - side | STRING | BUY | BUY or SELL |
| - stopPrice | STRING (decimal) | 0.0 | Not used |
| - icebergQty | STRING (decimal) | 0.0 | Not used |
| - time | STRING (decimal) | 1688036585077 | Order creation Timestamp |
| - updateTime | STRING (decimal) | 1688036585084 | Latest update Timestamp according to status |
| - isWorking | BOOLEAN | TRUE | Not used |
| - reqAmount | STRING | 0 | Requested Cash amount |
| - stpMode | STRING | EXPIRE_MAKER | Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKER Default EXPIRE_TAKER if not specified. |
Account
Get VIP Information
GET /api/v1/account/vipInfo
Retrieve VIP Level and Trading fee rates
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbols | STRING | Trading pairs | ||
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
{
"code": 0,
"vipLevel": "0",
"tradeVol30Day": "0",
"totalAssetBal": "0",
"data": [
{
"symbol": "USDTUSD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "USD",
"buyTakerFeeCurrency": "USD",
"sellMakerFeeCurrency": "USD",
"sellTakerFeeCurrency": "USD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "ATOMUSDC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "ATOM",
"buyTakerFeeCurrency": "ATOM",
"sellMakerFeeCurrency": "USDC",
"sellTakerFeeCurrency": "USDC",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "ATOMBTC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "ATOM",
"buyTakerFeeCurrency": "ATOM",
"sellMakerFeeCurrency": "BTC",
"sellTakerFeeCurrency": "BTC",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "BTCHKD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "HKD",
"buyTakerFeeCurrency": "HKD",
"sellMakerFeeCurrency": "HKD",
"sellTakerFeeCurrency": "HKD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "EOSUSDC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "EOS",
"buyTakerFeeCurrency": "EOS",
"sellMakerFeeCurrency": "USDC",
"sellTakerFeeCurrency": "USDC",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "ETHUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.00025",
"actualTakerRate": "0.0006"
},
{
"symbol": "BTCUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.00025",
"actualTakerRate": "0.0006"
},
{
"symbol": "ATOMUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "ATOM",
"buyTakerFeeCurrency": "ATOM",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "EOSUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "QT2USDC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "QT2",
"buyTakerFeeCurrency": "QT2",
"sellMakerFeeCurrency": "USDC",
"sellTakerFeeCurrency": "USDC",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "HSKUSDC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "HSK",
"buyTakerFeeCurrency": "HSK",
"sellMakerFeeCurrency": "USDC",
"sellTakerFeeCurrency": "USDC",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "DOTUSD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "USD",
"buyTakerFeeCurrency": "USD",
"sellMakerFeeCurrency": "USD",
"sellTakerFeeCurrency": "USD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "SANDUSD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "USD",
"buyTakerFeeCurrency": "USD",
"sellMakerFeeCurrency": "USD",
"sellTakerFeeCurrency": "USD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "BCHUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "BCH",
"buyTakerFeeCurrency": "BCH",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "QATS4USDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "ETHUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "ETH",
"buyTakerFeeCurrency": "ETH",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "SHIBUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "ATBTC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "AT",
"buyTakerFeeCurrency": "AT",
"sellMakerFeeCurrency": "BTC",
"sellTakerFeeCurrency": "BTC",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "TONUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "TON",
"buyTakerFeeCurrency": "TON",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "WIFUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "DOGEUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "DOGE",
"buyTakerFeeCurrency": "DOGE",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "ETHEOS",
"productType": "Token-Token",
"buyMakerFeeCurrency": "ETH",
"buyTakerFeeCurrency": "ETH",
"sellMakerFeeCurrency": "EOS",
"sellTakerFeeCurrency": "EOS",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "QATS5USDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "QTBTC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "QT",
"buyTakerFeeCurrency": "QT",
"sellMakerFeeCurrency": "BTC",
"sellTakerFeeCurrency": "BTC",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "ATOMUSD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "USD",
"buyTakerFeeCurrency": "USD",
"sellMakerFeeCurrency": "USD",
"sellTakerFeeCurrency": "USD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "DOGEUSDC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "DOGE",
"buyTakerFeeCurrency": "DOGE",
"sellMakerFeeCurrency": "USDC",
"sellTakerFeeCurrency": "USDC",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "MATICUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "MATIC",
"buyTakerFeeCurrency": "MATIC",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "HTGLUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "HTGL",
"buyTakerFeeCurrency": "HTGL",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "QTUSDC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "QT",
"buyTakerFeeCurrency": "QT",
"sellMakerFeeCurrency": "USDC",
"sellTakerFeeCurrency": "USDC",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "SANDUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "SAND",
"buyTakerFeeCurrency": "SAND",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "QATS1USDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "AVAXUSD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "USD",
"buyTakerFeeCurrency": "USD",
"sellMakerFeeCurrency": "USD",
"sellTakerFeeCurrency": "USD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "PEPEUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "EOSETH",
"productType": "Token-Token",
"buyMakerFeeCurrency": "EOS",
"buyTakerFeeCurrency": "EOS",
"sellMakerFeeCurrency": "ETH",
"sellTakerFeeCurrency": "ETH",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "COMPUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "COMP",
"buyTakerFeeCurrency": "COMP",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "BTCUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "BTC",
"buyTakerFeeCurrency": "BTC",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "USDCUSD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "USD",
"buyTakerFeeCurrency": "USD",
"sellMakerFeeCurrency": "USD",
"sellTakerFeeCurrency": "USD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "NOTUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "NOT",
"buyTakerFeeCurrency": "NOT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "GMXUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "GMX",
"buyTakerFeeCurrency": "GMX",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "QATS2USDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "LTCUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "LTC",
"buyTakerFeeCurrency": "LTC",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "SPICEUSDT",
"productType": "ST-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "NOTUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "HSKUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "HSK",
"buyTakerFeeCurrency": "HSK",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "DOTUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "DOT",
"buyTakerFeeCurrency": "DOT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "SOLUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "ZZZUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "ZZZ",
"buyTakerFeeCurrency": "ZZZ",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "QTETH",
"productType": "Token-Token",
"buyMakerFeeCurrency": "QT",
"buyTakerFeeCurrency": "QT",
"sellMakerFeeCurrency": "ETH",
"sellTakerFeeCurrency": "ETH",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "NOTUSDC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "NOT",
"buyTakerFeeCurrency": "NOT",
"sellMakerFeeCurrency": "USDC",
"sellTakerFeeCurrency": "USDC",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "XRPUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "USDTUSDC",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDC",
"sellTakerFeeCurrency": "USDC",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "DYDXUSDT",
"productType": "Token-Token",
"buyMakerFeeCurrency": "DYDX",
"buyTakerFeeCurrency": "DYDX",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0012",
"actualTakerRate": "0.0012"
},
{
"symbol": "AVAXUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "ETHHKD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "HKD",
"buyTakerFeeCurrency": "HKD",
"sellMakerFeeCurrency": "HKD",
"sellTakerFeeCurrency": "HKD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
},
{
"symbol": "DOGEUSDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0.0006",
"actualTakerRate": "0.0006"
},
{
"symbol": "QATS3USDT-PERPETUAL",
"productType": "Token-Token",
"buyMakerFeeCurrency": "USDT",
"buyTakerFeeCurrency": "USDT",
"sellMakerFeeCurrency": "USDT",
"sellTakerFeeCurrency": "USDT",
"actualMakerRate": "0",
"actualTakerRate": "0"
},
{
"symbol": "QTUSD",
"productType": "Token-Fiat",
"buyMakerFeeCurrency": "USD",
"buyTakerFeeCurrency": "USD",
"sellMakerFeeCurrency": "USD",
"sellTakerFeeCurrency": "USD",
"actualMakerRate": "0.0015",
"actualTakerRate": "0.0015"
}
],
"updateTimestamp": "1740383504179"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | INTEGER | 0 | Status code |
| msg | STRING | Error message (if any) | |
| vipLevel | STRING | 0 | VIP Level |
| tradeVol30Day | STRING | 300000000 | Total trading volume in Last 30 days (USD) |
| totalAssetBal | STRING | 1000000000 | Total asset balance (USD) |
| data | Object Array | ||
| - symbol | STRING | Trading pair | |
| - productType | STRING | Token-Token | Token-Token, Token-Fiat, ST-Token |
| - buyMakerFeeCurrency | STRING | BTC | Buy maker fee currency |
| - buyTakerFeeCurrency | STRING | BTC | Buy taker fee currency |
| - sellMakerFeeCurrency | STRING | USD | Sell maker fee currency |
| - sellTakerFeeCurrency | STRING | USD | Sell taker fee currency |
| - actualMakerRate | STRING | 0.015 | Maker fee including any discount |
| - actualTakerRate | STRING | 0.015 | Taker fee including any discount |
| updateTimeStamp | STRING | 1709330424013 | Update timestamp of the request (Daily snapshot) |
Get Account Information
GET /api/v1/account
Retrieve account balance
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| accountId | LONG | 1471090223379184384 | Account ID, for Master Key only (Master Key users can check sub trading account information by inputing sub trading accountId) | |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
{
"balances": [
{
"asset": "BTC",
"assetId": "BTC",
"assetName": "BTC",
"total": "61.206456639",
"free": "61.051866639",
"locked": "0.15459"
},
{
"asset": "ETH",
"assetId": "ETH",
"assetName": "ETH",
"total": "1152.49672544",
"free": "1152.49672544",
"locked": "0"
},
{
"asset": "USDC",
"assetId": "USDC",
"assetName": "USDC",
"total": "4098.36",
"free": "4098.36",
"locked": "0"
},
{
"asset": "USDT",
"assetId": "USDT",
"assetName": "USDT",
"total": "206381.2785765348009",
"free": "206381.2785765348009",
"locked": "0"
}
],
"userId": "1649292498445571840"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| balances | Object Array | Query an asset array | |
| balances.asset | STRING | BTC | Assets |
| balances.assetId | STRING | BTC | Asset ID |
| balances.assetName | STRING | BTC | Asset Name |
| balances.total | STRING | 100.63264 | Total available funds |
| balances.free | STRING | 100.63264 | Available funds |
| balances.locked | STRING | 0 | Frozen funds |
| userId | STRING | 1649292498445571840 | User ID |
Get Account Trade List
GET /api/v1/account/trades
Query account history and transaction records
Weight: 5
Request Parameters
- If there is only fromId, It will return trades with IDs bigger than fromId, sorted in descending order.
- If there is only toId. It will return trades with IDs less than toId, sorted in descending order
- If both fromId and toId are provided. It will return trades between fromId and toId, sorted in descending order
- If neither fromId or toId is provided, it will return the latest trade records, sorted in descending order.
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | Trading pair | |
| startTime | LONG | Start Timestamp, Only supports the last 30 days timeframe | |
| endTime | LONG | End Timestamp. | |
| clientOrderId | STRING | Client Order ID | |
| fromId | LONG | Starting ID | |
| toId | LONG | End ID | |
| limit | INT | Limit of record. Default 500, max 1000 | |
| accountId | LONG | Account ID | |
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"id": "2133553701515831040",
"clientOrderId": "1769075420193253",
"ticketId": "4636458470505791492",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"orderId": "2133553695652194048",
"matchOrderId": "0",
"price": "112935.08",
"qty": "0.01098",
"commission": "0.000013176",
"commissionAsset": "BTC",
"time": "1769075420311",
"isBuyer": true,
"isMaker": false,
"fee": {
"feeCoinId": "BTC",
"feeCoinName": "BTC",
"fee": "0.000013176",
"originCoinId": "BTC",
"originCoinName": "BTC",
"originFee": "0.000013176"
},
"feeCoinId": "BTC",
"feeAmount": "0.000013176",
"makerRebate": "0",
"hskDeduct": false,
"hskDeductPrice": ""
},
{
"id": "2133553700836353792",
"clientOrderId": "1769075420193253",
"ticketId": "4636458470505791491",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"orderId": "2133553695652194048",
"matchOrderId": "0",
"price": "112935.06",
"qty": "0.035",
"commission": "0.000042",
"commissionAsset": "BTC",
"time": "1769075420311",
"isBuyer": true,
"isMaker": false,
"fee": {
"feeCoinId": "BTC",
"feeCoinName": "BTC",
"fee": "0.000042",
"originCoinId": "BTC",
"originCoinName": "BTC",
"originFee": "0.000042"
},
"feeCoinId": "BTC",
"feeAmount": "0.000042",
"makerRebate": "0",
"hskDeduct": false,
"hskDeductPrice": ""
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | Check transaction results | |
| id | STRING | 1470930841345474561 | Unique transaction ID |
| clientOrderId | STRING | 999999999800021 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| ticketId | STRING | 1478144171272585249 | Execution ID, the execution ID is the same for the direction of a single trade. |
| symbol | STRING | BTCUSD | Trading pair |
| symbolName | STRING | BTCUSD | Trading pair name |
| orderId | STRING | 1470930841211329280 | Order ID |
| matchOrderId | STRING | //Ignore | |
| price | STRING (decimal) | 29851.03 | Price |
| qty | STRING (decimal) | 0.0005 | Quantity |
| commission | STRING (decimal) | 0.02985103 | Commission fee |
| commissionAsset | STRING | USD | Currency of commission fee |
| time | STRING (decimal) | 1690084620567 | Millisecond Timestamp โ trade time (traded but not yet settled) ๆฎๅๆไบคๆถ้ด |
| isBuyer | BOOLEAN | false | Whether the trade is a buyer |
| isMaker | BOOLEAN | false | Whether the trade is a maker |
| fee | Object | Fee information | |
| fee.feeCoinId | STRING | USD | Fee currency |
| fee.feeCoinName | STRING | USD | Fee currency name |
| fee.fee | STRING (decimal) | 0.02985103 | Transaction fee amount after HSK deduction |
| fee.originFee | STRING (decimal) | 0.03085103 | The commission fee before HSK deduction. |
| fee.originCoinId | STRING | USD | The commission fee before HSK deduction |
| fee.originCoinName | STRING | USD | The commission fee coin |
| feeCoinId | STRING | USD | Fee currency |
| feeAmount | STRING (decimal) | 0.02985103 | Amount of transaction fee |
| makerRebate | STRING | 0 | Return |
| hskDeduct | BOOLEAN | true | true: successfully deducted HSK false |
| hskDeductPrice | STRING | 0.001 | commission Coin price / HSK price |
Query Account Type
GET /api/v1/account/type
Account Type
| accountType | Type |
|---|---|
| 1 | Main Trading Account |
| 5 | Custody Account |
| 6 | Fiat Account |
| 1 | Sub Main Trading Account |
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"accountId": "1933473576343719680",
"accountLabel": "Main Trading Account",
"accountType": 1,
"accountIndex": 0,
"userId": "1933473576368885504"
},
{
"accountId": "1933473576343719683",
"accountLabel": "Custody Account",
"accountType": 5,
"accountIndex": 0,
"userId": "1933473576368885504"
},
{
"accountId": "1933473576343719684",
"accountLabel": "Fiat Account",
"accountType": 6,
"accountIndex": 0,
"userId": "1933473576368885504"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | Query subaccount results | |
| accountId | STRING | 1954336770171707136 | Account Number |
| accountLabel | STRING | Custody Account | Account Label |
| accountType | INTEGER | 1 | Account Type |
| accountIndex | INTEGER | 0 | //Ignore |
| userId | STRING | 1954336770188484352 | UserId of the account |
Internal Account Transfer
This endpoint should be called no more than once per second.
POST /api/v1/account/assetTransfer
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req 'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| fromAccountId | STRING | Y | 1467296062716909568 | Source Account ID |
| toAccountId | STRING | Y | 1473231491689395200 | Destinate Account ID |
| coin | STRING | Y | USDT | Coin |
| quantity | STRING(DECIMAL) | Y | 20 | Transfer amount |
| remark | STRING | TestingRemark | Remark | |
| clientOrderId | STRING | 12345678 | Client unique order identifier (up to 64 characters) | |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | 1712317312973 | Timestamp |
Response Content
{
"success": true,
"timestamp": 1766583205575,
"clientOrderId": "",
"orderId": "2112647482861233664"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| success | BOOLEAN | TRUE | Whether successful |
| timestamp | LONG | 1699943911155 | Transfer completed time |
| clientOrderId | STRING | 12345678 | Client unique order identifier |
| orderId | STRING | 1555687946987836672 | Transfer Order ID |
Get API Key Type
GET /api/v1/account/checkApiKey
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
{
"accountType": "Master Account"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| accountType | STRING | Master AccountSub Account |
Account Type |
Get Fiat History
GET /api/v1/account/fiat/history
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| type | STRING | Y | "deposit", "withdraw" |
| status | STRING | deposit: โข "under_review" โข "processing" โข "successful" โข "failed" withdraw: โข "under_review" โข "processing" โข "successful" โข "failed" |
|
| startTime | LONG | Y | Start timestamp |
| endTime | LONG | Y | End timestamp |
| channel | STRING | "auto", "manual"; default "auto" For transaction records prior to 2023/9/1 please use manual channel |
|
| remark | STRING | Remark | |
| limit | INTEGER | Limit | |
| recvWindow | LONG | Recv Window | |
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"orderId": "NFW773922940306722816",
"type": "withdraw",
"remark": "/D773922971355262976",
"asset": "USD",
"grossAmount": "100",
"netAmount": "105",
"fee": "5",
"status": "successful",
"createdTime": "1762325607762",
"updatedTime": "1762841797000",
"channel": "auto",
"clientOrderId": "1234567891104aab"
},
{
"orderId": "NFW773588989415469056",
"type": "withdraw",
"remark": "/D773589020879171584",
"asset": "USD",
"grossAmount": "100",
"netAmount": "105",
"fee": "5",
"status": "successful",
"createdTime": "1762245987665",
"updatedTime": "1762842585000",
"channel": "auto",
"clientOrderId": "1234567891104aa"
},
{
"orderId": "NFW773570664979443712",
"type": "withdraw",
"remark": "/D773570692198510592",
"asset": "USD",
"grossAmount": "1000",
"netAmount": "1005",
"fee": "5",
"status": "processing",
"createdTime": "1762241618778",
"updatedTime": "1762241625000",
"channel": "auto",
"clientOrderId": "1234567891104"
}
]
| PARAMETER | TYPE | DESCRIPTION |
|---|---|---|
| orderId | STRING | Fiat Order ID, e.g: NFW730739521377169408 |
| type | STRING | "deposit", "withdraw" |
| remark | STRING | Deposit: The remark message from bank deposit |
| asset | STRING | "USD" or "HKD". Fee Asset is the same as the Transaction Asset. |
| grossAmount | STRING | Deposit/Withdraw order amount |
| netAmount | STRING | Actual fund in amount Deposit: grossAmount - fee Withdraw: grossAmount + fee |
| fee | STRING | Deposit / Withdraw fee |
| status | STRING | deposit: โข "under_review" โข "processing" โข "failed" โข "successful" โข "withdraw_return" withdraw: โข "under_review" โข "processing" โข "failed" โข "successful" โข "return" |
| createdTime | STRING | Order Created Timestamp |
| updatedTime | STRING | Order Updated Timestamp |
Get Account Transaction History List
GET /api/v1/account/balanceFlow
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| startTime | STRING | Y | Start Time |
| endTime | STRING | Y | End Time |
| limit | STRING | Up to 500 | |
| flowType | INTEGER | Value 1 Trade, recent 7-day dataValue 2 FEE, recent-7-day dataValue 32 Funding FEE, recent-30-day dataValue 51 USER_ACCOUNT_TRANSFER, recent-30-day dataValue 900 CUSTODY_DEPOSIT, recent-30-day dataValue 904 CUSTODY_WITHDRAW, recent-30-day dataValue 906 FIAT_DEPOSIT, recent-30-day dataValue 910 FIAT_WITHDRAW, recent-30-day data |
|
| accountType | INTEGER | Value 1 Trading Account Record SpotValue 3 Trading Account Record ContractValue 5 Custody Account RecordValue 6 Fiat Account Record |
|
| timestamp | LONG | Y | Timestamp |
Response Content
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | Check account transfer history | |
| id | STRING | 1468775459672099840 | Unique ID of the transfer |
| accountId | STRING | 1467298646903017216 | Account number |
| coin | STRING | USDC | Currency |
| coinId | STRING | USDC | Currency ID |
| coinName | STRING | USDC | Currency name |
| flowTypeValue | INTEGER | 79 | Transfer type value |
| flowType | STRING | OPERATION_ACCOUNT_TRANSFER | Transfer name |
| change | STRING | 1000000 | Change |
| total | STRING | 1000000 | Total |
| created | STRING | 1689856479058 | Create timestamp |
| symbol | STRING | Trading pair |
Example how to use
Account Type and Account ID
| Account Type | Account ID |
|---|---|
| Main Trading Account | 1649292498437183232 |
| Custody Account | 1649292498437183235 |
| Sub Trading Account | 1673782460192774144 |
Example 1: Transfer 10 USDT from Main Trading Account to Custody Account
POST https://api-pro.sim.hashkeydev.com/api/v1/account/assetTransfer?fromAccountId=1649292498437183232&toAccountId=1649292498437183235&coin=USDT&quantity=10&signature=7bbbdb853fb3c0743de5c7f905badf30b2f8715c6ef3059dd9e575cc4ba0be0f×tamp=1714557951154
Get account transaction history list flowType = 51, accountType = 1.Only subject to master account API key, not available to sub account API key to query.
[
{
"id": "1676228025233055232",
"accountId": "1649292498437183232",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 51,
"flowType": "USER_ACCOUNT_TRANSFER",
"flowName": "",
"change": "-10",
"total": "398026.95",
"created": "1714557952009"
}
]
Get account transaction history list flowType = 51, accountType = 5.Only subject to master account API key, not available to sub account API key to query.
[
{
"id": "1676228025316941312",
"accountId": "1649292498437183235",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 51,
"flowType": "USER_ACCOUNT_TRANSFER",
"flowName": "",
"change": "10",
"total": "25.05",
"created": "1714557952009"
}
]
Example 2:Transfer 15 USD from Main Trading Account to Sub Trading Account
POST https://api-pro.sim.hashkeydev.com/api/v1/account/assetTransfer?fromAccountId=1649292498437183232&toAccountId=1673782460192774144&coin=USDT&quantity=15&signature=50e919a9d9937f663d00a267d6121083dcda1f1faf777c27dcf08b3fc50fa3da×tamp=1714559004249
Get account transaction history list flowType = 51, accountType = 1 with master account API key.
[
{
"id": "1676236860475710976",
"accountId": "1649292498437183232",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 51,
"flowType": "USER_ACCOUNT_TRANSFER",
"flowName": "",
"change": "-15",
"total": "398011.95",
"created": "1714559005252"
}
]
Get account transaction history list flowType = 51, accountType = 1 with sub account API key.
[
{
"id": "1676236860517654016",
"accountId": "1673782460192774144",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 51,
"flowType": "USER_ACCOUNT_TRANSFER",
"flowName": "",
"change": "15",
"total": "100003",
"created": "1714559005252"
}
]
Type = 32 (Funding Fee)
Get account transaction history list Type = 32
json
[
{
"id": "1980570992225894912",
"accountId": "1730577321730074368",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 32,
"flowType": "FUNDING_SETTLEMENT",
"flowName": "",
"change": "-1343.43497925",
"total": "31586975.651145907429875085",
"created": "1750838460878",
"symbol": "FATS1USDT"
},
{
"id": "1980570990682391041",
"accountId": "1730577321730074368",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 32,
"flowType": "FUNDING_SETTLEMENT",
"flowName": "",
"change": "-55956",
"total": "31588319.086125157429875085",
"created": "1750838460698",
"symbol": "BTCUSDT"
},
{
"id": "1980329400776868352",
"accountId": "1730577321730074368",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 32,
"flowType": "FUNDING_SETTLEMENT",
"flowName": "",
"change": "-1336.37743575",
"total": "31644275.086125157429875085",
"created": "1750809660937",
"symbol": "FATS1USDT"
},
{
"id": "1980329400105779712",
"accountId": "1730577321730074368",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 32,
"flowType": "FUNDING_SETTLEMENT",
"flowName": "",
"change": "-55956",
"total": "31645611.463560907429875085",
"created": "1750809660860",
"symbol": "BTCUSDT"
}
]
Get ChainType
GET /api/v1/account/chainType
Get the supported list of ChainType for a specific CoinId(e.g. ETH) ChainType is typically used when deposit & withdrawal
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| coinId | STRING | Y | USDT | Coin Name. e.g: "BTC", "ETH" |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"coinId": "USDT",
"coinName": "USDT",
"chainTypeList": [
"ETH",
"Tron"
]
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | ||
| coinId | STRING | USDT | Coin Name |
| coinName | STRING | USDT | Coin Name |
| chainTypeList | LIST | ["ETH","Tron"] | List of supported chain types. |
| errorCode | STRING | 0001 | Error code, returned only when there is an error |
| errorMsg | STRING | - | Error message, returned only when there is an error |
Get Coin Information
GET /api/v1/coinInfo
Request Parameters
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| coinId | STRING | Y | The unique identifier of the cryptocurrency |
Response Content
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| timezone | STRING | UTC | Timezone |
| serverTime | INTEGER | 1727068513801 | Server millisecond timestamp |
| coins | Object Array | Coin list | |
| coins.orgId | STRING (integer) | 9001 | Institution ID |
| coins.coinId | STRING | ETH | Coin ID |
| coins.coinName | STRING | ETH | Coin name |
| coins.coinFullName | STRING | ETH | Coin full name |
| coins.allowWithdraw | BOOLEAN | true | Whether to allow withdrawal |
| coins.allowDeposit | BOOLEAN | true | Whether to allow deposit |
| chainTypes | Object Array | Chain information list | |
| chainTypes.chainType | STRING | ETH | Chain type |
| chainTypes.withdrawFee | STRING | 0.0000001 | Withdrawal fee |
| chainTypes.minWithdrawQuantity | STRING | 0.0000002 | Minimum withdrawal amount |
| chainTypes.maxWithdrawQuantity | STRING | 0 | Maximum withdrawal amount |
| chainTypes.minDepositQuantity | STRING | 0.002 | Minimum deposit quantity |
| chainTypes.allowDeposit | BOOLEAN | true | Whether to allow deposit |
| chainTypes.allowWithdraw | BOOLEAN | true | Whether to allow withdrawal |
Sub Account
Get Sub Account Open Orders
GET /api/v1/spot/subAccount/openOrders
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| subAccountId | STRING | Y | 1650801631044854016 | Sub Account ID |
| fromOrderId | LONG | 1470930457684189696 | Order ID | |
| side | ENUM | BUY or SELL |
||
| symbol | STRING | BTCUSD | Currency Pair | |
| limit | INT | 500 | Default 500, Maximum 500 | |
| timestamp | LONG | Y | 1712317312973 | Timestamp |
Response Content
[
{
"accountId": "1695624199270418688",
"exchangeId": "301",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"clientOrderId": "1766585803470297",
"orderId": "2112669276414486016",
"price": "112930",
"origQty": "0.1",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"cumulativeQuoteQty": "0",
"avgPrice": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": "1766585803498",
"updateTime": "1766585803570",
"isWorking": true,
"reqAmount": "0",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | Query result array | |
| accountId | STRING | 1471090223379184384 | Account number |
| exchangeId | STRING | 301 | Exchange Number |
| symbol | STRING | BTCUSD | Trading pair |
| symbolName | STRING | BTCUSD | Trading pair name |
| clientOrderId | STRING | 123456 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| orderId | STRING | 1470930457684189696 | System generated order ID |
| price | STRING (decimal) | 28000 | Price |
| origQty | STRING (decimal) | 0.01 | Quantity |
| executedQty | STRING (decimal) | 0 | Traded volume |
| cumulativeQuoteQty | STRING (decimal) | 0 | Cumulative volume |
| avgPrice | STRING (decimal) | 0 | Average traded price |
| status | STRING | NEW | Order status |
| timeInForce | STRING | GTC | Duration of the order before expiring |
| type | STRING | LIMIT | Order Type |
| side | STRING | BUY | BUY or SELL |
| stopPrice | STRING (decimal) | 0.0 | Not used |
| icebergQty | STRING (decimal) | 0.0 | Not used |
| time | STRING | 1690084574839 | Current Timestamp |
| updateTime | STRING | 1690084574843 | Update Timestamp |
| isWorking | BOOLEAN | TRUE | Not used |
| reqAmount | STRING | 0 | Requested cash amount |
| ordCxlReason | STRING | Order cancel reason | |
| stpMode | STRING | EXPIRE_MAKER | Self Trade Prevention Mode. |
Get Sub Account Trade Orders
GET /api/v1/spot/subAccount/tradeOrders
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| subAccountId | STRING | Y | 1650801631044854016 | Sub Account ID |
| fromOrderId | LONG | 1470930457684189696 | Order ID | |
| side | ENUM | BUY or SELL |
||
| symbol | STRING | BTCUSD | Currency Pair | |
| startTime | LONG | Start Timestamp, Only supports the last 90 days timeframe | ||
| endTime | LONG | End Timestamp | ||
| limit | INT | 500 | Default 500, Maximum 500 | |
| timestamp | LONG | Y | 1712317312973 | Timestamp |
Response Content
[
{
"accountId": "1695624199270418688",
"exchangeId": "301",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"clientOrderId": "1766585741726331",
"orderId": "2112668758317278720",
"price": "0",
"origQty": "0.1",
"executedQty": "0.1",
"cummulativeQuoteQty": "11292.24",
"cumulativeQuoteQty": "11292.24",
"avgPrice": "112922.4",
"status": "FILLED",
"timeInForce": "IOC",
"type": "MARKET",
"side": "SELL",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": "1766585741737",
"updateTime": "1766585741758",
"isWorking": true,
"reqAmount": "0",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | Query result array | |
| accountId | STRING | 1471090223379184384 | Account number |
| exchangeId | STRING | 301 | Exchange Number |
| symbol | STRING | BTCUSD | Trading pair |
| symbolName | STRING | BTCUSD | Trading pair name |
| clientOrderId | STRING | 123456 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| orderId | STRING | 1470930457684189696 | System generated order ID |
| price | STRING (decimal) | 28000 | Price |
| origQty | STRING (decimal) | 0.01 | Quantity |
| executedQty | STRING (decimal) | 0 | Traded volume |
| cumulativeQuoteQty | STRING (decimal) | 0 | Cumulative volume |
| avgPrice | STRING (decimal) | 0 | Average traded price |
| status | STRING | NEW | Order status |
| timeInForce | STRING | GTC | Duration of the order before expiring |
| type | STRING | LIMIT | Order Type |
| side | STRING | BUY | BUY or SELL |
| stopPrice | STRING (decimal) | 0.0 | Not used |
| icebergQty | STRING (decimal) | 0.0 | Not used |
| time | STRING | 1690084574839 | Current Timestamp |
| updateTime | STRING | 1690084574843 | Update Timestamp |
| isWorking | BOOLEAN | TRUE | Not used |
| reqAmount | STRING | 0 | Requested cash amount |
| ordCxlReason | STRING | Order cancel reason | |
| stpMode | STRING | EXPIRE_MAKER | Self Trade Prevention Mode. |
Get Sub Account Trades
GET /api/v1/subAccount/trades
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req 'd | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | Trading pair | |
| subAccountId | STRING | Sub Account ID | |
| startTime | LONG | Start Timestamp, Only supports the last 30 days timeframe | |
| endTime | LONG | End Timestamp | |
| clientOrderId | STRING | Client Order ID | |
| fromId | LONG | Starting ID | |
| toId | LONG | End ID | |
| limit | INT | Limit of record. Default 500, Max 1000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"id": "2112668759961445888",
"clientOrderId": "1766585741726331",
"ticketId": "4636458456207560707",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"orderId": "2112668758317278720",
"matchOrderId": "0",
"price": "112922.4",
"qty": "0.02157",
"commission": "3.653604252",
"commissionAsset": "USDT",
"time": "1766585741758",
"isBuyer": false,
"isMaker": false,
"fee": {
"feeCoinId": "USDT",
"feeCoinName": "USDT",
"fee": "3.653604252",
"originCoinId": "USDT",
"originCoinName": "USDT",
"originFee": "3.653604252"
},
"feeCoinId": "USDT",
"feeAmount": "3.653604252",
"makerRebate": "0",
"hskDeduct": false,
"hskDeductPrice": ""
},
{
"id": "2112668759617512960",
"clientOrderId": "1766585741726331",
"ticketId": "4636458456207560706",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"orderId": "2112668758317278720",
"matchOrderId": "0",
"price": "112922.4",
"qty": "0.035",
"commission": "5.928426",
"commissionAsset": "USDT",
"time": "1766585741758",
"isBuyer": false,
"isMaker": false,
"fee": {
"feeCoinId": "USDT",
"feeCoinName": "USDT",
"fee": "5.928426",
"originCoinId": "USDT",
"originCoinName": "USDT",
"originFee": "5.928426"
},
"feeCoinId": "USDT",
"feeAmount": "5.928426",
"makerRebate": "0",
"hskDeduct": false,
"hskDeductPrice": ""
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | Check transaction results | |
| id | STRING | 1470930841345474561 | Unique transaction ID (This value is the trade_id in v0 API) |
| clientOrderId | STRING | 999999999800021 | An ID defined by the client for the order, it will be automatically generated if it is not sent in the request |
| ticketId | STRING | 1478144171272585249 | Execution ID, the execution ID is the same for the direction of a single trade. |
| symbol | STRING | BTCUSD | Trading pair |
| symbolName | STRING | BTCUSD | Trading pair name |
| orderId | STRING | 1470930841211329280 | Order ID |
| matchOrderId | STRING | 1470930605684362240 | //Ignore |
| price | STRING (decimal) | 29851.03 | Price |
| qty | STRING (decimal) | 0.0005 | Quantity |
| commission | STRING (decimal) | 0.02985103 | Commission fee |
| commissionAsset | STRING | USD | Currency of commission fee |
| time | STRING (decimal) | 1690084620567 | Millisecond Timestamp |
| isBuyer | BOOLEAN | false | Whether the trade is a buyer |
| isMaker | BOOLEAN | false | Whether the trade is a maker |
| fee | Object | Fee information | |
| fee.feeCoinId | STRING | USD | Currency ID for fees |
| fee.feeCoinName | STRING | USD | Fee currency name |
| fee.fee | STRING (decimal) | 0.02985103 | Transaction fee amount |
| fee.originFee | STRING (decimal) | 0.03085103 | The commission fee before HSK deduction. |
| fee.originCoinId | STRING | USD | The commission fee before HSK deduction |
| fee.originCoinName | STRING | USD | The commission fee coin |
| feeCoinId | STRING | USD | Fee currency |
| feeAmount | STRING (decimal) | 0.02985103 | Amount of transaction fee |
| makerRebate | STRING | 0 | Return |
| hskDeduct | BOOLEAN | true | true: successfully deducted HSK false |
| hskDeductPrice | STRING | 0.001 | commission Coin price / HSK price |
Wallet
๐ To find out the chainType for Deposit and Withdrawal endpoint, please refer to the "Network" field in Deposit and Withdrawal fee tab:
https://global.hashkey.com/support-fee
Get Deposit Address
GET /api/v1/account/deposit/address
Retrieve deposit address generated by the system
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req 'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| coin | STRING | Y | USDT | Coin name |
| chainType | ENUM | Y | ETH | Chain Type, refer to Get-ChainType |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
{
"canDeposit": true,
"address": "0xD6bF65d473BFd760E20c7e120E9A4108a912D7c3",
"addressExt": "",
"minQuantity": "0.001",
"needAddressTag": false,
"requiredConfirmTimes": 10,
"canWithdrawConfirmTimes": 10,
"coinType": "ERC20_TOKEN"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| canDeposit | BOOLEAN | true | Can be deposited |
| address | STRING | 0x7c07adb0D2DE76241b262595860b16Cf90615aa0 | Deposit Address |
| addressExt | STRING | Tag (Not in use) | |
| minQuantity | STRING | 0.001 | Minimum Amount to be deposited |
| needAddressTag | BOOLEAN | false | Is address tag required (Not in use) |
| requiredConfirmTimes | INTEGER | 64 | Credit to account block confirmation (Reference only) |
| canWithdrawConfirmTimes | INTEGER | 64 | Withdrawal block confirmation (Reference only) |
| coinType | STRING | CHAIN_TOKEN | Coin Type |
Get Deposit History
GET /api/v1/account/depositOrders
Deposit Status
| Deposit Type | Description |
|---|---|
| 1 | Pending address authentication ๅพ ๅฐๅ่ฎค่ฏ |
| 2 | Under review ๅฎกๆ ธไธญ |
| 3 | Deposit failed ๅ ๅผๅคฑ่ดฅ |
| 4 | Deposit successful ๅ ๅผๆๅ |
| 5 | Refund ้ๅธ |
| 6 | Refund completed ้ๅธๅฎๆ |
| 7 | Refund failed ้ๅธๅคฑ่ดฅ |
| 8 | In the account ไธ่ดฆไธญ |
| 9 | The first address verification of personal recharge fails |
| 10 | Internal Failed (rarely happen) ๅ ้จ้่ฏฏ๏ผๆไฝๆฆ็๏ผ |
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req 'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| coin | STRING | ETH_USDT | Chain_Coin | |
| startTime | LONG | 16500121212121 | Start timestamp | |
| endTime | LONG | 16600131311313 | End timestamp | |
| limit | INTEGER | 500 | Default 500; Max 1000 | |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"time": "1753238871066",
"coin": "BTC",
"coinName": "BTC",
"address": "btctestsuc",
"quantity": "5.00000000000000000000",
"status": 1,
"statusCode": "1",
"txId": "ad504e3af44ec5e3d4af6a4c158c50cf5fdffe9006e4f8d7f00773378a5dea28"
},
{
"time": "1753238870846",
"coin": "BTC",
"coinName": "BTC",
"address": "btctestsuc",
"quantity": "5.00000000000000000000",
"status": 1,
"statusCode": "1",
"txId": "640f63f1ad52c3aef7e43b0afcf2cdb2a844d04ef03d7632821031e832558a61"
},
{
"time": "1727574827745",
"coin": "ETH",
"coinName": "ETH",
"address": "0xD655029B870b4689606a1C43CADb2300C0a016B1",
"quantity": "0.02227914313347269000",
"status": 10,
"statusCode": "10",
"txId": "0x8a895bc0b5cb55b91052f38d0b0afa7697612c94056670ae004a4ce34a0d2d04"
},
{
"time": "1727486851608",
"coin": "USDT",
"coinName": "USDT",
"address": "0xf1102fb9c9B5428b3174df9E0345c3f934bee208",
"quantity": "22.00000000000000000000",
"status": 1,
"statusCode": "1",
"txId": "0x28dc84ebadb2c0f77677ab266fa6f6ac0e96ba1fbaadc2cb0dfad8202b191b56"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1691048298420 | Deposit order created Timestamp |
| coin | STRING | ETH | Coin |
| coinName | STRING | ETH | Coin name |
| address | STRING | 0xa0D6AD420C440de473980117877DEC0a89DAFbeF | Deposit address |
| quantity | STRING (decimal) | 0.05000000000000000000 | Deposit amount |
| status | ENUM | 4 | Deposit status |
| statusCode | STRING | 4 | Same as status |
| txId | STRING | 0xbd40b38543767a7d441c87c676ddfaf6cf750e4c7d8d66abd0f1665eb031932a | On-chain transaction ID |
Authenticate Deposit Address
POST /api/v1/account/authAddress
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req 'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| txid | STRING | Y | 0xbd40b38543767a7d441c87c676ddfaf6cf750e4c7d8d66abd0f1665eb031932a | On-chain transaction ID |
| senderLastName | STRING | ZHANG | Either institutionalName must be provided, or both senderFirstName and senderLastName are required. |
|
| senderFirstName | STRING | SHEN | Either institutionalName must be provided, or both senderFirstName and senderLastName are required. |
|
| institutionalName | STRING | Either institutionalName must be provided, or both senderFirstName and senderLastName are required. |
||
| exchangeName | STRING | Y | Binance, OKX, Coinbase, Bybit, Kraken | The name of the whitelisted exchange you will be depositing |
| isAddressOwner | BOOLEAN | Y | true | Self declaration that you are the owner of the address by sending "true" |
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
{
"success": true,
"msg": "",
"timestamp": "1766633944895"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| success | BOOLEAN | true | Whether message sent successfully |
| msg | STRING | ||
| timestamp | STRING | 1699943911155 | Message sent time |
Withdraw VA
POST /api/v1/account/withdraw
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req 'd | Example Values | DESCRIPTION |
|---|---|---|---|---|
| coin | STRING | Y | USDT | Assets |
| clientOrderId | STRING | Y | w12912 | Custom Withdrawal ID |
| address | STRING | Y | 0x132346ef629483974879a2e68A3557cA1c494D2E | Withdrawal address |
| addressExt | STRING | (Not in use currently) | Tag (Not in use currently) | |
| platform | STRING | Refer to Platform Supported. | Platform name | |
| quantity | DECIMAL | Y | 0.2 | Withdrawal amount |
| chainType | STRING | Y | ETH | Chain Type, refer to Get-ChainType |
| timestamp | LONG | Y | 1712317312973 | Timestamp |
| memo | STRING | 123456 | Memo required for some coin and network when withdraw. Only supports letters and numbers. Maximum of 20 characters. |
Platform Supported
Not case sensitive, doesn't matter if it's uppercase or lowercase
| Platform Supported | "platform" parameter enum |
|---|---|
| Binance | "BINANCE" |
| OKX | "OKX" |
| Bitget (Individual Investor Only) | "BITGET" |
| Bybit (Individual Investor Only) | "BYBIT" |
Response Content
{
"success": true,
"id": "0",
"orderId": "W792076358865207296",
"accountId": "1649292498437183235"
}
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| success | BOOELEAN | true | Error code |
| id | STRING | 0 | ID |
| orderId | STRING | W476435800487079936 | Order ID |
| accountId | STRING | 1649292498437183235 | Account Id |
Get Withdraw History
GET /api/v1/account/withdrawOrders
Retrieve withdrawal history
Weight: 5
Request Parameters
| PARAMETER | TYPE | Req 'd | Example Values | DESCRIPTION |
|---|---|---|---|---|
| coin | STRING | USDT | Coin | |
| startTime | LONG | 1691142675492 | Start Time | |
| endTime | LONG | 1691142679567 | End Time | |
| remark | STRING | Remark | ||
| limit | INTEGER | 10 | Default 500, Max 1000 | |
| timestamp | LONG | Y | 1712317312973 | Timestamp |
| memo | STRING | 123456 | Memo required for some coins and networks when withdraw. Only supports letters and numbers. Maximum of 20 characters. |
Response Content
[
{
"time": "1766653720032",
"id": "W792076358865207296",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"address": "0x05aad35f83e62b6323f55ea41efcfdd2f97bd505",
"quantity": "10.00000000",
"arriveQuantity": "",
"status": "withdrawing",
"txId": "",
"addressUrl": "0x05aad35f83e62b6323f55ea41efcfdd2f97bd505",
"feeCoinId": "USDT",
"feeCoinName": "USDT",
"fee": "0.00000000",
"remark": "",
"platform": "",
"memo": ""
}
]
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | Query result list | |
| time | STRING | 1691053667700 | Timestamp |
| id | STRING | W474986756938121216 | Withdrawal order ID |
| coin | STRING | ETH | Coin |
| coinId | STRING | ETH | Coin ID |
| coinName | STRING | ETH | Coin Name |
| address | STRING | 0xa0d6ad420c440de473980117877dec0a89dafbef | Withdrawal Address |
| quantity | STRING (decimal) | 0.05000000 | Withdrawal amount entered by the user |
| arriveQuantity | STRING (decimal) | 0.05000000 | Net amount received |
| status | STRING | successful | Status: failed withdrawing under_review successful canceled canceling |
| txId | STRING | 0x448345d7d95614e19ad2c499be451cdec8d9fa109889f4dab201e3e50f0a06b4 | Transaction ID |
| addressUrl | STRING | 0xa0d6ad420c440de473980117877dec0a89dafbef | Withdrawal address URL (Same as address) |
| feeCoinId | STRING | ETH | Fee Currency ID |
| feeCoinName | STRING | ETH | Fee Currency Name |
| fee | STRING | 0.00600000 | Handling fee |
| remark | STRING | Remark | |
| platform | STRING | Binance | Network name |
| memo | STRING | 123456 | Memo required for some coins and networks when withdrawal. Only supports letters and numbers. Maximum of 20 characters. |
Public Market Data
โ All market-related APIs do not require signature verification and can directly access production data.
Get Exchange Information
GET /api/v1/exchangeInfo
Retrieve current exchange trading rules and symbol information
Types of trading restrictions
| Types | Description |
|---|---|
| PRICE_FILTER | Price limit |
| LOT_SIZE | Limit on the number of transactions |
| MIN_NOTIONAL | Minimum nominal limit |
| TRADE_AMOUNT | Transaction limit |
| LIMIT_TRADING | Limit trading rules |
| MARKET_TRADING | Market trading rules |
| OPEN_QUOTE | Opening Restrictions |
Trading pair status
| Status | Description |
|---|---|
| IN_PREVIEW | Under preview |
| TRADING | Continuous trading |
| HALT | Trading suspended |
| RESUMING | Resuming from Halt |
Request Parameters
| PARAMETER | TYPE | Req 'd | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | C | Symbol Name. e.g: "BTCUSDT", "ETHUSDT" |
| site | STRING | Default value is BMU (Bermuda Exchange) Supported site: BMU, UAE |
Response Content
{
"symbol": "USDTAED",
"symbolName": "USDTAED",
"status": "TRADING",
"baseAsset": "USDT",
"baseAssetName": "USDT",
"baseAssetPrecision": "0.01",
"baseUcid": "825",
"quoteAsset": "AED",
"quoteAssetName": "AED",
"quotePrecision": "0.00001",
"quoteUcid": "",
"retailAllowed": true,
"piAllowed": true,
"corporateAllowed": true,
"omnibusAllowed": true,
"icebergAllowed": false,
"isAggregate": false,
"allowMargin": false,
"filters": [
{
"minPrice": "0.001",
"maxPrice": "100000.00000000",
"tickSize": "0.001",
"filterType": "PRICE_FILTER"
},
{
"minQty": "0.3",
"maxQty": "200000",
"stepSize": "0.01",
"marketOrderMinQty": "0.3",
"marketOrderMaxQty": "100000",
"filterType": "LOT_SIZE"
},
{
"minNotional": "1",
"filterType": "MIN_NOTIONAL"
},
{
"minAmount": "1",
"maxAmount": "733320",
"minBuyPrice": "0",
"marketOrderMinAmount": "1",
"marketOrderMaxAmount": "366660",
"filterType": "TRADE_AMOUNT"
},
{
"maxSellPrice": "0",
"buyPriceUpRate": "0.1",
"sellPriceDownRate": "0.1",
"maxEntrustNum": 300,
"filterType": "LIMIT_TRADING"
},
{
"buyPriceUpRate": "0.1",
"sellPriceDownRate": "0.1",
"filterType": "MARKET_TRADING"
},
{
"noAllowMarketStartTime": "0",
"noAllowMarketEndTime": "0",
"limitOrderStartTime": "0",
"limitOrderEndTime": "0",
"limitMinPrice": "0",
"limitMaxPrice": "0",
"filterType": "OPEN_QUOTE"
}
],
"site": "UAE"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| timezone | STRING | UTC | Time zone |
| serverTime | INTEGER | 1690084771517 | Server Millisecond Timestamp |
| symbols | Object Array | Currency pair description | |
| symbols.symbol | STRING | BTCUSD | Currency pair |
| symbols.symbolName | STRING | BTCUSD | Currency pair |
| symbols.status | ENUM | TRADING | Trading pair status |
| symbols.baseAsset | STRING | BTC | Base Asset |
| symbols.baseAssetName | STRING | BTC | Name of base asset |
| symbols.baseAssetPrecision | STRING | 0.00001 | Precision of base asset |
| symbols.quoteAsset | STRING | USD | Quoted Asset |
| symbols.quoteAssetName | STRING | USD | Name of quoted asset |
| symbols.quotePrecision | STRING | 0.00000001 | Precision of quoted asset |
| symbols.retailAllowed | BOOLEAN | false | Whether retail client is allowed |
| symbols.piAllowed | BOOLEAN | false | Whether PI client is allowed |
| symbols.corporateAllowed | BOOLEAN | false | Whether Corporate client is allowed |
| symbols.omnibusAllowed | BOOLEAN | true | Whether Omnibus client is allowed |
| symbols.icebergAllowed | BOOLEAN | false | Currently not in use |
| symbols.isAggregate | BOOLEAN | false | Currently not in use |
| symbols.allowMargin | BOOLEAN | false | Currently not in use |
| symbols.filters | Object Array | List of trading pair restrictions | |
| symbols.filters.filterType=PRICE_FILTER | STRING | PRICE_FILTER | Trading restriction type refer to appendix "Trading restriction type" |
| symbols.filters.minPrice | STRING | 0.01 | Depreciated, no longer in-use |
| symbols.filters.maxPrice | STRING | 100000.00000000 | Depreciated, no longer in-use |
| symbols.filters.tickSize | STRING | 0.01 | Minimum price change, only for PRICE_FILTER types |
| symbols.filters.filterType=LOT_SIZE | STRING | LOT_SIZE | Trading restriction type |
| symbols.filters.minQty | STRING | 0.0003 | Minimum number of transactions, only for LOT_SIZE types / ๆๅฐไบคๆ้ |
| symbols.filters.maxQty | STRING | 4 | Maximum number of transactions, only for LOT_SIZE types / ๆๅคงไบคๆ้ |
| symbols.filters.stepSize | STRING | 0.00001 | Minimal change in quantity, only used for LOT_SIZE types |
| symbols.filters.marketOrderMinQty | STRING | 1 | Minimum no. of coin for base Asset allowed for Market Order |
| symbols.filters.marketOrderMaxQty | STRING | 10000 | Maximum no. of coin for base Asset allowed Market Orders |
| symbols.filters.filterType=MIN_NOTIONAL | STRING | MIN_NOTIONAL | |
| symbols.filters.minNotional | STRING | 10 | Minimum notional turnover, only for MIN_NOTIONAL types |
| symbols.filters.filterType=TRAD_AMOUNT | STRING | TRADE_AMOUNT | Trading restriction type |
| symbols.filters.minAmount | STRING | 10 | Minimum turnover, only for TRADE_AMOUNT types |
| symbols.filters.maxAmount | STRING | 100000 | Maximum turnover, only for TRADE_AMOUNT types |
| symbols.filters.minBuyPrice | STRING | 0 | Depreciated, no longer in-use |
| symbols.filters.marketOrderMinAmount | STRING | 10 | Minimum cash notional required for Market order / ๅธไปทๅๆๅฐไธๅ้้ข |
| symbols.filters.marketOrderMaxAmount | STRING | 200000 | Maximum cash notional allowed for Market order / ๅธไปทๅๆๅคงไธๅ้้ข |
| symbols.filters.filterType=LIMIT_TRADING | STRING | ||
| symbols.filters.maxSellPrice | STRING | 0 | Depreciated, no longer in-use |
| symbols.filters.buyPriceUpRate ("filterType": "LIMIT_TRADING") | STRING | 0.2 | Limit Buy cannot be higher than the mark price / ไนฐๅ ฅไธ่ฝ้ซไบๆ ่ฎฐไปทๆ ผ |
| symbols.filters.sellPriceDownRate ("filterType": "LIMIT_TRADING") | STRING | 0.2 | Limit Sell cannot be lower than the mark price / ๅๅบไธ่ฝไฝไบๆ ่ฎฐไปทๆ ผ |
| symbols.filters.filterType=MARKET_TRADING | STRING | ||
| symbols.filters.buyPriceUpRate ("filterType": "MARKET_TRADING") | STRING | 0.2 | Market buy cannot be higher than the mark price / ไนฐๅ ฅไธ่ฝ้ซไบๆ ่ฎฐไปทๆ ผ |
| symbols.filters.sellPriceDownRate ("filterType": "MARKET_TRADING") | STRING | 0.2 | Market sell cannot be lower than the mark price / ๅๅบไธ่ฝไฝไบๆ ่ฎฐไปทๆ ผ |
| symbols.filters.filterType=OPEN_QUOTE | STRING | ||
| symbols.filters.noAllowMarketStartTime | STRING | 1668483032058 | Market order start time is not allowed, only for OPEN_QUOTE types |
| symbols.filters.noAllowMarketEndTime | STRING | 1668483032058 | Market order end time is not allowed, only for OPEN_QUOTE types |
| symbols.filters.limitOrderStartTime | STRING | 1668483032058 | Time limit order start time, only for OPEN_QUOTE types |
| symbols.filters.limitOrderEndTime | STRING | 1668483032058 | Time limit order end time, only for OPEN_QUOTE types |
| symbols.filters.limitMinPrice | STRING | 0.1 | Lowest price for a limited time limit order, only for OPEN_QUOTE types |
| symbols.filters.limitMaxPrice | STRING | 1000 | Limit order maximum price, only for OPEN_QUOTE types |
| symbols.tradeStatus | STRING | TRADABLE | Trade Status |
| coins | Object Array | Coin description | |
| coins.orgId | STRING (INTEGER) | 9000 | Institution ID |
| coins.coinId | STRING | BTC | Coin ID |
| coins.coinName | STRING | BTC | Coin name |
| coins.coinFullName | STRING | Bitcoin | Coin full name |
| coins.allowWithdraw | BOOLEAN | true | Whether to allow withdrawal |
| coins.allowDeposit | BOOLEAN | true | Whether to allow deposit |
| coins.tokenType | STRING | ERC20_TOKEN | CHAIN_TOKEN |
| coins.status | INTEGER | 1 | Coin status |
| coins.chainTypes | Object Array | Chain information list | |
| coins.chainTypes.chainType | STRING | BTC | Chain Type |
| coins.chainTypes.withdrawFee | STRING | 0 | Withdrawal fee |
| coins.chainTypes.minWithdrawQuantity | STRING | 0.0001 | Minimum withdrawal amount |
| coins.chainTypes.maxWIthdrawQuantity | STRING | 100 | Maximum withdrawal amount |
| coins.chainTypes.minDepositQuantity | STRING | 0.0002 | Minimum deposit quantity |
| coins.chainTypes.allowDeposit | BOOLEAN | true | Whether to allow deposit |
| coins.chainTypes.allowWithdraw | BOOLEAN | true | Whether to allow withdrawal |
| brokerFilters | Object Array | Not currently in use | |
| contracts | Object Array | Not currently in use | |
| options | Object Array | Not currently in use | |
| site | STRING | BMU | Site |
Get Order book
GET /quote/v1/depth
Retrieve the current order book depth
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSD | Currency pair |
| limit | INTEGER | C | 200 | The number of layers for each direction. Maximum value is 200. Default is 100. |
Response Content
{
"t": 1764059245287,
"b": [
[
"87473.15",
"0.05805"
],
[
"87473.14",
"0.01143"
]
],
"a": [
[
"87474.35",
"0.00114"
],
[
"87476.61",
"0.00045"
]
]
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| t | LONG | 1764059245287 | Timestamp |
| b | Array of Arrays | Buying direction | |
| 1st element | STRING | 29830.76 | Bid price |
| 2nd element | STRING | 0.0005 | Bid quantity |
| ... | |||
| a | Array of Arrays | Selling direction | |
| 1st element | STRING | 29938.49 | Ask price |
| 2nd element | STRING | 0.0005 | Ask quantity |
| ... |
Get Recent Trade List
GET /quote/v1/trades
Retrieve the recent trade information
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSD | Currency pair |
| limit | INTEGER | C | 100 | The number of trades. Maximum value is 100. Default is 100. |
Response Content
[
{
"t": 1764059593000,
"p": "87371.47",
"q": "0.02",
"ibm": false
},
{
"t": 1764059593105,
"p": "87371.47",
"q": "0.16",
"ibm": false
},
{
"t": 1764059594244,
"p": "87380.06",
"q": "0.01",
"ibm": false
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | Latest trades list | |
| t | LONG | 1764059594244 | Traded timestamp |
| p | STRING | 87380.06 | Traded price |
| q | STRING | 0.01 | Volume |
| ibm | BOOLEAN | true | true: buyer's maker order false: seller's maker order |
Get Kline
GET /quote/v1/klines
K-line/candlestick chart interval
m โ minutes; h โ hours; d โ days; w โ weeks; M โ months
- 1m
- 3m
- 5m
- 15m
- 30m
- 1h
- 2h
- 4h
- 6h
- 8h
- 12h
- 1d
- 1w
- 1M
Request Parameters
| PARAMETER | TYPE | Req 'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT | Currency pair |
| interval | ENUM | Y | 1m | Time interval |
| limit | INTEGER | 10 | Return the number of bars, the maximum value is 1000 | |
| startTime | INTEGER | 1478692862000 | Start Time | |
| endTime | INTEGER | 1478696782000 | End Time |
Response Content
[
[
1766718300000,
"89037.52",
"89037.52",
"89037.52",
"89037.52",
"0",
0,
"0",
0,
"0",
"0"
],
[
1766718360000,
"89037.52",
"89037.52",
"89037.52",
"89037.52",
"0",
0,
"0",
0,
"0",
"0"
],
[
1766718420000,
"89101.5",
"89101.5",
"89101.5",
"89101.5",
"0.00012",
0,
"10.69218",
1,
"0.00012",
"10.69218"
]
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| - | Array of Arrays | Kline information list | |
| (kline_open_time) | LONG | 1764060600000 | Opening timestamp |
| (open_price) | STRING | 29871.34 | Open Price |
| (high_price) | STRING | 29871.34 | High Price |
| (low_price) | STRING | 29773.82 | Low Price |
| (close_price) | STRING | 29863.45 | Close Price |
| (volume) | STRING | 0.00602 | Trading volume |
| (kline_close_time) | INTEGER | 0 | Closing timestamp |
| (quote_asset_volume) | STRING | 179.5946714 | Quote Asset Volume |
| (number_of_trades) | INTEGER | 14 | Number of Trades |
| (taker_buy_base_asset_volume) | STRING | 0.004 | Taker buy base asset volume |
| (taker_buy_quote_asset_volume) | STRING | 119.41295 | Taker buy quote asset volume |
Get 24hr Ticker Price Change
GET /quote/v1/ticker/24hr
Retrieve the 24 hours rolling price change
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | ETHUSD | Currency pair | |
| instType | STRING | SPOT | SPOT: Default ValueFUTURES: FUTURES Trading Pairs onlyANY: all instrument types |
Response Content
[
{
"t": 1766718180001,
"s": "BTCUSDT-PERPETUAL",
"c": "89164.2",
"h": "89323.6",
"l": "86850.6",
"o": "87828.6",
"b": "89056.6",
"a": "89056.7",
"v": "823",
"qv": "72224.7966",
"it": "FUTURES"
}
]
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | 24hrs price change list | |
| t | LONG | 1764061080001 | Millisecond timeStamp |
| s | STRING | BTCUSD | Symbol |
| c | STRING | 29832.76 | Latest traded price |
| h | STRING | 30050.21 | Highest price |
| l | STRING | 29568.84 | Lowest price |
| o | STRING | 29845.03 | Opening price |
| b | STRING | 29830.76 | Highest bid |
| a | STRING | 29938.49 | Highest selling price |
| v | STRING | 2.09774 | Total trade volume (in base asset) |
| qv | STRING | 62639.2417592 | Total trade volume (in quote asset) |
| it | STRING | SPOT | SPOTใFUTURESใANY |
Get Symbol Price Ticker
GET /quote/v1/ticker/price
Retrieve the latest price by ticker
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | ETHUSD | Currency pair |
Response Content
[
{
"s": "USDTUSD",
"p": "0.9992"
}
]
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | Latest transaction price | |
| s | STRING | BTCUSD | Symbol |
| p | STRING | 87037.97 | Latest traded price |
Get Symbol current Top of book
GET /quote/v1/ticker/bookTicker
Retrieve current top order book by symbol
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSD | Currency pair |
Response Content
[
{
"s": "BTCUSDT",
"b": "89110.8",
"bq": "0.00067",
"a": "89110.81",
"aq": "0.00067",
"t": 1766718404772
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | Retrieve current top order book by symbol | |
| s | STRING | BTCUSD | Symbol |
| b | STRING | 86953.92 | Top of book Bid Price |
| bq | STRING | 1.01969 | Top of book Bid Quantity |
| a | STRING | 86953.93 | Top of book Ask Price |
| aq | STRING | 0.07897 | Top of book Ask Quantity |
| t | LONG | 1764061843241 | Timestamp |
Get Merge Depth
GET /quote/v1/depth/merged
Query aggregation market depth
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | BTCUSD | Currency pair |
| limit | INTEGER | 10 | The number of layers for each direction. Maximum value is 200. Default is 100. | |
| scale | INTEGER | 1 | Level of layers 0,1,2,3,4,5. E.g. 0 represents 1 layer, 1 represents 2 layers |
Response Content
{
"t": 1766718663907,
"b": [
[
"89210.22",
"0.00067"
],
[
"89194.19",
"0.1"
],
[
"89194.02",
"0.00748"
]
],
"a": [
[
"89210.32",
"0.00067"
],
[
"89269.69",
"0.12333"
],
[
"89294.11",
"0.1"
]
]
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| t | LONG | 1764059245287 | Timestamp |
| b | Array of Arrays | Buying direction | |
| 1st element | STRING | 29830.76 | Bid price |
| 2nd element | STRING | 0.0005 | Bid quantity |
| ... | |||
| a | Array of Arrays | Selling direction | |
| 1st element | STRING | 29938.49 | Ask price |
| 2nd element | STRING | 0.0005 | Ask quantity |
| ... |
Miscellaneous
Test Connectivity
GET /api/v1/ping
Test connectivity to ensure valid Status 200 OK
Weight: 1
Request Parameters
Empty
Response Content
{}
{}
Check Server Time
GET /api/v1/time
Test the connection and returns the current server time (in UNIX timestamp in milliseconds)
Weight: 1
Request Parameters
Empty
Response Content
{
"serverTime": 1764229341307
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| serverTime | LONG | 1764229341307 | Server Millisecond Timestamp |
Create Listen Key
POST /api/v1/userDataStream
Create a single Listen Key. Valid for 60 minutes.
Reminder
- Start a new user data stream.
- The stream will close after 60 minutes unless a keepalive is sent.
- Recommended to send a reset request every 30 minutes. Reset-Listen-Key
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req 'd | DESCRIPTION |
|---|---|---|---|
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
{
"listenKey": "MKxPTRoLXBBhlRseAUaDyWyZVjiNxCVqcaUasZidmByckGjUcLBKKcopKbvUfORD"
}
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| listenKey | STRING | MKxPTRoLXBBhlRseAUaDyWyZVjiNxCVqcaUasZidmByckGjUcLBKKcopKbvUfORD | Key to subscribe websocket feeds |
Reset Listen Key
PUT /api/v1/userDataStream
Reset validity time of a listenKey to 60 minutes.
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req 'd | DESCRIPTION |
|---|---|---|---|
| listenKey | STRING | Y | Key to reset |
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
{}
{}
Delete Listen Key
DELETE /api/v1/userDataStream
Delete a single Listen Key.
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req 'd | DESCRIPTION |
|---|---|---|---|
| listenKey | STRING | Y | Key to delete |
| recvWindow | LONG | Recv Window. Default 5000 | |
| timestamp | LONG | Y | Timestamp |
Response Content
{}
{}
Error Codes
List of error codes
| ERROR CODE | HTTP Status Code | ERROR MESSAGE | DESCRIPTION |
|---|---|---|---|
| 200 | 200 | Success request | |
| 0000 | 200 | success | Success request |
| 0001 | 400 | Required field %s missing or invalid |
Required field %s missing or invalid. E.g. Required field quantity missing or invalid |
| 0001 | 400 | Incorrect signature | The server is not able to valid your signature request. Please check your signature whether it have the correct signing. |
| 0003 | 400 | Rate limit exceeded | Rate limit exceed per configuration. Please manage the number of your request |
| 0102 | 400 | Invalid APIKey | There was an issue validating your API Key permission. Please check your API Key permission |
| 0103 | 400 | APIKey expired | API-key has expired. Please login to Account management console to renew the API key |
| 0104 | 400 | accountId is not allowed | The accountId defined is not permissible |
| 0201 | 400 | Instrument not found | The instrument defined cannot be located |
| 0202 | 400 | Invalid IP | Our server detected the IP addresses submitted for the API request does not match API key whitelisted IP address |
| 0206 | 400 | Unsupported order type | Invalid order type being sent to the server |
| 0207 | 400 | Invalid price | Invalid price being sent to the server |
| 0209 | 400 | Invalid price precision | The precision price is over the maximum allowed for this asset |
| 0210 | 400 | Price outside of allowed range | Price of the order below minPrice or exceeds maxPrice range. Please check exchangeInfo |
| 0211 | 400 | Order not found | Our server not able to locate the orderId defined |
| 0212 | 400 | Order has already been completed (filled, canceled, etc) or does not exist. Please check the order status to verify | Order has already been completed (filled, canceled, etc) or does not exist. Please check the order status to verify |
| 0401 | 400 | Insufficient asset | There is insufficient balance to submit the order |
| -1000 | 400 | An unknown error occurred while processing the request | An issue generated by our server |
| -1001 | 400 | Internal error | Unable to process your request. Please try again |
| -1002 | 400 | Unauthorized operation | Server is not able to validate your API Key. Please ensure you have the valid API Key to the corresponding environment |
| -1004 | 400 | Bad request | There was an issue with to process your request. Please check your parameters or values are valid |
| -1005 | 400 | No permission | It appears there is insufficient trading permission. Please check your permission |
| -1006 | 400 | Execution status unknown | An unexpected response was received from the message bus |
| -1007 | 400 | Timeout waiting for response from server | Timeout waiting for response from backend server. Send status unknown; execution status unknown |
| -1014 | 400 | Unsupported order combination | The order combination specified is not supported |
| -1015 | 400 | Too many new orders, current limit is %s orders per %s |
Reach the rate limit .Please slow down your request speed. Too many new orders. |
| -1020 | 400 | Unsupported operation | User operation is not supported |
| -1021 | 400 | Timestamp for this request is outside of the recvWindow | Timestamp for this request was 1000ms ahead of the server's time. Please check the difference between your local time and server time |
| -1024 | 400 | Duplicate request | Duplicate request received |
| -1101 | 400 | Feature has been offline | Feature has been offline, please check with API team for further details |
| -1115 | 400 | Invalid timeInForce | Invalid time in force being sent |
| -1117 | 400 | Invalid order side | Invalid side being sent |
| -1123 | 400 | Invalid client order id | Invalid client order ID being sent |
| -1124 | 400 | Invalid price | Invalid price being sent |
| -1126 | 400 | Invalid quantity | Invalid quantity being sent |
| -1129 | 400 | Invalid parameters, quantity and amount are not allowed to be sent at the same time. | The combination of quantity and amount is not allowed to be submitted at the same time |
| -1130 | 400 | Illegal parameter %s |
Invalid data sent for a parameter. E.g. "Illegal parameter 'symbol'" |
| -1132 | 400 | Order price greater than the maximum | Order price exceeds maxPrice. Check ExchangeInfo |
| -1133 | 400 | Order price lower than the minimum | Order price below the threshold minPrice. Check ExchangeInfo |
| -1135 | 400 | Order quantity greater than the maximum | Order quantity exceeds the maxQty. Check ExchangeInfo |
| -1136 | 400 | Order quantity lower than the minimum | Order quantity below threshold minQty. Check ExchangeInfo |
| -1137 | 400 | Order quantity precision too large | Order quantity precision is too large |
| -1139 | 400 | Order has been filled | Unable to fulfill request as order has been filled |
| -1140 | 400 | Order amount lower than the minimum | The transaction amount is below the threshold minAmount. Check ExchangeInfo |
| -1141 | 400 | Duplicate order | The server have detected an existing clientOrderId sent before |
| -1142 | 400 | Order has been cancelled | Unable to fulfill rquest as order has been canceled |
| -1143 | 400 | Order not found on order book | Unable to locate orderbook |
| -1144 | 400 | Order has been locked | Order has been locked |
| -1145 | 400 | Cancellation on this order type not supported | This order type does not support cancellation |
| -1146 | 400 | Order creation timeout | Not able to create the order and timed out |
| -1147 | 400 | Order cancellation timeout | Not able to cancel the order and timed out |
| -1148 | 400 | Order amount precision too large | Market Cash Amount precision is too long |
| -1149 | 400 | Order creation failed | Order creation failed |
| -1150 | 400 | Order cancellation failed | Order cancellation failed |
| -1151 | 400 | The trading pair is not open yet | The trading is not yet listed for trading |
| -1152 | 400 | User does not exist | Unable to find user |
| -1153 | 400 | Invalid price type | Invalid price type being sent |
| -1154 | 400 | Invalid position side | Invalid side being sent |
| -1155 | 400 | The trading pair is not available for api trading | API trading is suspended for API trading |
| -1156 | 400 | Limit maker order rejected: Improper price may cause immediate fill. | Creation of limit maker order failed as the order execute immediately.For HashKey Global only. |
| -1160 | 400 | Account does not exist | Account does not exist |
| -1161 | 400 | Balance transfer failed | Transfer internal funds failed |
| -1162 | 400 | Unsupport contract address | Contract address submitted is not valid |
| -1163 | 400 | Illegal withdrawal address | Withdraw address is not valid |
| -1164 | 400 | Withdraw failed | Withdraw failed, check if the withdrawal amount meets the minimum withdrawal amount |
| -1165 | 400 | Withdrawal amount cannot be null | Withdrawal amount needs to be more than 0 |
| -1166 | 400 | Withdrawal amount exceeds the daily limit | Withdrawal amount exceeded the daily limit allowed |
| -1167 | 400 | Withdrawal amount less than the minimum | Withdrawal amount less than the min withdraw amount limit |
| -1168 | 400 | Illegal withdrawal amount | Withdrawal amount characters are not valid |
| -1169 | 400 | Withdraw not allowed | Withdrawal is currently suspended |
| -1170 | 400 | Deposit not allowed | Deposit is currently suspended |
| -1171 | 400 | Withdrawal address not in whitelist | Withdrawal address has not yet been whitelisted |
| -1172 | 400 | Invalid from account id | The fromAccountId is invalid |
| -1173 | 400 | Invalid to account id | The toAccountId is invalid |
| -1174 | 400 | Transfer not allowed between the same account | The fromAccount should not be equal toAccount |
| -1175 | 400 | Invalid fiat deposit status | The fiat deposit status submitted is invalid |
| -1176 | 400 | Invalid fiat withdrawal status | The fiat withdrawal status submitted is invalid |
| -1177 | 400 | Invalid fiat order type | The fiat order type submitted is invalid |
| -1182 | 400 | The newly whitelisted withdrawal address will take effect in 30 min. Please try it later. | The newly whitelisted withdrawal address will take effect after a certain time period for the sake of safety. During the mean time, the address is not available |
| -1186 | 400 | Placing orders via api is not allowed, please check the API permission | Placing orders via api is not allowed, please check the API permission |
| -1193 | 400 | Order creation count exceeds the limit | Order count have exceeded the amount allowed |
| -1194 | 400 | Market order creation forbidden | Creation of market order is forbidden |
| -1200 | 400 | Order buy quantity too small | Buy limit quantity below the threshold minQty. Check ExchangeInfo |
| -1201 | 400 | Order buy quantity too large | Buy limit quantity exceeds maxQty. Check ExchangeInfo |
| -1202 | 400 | Order sell quantity too small | Sell limit quantity below the threshold minQty. Check ExchangeInfo |
| -1203 | 400 | Order sell quantity too large | Sell limit quantity exceeds the maxQty. Check ExchangeInfo |
| -1204 | 400 | From account must be a main account | Transfer fromAccountId needs to be a main account |
| -1205 | 400 | Account not authorized | Account is not authorised |
| -1206 | 400 | Order amount greater than the maximum | The transaction amount is below the threshold maxAmount. Check ExchangeInfo |
| -1207 | 400 | The status of deposit is invalid | The status of deposit submitted is invalid |
| -1208 | 400 | The orderType of fiat is invalid | The status of orderType is not valid |
| -1209 | 400 | The status of withdraw is invalid | The status of withdraw is not valid |
| -1210 | 400 | The deposit amount %s must not be less than the minimum deposit amount %s %s. |
The deposit amount %s must not be less than the minimum deposit amount %s %s. |
| -1211 | 400 | Withdrawal in progress | Withdrawal in progress |
| -1212 | 400 | The order of deposit does not exist | The order of deposit does not exist |
| -1213 | 400 | The status of deposit cannot apply refund | The status of deposit cannot apply refund |
| -1214 | 400 | The account of deposit does not exist | The account of deposit does not exist |
| -1215 | 400 | User account status is abnormal | User account status is abnormal |
| -1300 | 400 | Sorry we can not locate this depositOrderId, please check and try again. | Sorry we can not locate this depositOrderId, please check and try again. |
| -1301 | 400 | Please contact the support team for historical orders | Please contact the support team for historical orders |
| -1302 | 400 | The refund via api can not be processed due to order status, please contact support team | The refund via api can not be processed due to order status, please contact support team |
| -1303 | 400 | The refund request via api can not be processed due to failure reason, please contact support team | The refund request via api can not be processed due to failure reason, please contact support team |
| -1304 | 400 | Please upload supporting docs as required, only image files .jpg, .png, .jpeg allowed. | Please upload supporting docs as required, only image files .jpg, .png, .jpeg allowed. |
| -1305 | 400 | Image size exceeds 1M, please revise and try again | Image size exceeds 1M, please revise and try again |
| -2010 | 400 | Limit maker order rejected: Improper price may cause immediate fill. | New order request was rejected. Usually this is due to new LIMIT_MAKER order not able to be maker, our system will auto reject the order For HashKey Hong Kong only |
| -2011 | 400 | Order cancellation rejected | Cancel request was rejected |
| -2016 | 400 | API key creation exceeds the limit | The number of API key created have exceeded the limit |
| -2017 | 400 | Open orders exceeds the limit of the trading pair | The number of open orders have exceeded the limit for the trading pair |
| -2018 | 400 | Trade user creation exceeds the limit | The number of trade user created have exceeded the limit |
| -2019 | 400 | Trader and omnibus user not allowed to login app | The trader and omnibus user is not allowed to login to the app |
| -2020 | 400 | Not allowed to trade this trading pair | Not allowed to trade this trading pair |
| -2021 | 400 | Not allowed to trade this trading pair | Not allowed to trade this trading pair |
| -2022 | 400 | Order batch size exceeds the limit | The number of orders in batchOrders request exceeds its limit |
| -2023 | 400 | Need to pass KYC verification | Need to pass KYC verification in order to use API trading |
| -2024 | 400 | Fiat account does not exist | Fiat account ID defined does not exist |
| -2025 | 400 | Custody account not exist | Custody account ID defined does not exist |
| -2026 | 400 | Invalid type | The type defined is invalid |
| -2027 | 400 | Exceed maximum time range of 30 days | The startTime and endTime defined for Fund statement request exceeds the 30 days limit |
| -2028 | 400 | The search is limited to data within the last one month | The search is limited to data within the last one month |
| -2029 | 400 | The search is limited to data within the last three months | The search is limited to data within the last three months |
| -2030 | 400 | Order batch size exceeds the limit | Order batch size exceeds the limit |
| -3117 | 400 | Invalid permission | Invalid permission is detected. E.g. APIKey does not have the accountID permission to query the balance of the account |
| -3143 | 400 | Currently, your trading account has exceeded its limit and is temporarily unable to perform trades | The trading account have exceeds its limit capacity. We have temporarily suspended your trading |
| -3144 | 400 | Currently, your trading account has exceeded its limit and is temporarily unable to perform transfers | The trading account have exceeds its limit capacity. We have temporarily suspended your transfer |
| -3145 | 400 | Please DO NOT submit request too frequently | We have detected the rate of your API request have been submitted too frequently. Please manage your API request. |
| -4000 | 400 | Invalid bank account number | Invalid bank account number |
| -4001 | 400 | Invalid asset | The asset specified is invalid |
| -4002 | 400 | Withdrawal amount less than the minimum withdrawal amount | The withdrawal amount submitted is less than the minimum amount |
| -4003 | 400 | Insufficient Balance | There was insufficient balance for the asset you are trying to withdraw |
| -4004 | 400 | Invalid bank account number | The bank account has not been whitelisted yet |
| -4005 | 400 | Assets are not listed | Assets are not listed |
| -4006 | 400 | Kyc is not certified | The user has not passed KYC |
| -4007 | 400 | Withdrawal channels are not supported | The withdrawal channel is not yet supported via API |
| -4008 | 400 | This currency does not support this customer type | The currency is not supported for the client type |
| -4009 | 400 | No withdrawal permission | The API Key do not have withdrawal permission |
| -4010 | 400 | Withdrawals on the same day exceed the maximum limit for a single day | The withdrawal request exceeds the daily maximum limit |
| -4011 | 400 | System error | The system has an internal error. Please contact our API Team |
| -4012 | 400 | Parameter error | The parameter entered was invalid |
| -4013 | 400 | Withdraw repeatedly | The withdrawal has been submitted multiple times. Please wait and try again |
| -4014 | 400 | The type of whitelist is invalid | The type of whitelist is invalid |
| -4016 | 400 | twoFaToken missing. Please send valid twoFaToken as 2FA is enabled for this action | twoFaToken missing. Please send valid twoFaToken as 2FA is enabled for this action |
| -4017 | 400 | twoFaToken wrong, please send valid twoFaToken | twoFaToken wrong, please send valid twoFaToken |
| -4018 | 400 | twoFaToken used before. Please wait and try again later | twoFaToken used before. Please wait and try again later |
| -4019 | 400 | The withdraw exceeded the predefined maximum limit, and has been rejected | The withdraw exceeded the predefined maximum limit, and has been rejected |
| -4020 | 400 | The withdrawal happened during abnormal operation hours, and had been rejected | The withdrawal happened during abnormal operation hours, and had been rejected |
| -5000 | 400 | Duplicate IN-KIND subscription order | Duplicate IN-KIND subscription order |
| -5001 | 400 | Fund code is invalid | Fund code is invalid |
| -5002 | 400 | Deposit address does not exist | Deposit address does not exist |
| -5003 | 400 | Invalid address. Please verify | Invalid address. Please verify |
| -5004 | 400 | Signature verification failed because the address had been whitelisted by another account. | Signature verification failed because the address had been whitelisted by another account. |
| -5005 | 400 | Signature verification fails because client submits incorrect signature result. | Signature verification fails because client submits incorrect signature result. |
| -5006 | 400 | Signature verification failed because the address had been whitelisted before. | Signature verification failed because the address had been whitelisted before. |
| -5011 | 400 | No Subscription found. | No Subscription found. |
| -5012 | 400 | Unknown subscriptionId | Unknown subscriptionId |
| -5013 | 400 | Subscription failed. | Subscription failed. |
| -5021 | 400 | Only one of 'buyAmount' or 'sellAmount' must be specified. | Only one of 'buyAmount' or 'sellAmount' must be specified. |
| -5022 | 400 | quoteId expired. Please get a quote again. | quoteId expired. Please get a quote again. |
| -5023 | 400 | Insufficient Fund Position. | Insufficient Fund Position. |
| -5024 | 400 | The amount is below the minimum required: 100 USD or equivalent USD. | The amount is below the minimum required: 100 USD or equivalent USD. |
| -5025 | 400 | Exceed the maximum buy amount. | Exceed the maximum buy amount. |
| -5026 | 400 | Unsupported Quote Pair. | Unsupported Quote Pair. |
| -5027 | 400 | Invalid orderId: %s provided. |
Invalid orderId: %s provided. |
| -5030 | 400 | The Length of %s cannot exceed %s |
The Length of %s cannot exceed %s |
| -5031 | 400 | Unsupported quote pair | Unsupported quote pair |
| -5032 | 400 | Precision illegal | Precision illegal |
| -5033 | 400 | Precision illegal | Precision illegal |
| -5034 | 400 | Fail to generate the clientOrderId | Fail to generate the clientOrderId |
| -5035 | 400 | %s |
%s |
| -5036 | 400 | %s |
%s |
Cancel Reject Reasons
| Error Msg | Error Msg ZH | Memo |
|---|---|---|
| SYSTEM_CANCEL | ็ณป็ปๆคๅ(้ป่ฎค) | Default Error Message. Also include scenes: Solicited Cancellation by System or Operation Staff. ้ป่ฎค็ๆ็ป้่ฏฏๆๆกใไนๅ ๆฌ็ณป็ป่ชๅจๆง่ก็ๆ่ ่ฟ่ฅไบบๅๆง่ก็ๆคๅๆไฝใ |
| USER_CANCEL | ๅฎขๆท่ชไธปๆคๅ | The customer initiates the order cancellation actively. ๅฎขๆทไธปๅจๅ่ตท็ๆคๅ |
| RISKLIMIT_CANCEL | ้ฃๆงๆคๅ | Covers order cancellations caused by trading rule restrictions (such as changes in risk-preference levels, IOC order situations, liquidity protection, etc.) ๆถต็ไบคๆ่งๅ้ๅถ๏ผๅฆ้ฃ้ฉๅๅฅฝ็ญ็บงๅๅใIOC ่ฎขๅๆ ๅตใๆตๅจๆงไฟๆค็ญ๏ผๅฏผ่ด็ๆคๅ |
| BLOCKED_CANCEL | ่ดฆๆท็ฆ็จๆคๅ | Cancellation due to the account being disabled. ๅฝ่ดฆๆท่ขซ็ฆ็จๆถๆง่ก็ๆคๅๆไฝ |
| CLOSED_CANCEL | ไบคๆๆ้ญๅธๆคๅ | Cancellation when the exchange closes urgently. ไบคๆๆๅ ็ดงๆฅๆ ๅต้ญๅธๆถ่ฟ่ก็ๆคๅ |
| OFFLINE_CANCEL | ไบคๆๅฏนไธๆถๆคๅ | Cancellation when the trading pair is delisted. ไบคๆๅฏนไธๆถๆถ่ฟ่ก็ๆคๅๆไฝ |
| SELF_TRADE_CANCEL | ่ชๆไบคๆคๅ | Cancellation to avoid self-trade. ไธบ้ฟๅ ่ชๆไบค่่ฟ่ก็ๆคๅ |
WEBSOCKET API
Access URL
Python Public Stream Sample
import hashlib
import hmac
import json
import time
import websocket
import logging
import threading
########################################################################################################################
# Test Websocket API
# Copyright: Hashkey Trading 2023
########################################################################################################################
class WebSocketClient:
def __init__(self):
self._logger = logging.getLogger(__name__)
self._ws = None
self._ping_thread = None
def _on_message(self, ws, message):
self._logger.info(f"Received message: {message}")
data = json.loads(message)
if "pong" in data:
# Received a pong message from the server
self._logger.info("Received pong message")
# Handle the received market data here
def _on_error(self, ws, error):
self._logger.error(f"WebSocket error: {error}")
def _on_close(self, ws):
self._logger.info("Connection closed")
def _on_open(self, ws):
self._logger.info("Subscribe topic")
sub = {
"symbol": "BTCUSD",
"topic": "trade",
"event": "sub",
"params": {
"binary": False
},
"id": 1
}
ws.send(json.dumps(sub))
# Start the ping thread after connecting
self._start_ping_thread()
def _start_ping_thread(self):
def send_ping():
while self._ws:
ping_message = {
"ping": int(time.time() * 1000) # Send a timestamp as the ping message
}
self._ws.send(json.dumps(ping_message))
self._logger.info(f"Send ping message: {ping_message}")
time.sleep(5)
self._ping_thread = threading.Thread(target=send_ping)
self._ping_thread.daemon = True
self._ping_thread.start()
def unsubscribe(self):
if self._ws:
self._logger.info("Unsubscribe topic")
unsub = {
"symbol": "BTCUSD",
"topic": "trade",
"event": "cancel",
"params": {
"binary": False
},
"id": 1
}
self._ws.send(json.dumps(unsub))
def connect(self):
base_url = 'wss://stream-pro.sim.hashkeydev.com'
endpoint = 'quote/ws/v1'
stream_url = f"{base_url}/{endpoint}"
self._logger.info(stream_url)
self._logger.info(f"Connecting to {stream_url}")
self._ws = websocket.WebSocketApp(stream_url,
on_message=self._on_message,
on_error=self._on_error,
on_close=self._on_close)
self._ws.on_open = self._on_open
self._ws.run_forever()
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
client = WebSocketClient()
client.connect()
Python Private Stream Sample
import hashlib
import hmac
import json
import time
import websocket
import logging
import threading
import requests
import datetime
########################################################################################################################
# Test Websocket API
# Copyright: Hashkey Trading 2023
########################################################################################################################
class WebSocketClient:
def __init__(self, user_key, user_secret, subed_topic=None):
if subed_topic is None:
subed_topic = []
self.user_key = user_key
self.user_secret = user_secret
self.subed_topic = subed_topic
self.listen_key = None
self._logger = logging.getLogger(__name__)
self._ws = None
self._ping_thread = None
self.last_listen_key_extend = time.time()
def generate_listen_key(self):
params = {
'timestamp': int(time.time() * 1000),
}
api_headers = {
'X-APIKEY': self.user_key,
'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
}
signature = self.create_hmac256_signature(secret_key=self.user_secret, params=params)
params.update({
'signature': signature,
})
response = requests.post(url=f"/api/v1/userDataStream", headers=api_headers, data=params)
data = response.json()
if 'listenKey' in data:
self.listen_key = data['listenKey']
self._logger.info(f"Generated listen key: {self.listen_key}")
else:
raise Exception("Failed to generate listen key")
def extend_listenKey_timeLimit(self):
params = {
'timestamp': int(time.time() * 1000),
'listenKey': self.listen_key,
}
api_headers = {
'X-APIKEY': self.user_key,
'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
}
signature = self.create_hmac256_signature(secret_key=self.user_secret, params=params)
params.update({
'signature': signature,
})
response = requests.put(url=f"/api/v1/userDataStream", headers=api_headers, data=params)
if response.status_code == 200:
self._logger.info("Successfully extended listen key validity.")
else:
self._logger.error("Failed to extend listen key validity.")
def create_hmac256_signature(self, secret_key, params, data=""):
for k, v in params.items():
data = data + str(k) + "=" + str(v) + "&"
signature = hmac.new(secret_key.encode(), data[:-1].encode(), digestmod=hashlib.sha256).hexdigest()
return signature
def _on_message(self, ws, message):
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
self._logger.info(f"{current_time} - Received message: {message}")
data = json.loads(message)
if "pong" in data:
self._logger.info("Received pong message")
# Handle other messages here
def _on_error(self, ws, error):
self._logger.error(f"WebSocket error: {error}")
def _on_close(self, ws):
self._logger.info("Connection closed")
def _on_open(self, ws):
self._logger.info("Subscribing to topics")
for topic in self.subed_topic:
sub = {
"symbol": "BTCUSD",
"topic": topic,
"event": "sub",
"params": {
"limit": "100",
"binary": False
},
"id": 1
}
ws.send(json.dumps(sub))
self._start_ping_thread()
def _start_ping_thread(self):
def send_ping():
while self._ws:
current_time = time.time()
if current_time - self.last_listen_key_extend > 1800: # Extend listen key every 30 minutes
self.extend_listenKey_timeLimit()
self.last_listen_key_extend = current_time
ping_message = {"ping": int(time.time() * 1000)}
self._ws.send(json.dumps(ping_message))
self._logger.info(f"Sent ping message: {ping_message}")
time.sleep(5)
self._ping_thread = threading.Thread(target=send_ping)
self._ping_thread.daemon = True
self._ping_thread.start()
def unsubscribe(self):
if self._ws:
self._logger.info("Unsubscribing from topics")
for topic in self.subed_topic:
unsub = {
"symbol": "BTCUSD",
"topic": topic,
"event": "cancel_all",
"params": {
"limit": "100",
"binary": False
},
"id": 1
}
self._ws.send(json.dumps(unsub))
def connect(self):
if not self.listen_key:
self.generate_listen_key()
base_url = 'wss://stream-pro.sim.hashkeydev.com'
endpoint = f'api/v1/ws/{self.listen_key}'
stream_url = f"{base_url}/{endpoint}"
self._logger.info(f"Connecting to {stream_url}")
self._ws = websocket.WebSocketApp(stream_url,
on_message=self._on_message,
on_error=self._on_error,
on_close=self._on_close)
self._ws.on_open = self._on_open
self._ws.run_forever()
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
user_key = "YOUR_USER_KEY"
user_secret = "YOUR_USER_SECRET"
subed_topics = ["trade"]
client = WebSocketClient(user_key, user_secret, subed_topics)
client.connect()
Sandbox Environment
- MarketData public stream V1:
wss://stream-pro.sim.hashkeydev.com/quote/ws/v1 - MarketData public stream V2:
wss://stream-pro.sim.hashkeydev.com/quote/ws/v2 - Private stream:
wss://stream-pro.sim.hashkeydev.com/api/v1/ws/{listenKey}
Production Environment
- MarketData public stream V1:
wss://stream-pro.hashkey.com/quote/ws/v1 - MarketData public stream V2:
wss://stream-pro.hashkey.com/quote/ws/v2 - Private stream:
wss://stream-pro.hashkey.com/api/v1/ws/{listenKey}
Note: Replace {listenKey} with your actual listen key obtained from the Obtain ListenKey.
For example in Postman, you can test our websocket in steps:
- Create a new request and select Websocket

- Input
wss://stream-pro.sim.hashkeydev.com/quote/ws/v1orwss://stream-pro.sim.hashkeydev.com/api/v1/ws/{listenKey}and click "Connect"
Heartbeat check
PublicStream Heartbeat
Ping message format is as follows:
// From Sent by the user
{
"ping": 1748503859938
}
Pong message format is as follows:
// Public Stream, return server's timestamp
{
"pong": 1748503865406
}
When a user's websocket client application successfully connects to HashKey websocket server, the client is recommended to initiate a periodic heartbeat message (ping message) every 10 seconds, which is used to keep alive the connection.
PrivateStream Heartbeat
// From Websocket Server
{
"ping": 1748504490208,
"channelId": "02ac86fffe5fdf52-00000001-00266eb0-74a37ad40fb20d81-0cda790b"
}
// Respond from client
{
"pong": 1748504490208
}
Automatic disconnection mechanism (Only for Private Stream)
The websocket server will send a ping message every 30 seconds. We recommend clients respond with a pong message containing the same timestamp. It's not necessary to include the channelId. A mismatched pong timestamp will not affect the connection โ we mainly care about receiving the pong itself, which indicates the connection is alive. (This mechanism is primarily used for internal latency calculation and statistics.) If the client has no heartbeat activity for 60 minutes, the session will be closed by the server.
Public Market Data Stream
V1
Use Public stream V1
- Sandbox:
wss://stream-pro.sim.hashkeydev.com/quote/ws/v1 - Production:
wss://stream-pro.hashkey.com/quote/ws/v1
Kline
Request Example:
{
"symbol": "BTCUSDT",
"topic": "kline_1m",
"event": "sub",
"params": {
"binary": false
}
}
Response content:
{
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"topic": "kline",
"params": {
"realtimeInterval": "24h",
"klineType": "1m",
"binary": "false"
},
"data": [
{
"t": 1766727660000,
"s": "BTCUSDT",
"sn": "BTCUSDT",
"c": "88888.01",
"h": "88888.01",
"l": "88888.01",
"o": "88888.01",
"v": "0",
"et": 0,
"qv": "0",
"td": 0,
"tb": "0",
"tq": "0"
}
],
"f": true,
"sendTime": 1766727675969,
"shared": false
}
Update frequency: 300ms
Subscription parameters:
topic is a pattern like kline_$interval, interval could be:
1m- 1 minute3m- 3 minutes5m- 5 minutes15m- 15 minutes30m- 30 minutes1h- 1 hour2h- 2 hours4h- 4 hours6h- 6 hours8h- 8 hours12h- 12 hours1d- 1 day1w- 1 week1M- 1 month
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | BTCUSDT | Name of currency pair |
| topic | STRING | Y | kline_1m | Topic name |
| event | STRING | Y | sub | Event type |
| params | JSON Object | Y | Request expanded parameters | |
| params.binary | BOOLEAN | Y | false | True will return zip binary file |
WS Push Demo
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | BTCUSDT | Currency pair ID |
| symbolName | STRING | BTCUSDT | Currency pair name |
| topic | STRING | kline | Topic name |
| params | JSON Object | Request expanded parameters | |
| params.realtimeInterval | STRING | 24h | Time period, only support 24h |
| params.klineType | STRING | 1m | Kline Type |
| params.binary | STRING | false | Whether it is a binary type |
| data | JSON Array | Return data | |
| data.t | LONG | 1688199660000 | Timestamp in Milliseconds |
| data.s | STRING | BTCUSDT | Currency pair ID |
| data.sn | STRING | BTCUSDT | Currency pair name |
| data.c | STRING | 10002 | Close price |
| data.h | STRING | 10002 | High price |
| data.l | STRING | 10002 | Low price |
| data.o | STRING | 10002 | Open price |
| data.v | STRING | 0 | Base Asset Volume |
| data.et | INTEGER | 0 | Closing timestamp |
| data.qv | STRING (decimal) | 927.9672557 | Quote Asset Volume |
| data.td | INTEGER | 4 | Number of Trades |
| data.tb | STRING (decimal) | 0.00045 | Taker buy base asset volume |
| data.tq | STRING (decimal) | 39.2087177 | Taker buy quote asset volume |
| f | BOOLEAN | true | Whether it is the first return value |
| sendTime | LONG | 1688199337756 | Timestamp in milliseconds |
| shared | BOOLEAN | false | Whether to share (No longer in use) |
Realtimes
Request Example:
{
"symbol": "BTCUSDT",
"topic": "realtimes",
"event": "sub",
"params": {
"binary": false
}
}
Response content:
{
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"topic": "realtimes",
"params": {
"realtimeInterval": "24h",
"binary": "false"
},
"data": [
{
"t": 1764598623773,
"s": "BTCUSDT",
"sn": "BTCUSDT",
"c": "86127.13",
"h": "91854.4",
"l": "84834.68",
"o": "91592.99",
"v": "23.90583",
"qv": "2071254.823793",
"m": "-0.0597",
"e": 301
}
],
"f": false,
"sendTime": 1764598623952,
"shared": false
}
Update frequency: 500ms
Subscription parameters:
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | BTCUSDT | Currency pair |
| topic | STRING | Y | realtimes | Topic name, default: "realtimes" |
| event | STRING | Y | sub | Event Type |
| params | JSON Object | Y | Request expanded parameters | |
| params.binary | BOOLEAN | Y | false | True will return zip binary file |
WS Push Demo
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | BTCUSDT | Currency pair ID |
| symbolName | STRING | BTCUSDT | Currency pair name |
| topic | STRING | realtimes | Topic name |
| params | JSON Object | Request expanded parameter | |
| params.realtimeInterval | STRING | 24h | Time period |
| params.binary | STRING | false | Whether it is a binary type |
| data | JSON Array | Return data | |
| data.t | LONG | 1688199300011 | Timestamp in Milliseconds |
| data.s | STRING | BTCUSDT | Currency pair ID |
| data.sn | STRING | BTCUSDT | Currency pair name |
| data.c | STRING | 10002 | Close price |
| data.h | STRING | 10002 | High price |
| data.l | STRING | 10002 | Low price |
| data.o | STRING | 10002 | Open price |
| data.v | STRING | 0 | Volume (in base currency) |
| data.qv | STRING | 0 | Volume(in quote currency) |
| data.m | STRING | 0 | 24H range |
| data.e | INT64 | 301 | Exchange ID |
| f | BOOLEAN | true | Whether it is the first return value |
| sendTime | LONG | 1688199337756 | Timestamp in milliseconds |
| shared | BOOLEAN | false | Whether to share (No longer in use) |
Trade
Request Example:
{
"symbol": "BTCUSDT",
"topic": "trade",
"event": "sub",
"params": {
"binary": false
}
}
Response content:
{
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"topic": "trade",
"params": {
"realtimeInterval": "24h",
"binary": "false"
},
"data": [
{
"v": "4620696243481038848",
"t": 1764598927887,
"p": "86101.4",
"q": "0.00314",
"m": false
}
],
"f": false,
"sendTime": 1764598928016,
"shared": false
}
Upon successful subscription to our WebSocket API, you will receive an update of the most recent 60 trades for the symbol pair subscribed.
Update frequency: 300ms
Subscription parameters:
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | BTCUSDT | Currency pair |
| topic | STRING | Y | trade | Topic name, default: "trade" |
| event | STRING | Y | sub | Event type |
| params | JSON Object | Y | Request expanded parameters | |
| params.binary | BOOLEAN | Y | false | True will return zip binary file |
WS Push Demo
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | BTCUSDT | Currency pair ID |
| symbol | STRING | BTCUSDT | Currency pair name |
| topic | STRING | trade | Topic name |
| params | JSON Object | Request expanded parameters | |
| params.realtimeInterval | STRING | 24h | Time period |
| params.binary | BOOLEAN | false | Whether it is a binary type |
| data | JSON Array | Return data | |
| data.v | STRING | 1447335405363150849 | Transaction record ID |
| data.t | STRING | 1687271825415 | Timestamp corresponding to transaction time in milliseconds |
| data.p | STRING | 10001 | Traded price |
| data.q | STRING | 0.001 | Traded quantity |
| data.m | STRING | false | isMaker (true: maker, false: taker) |
| f | BOOLEAN | true | Whether it is the first return value |
| sendTime | LONG | 1688199337756 | Timestamp in milliseconds |
| shared | BOOLEAN | false | Whether to share (No longer in use) |
Depth
Request Example:
{
"symbol": "BTCUSDT",
"topic": "depth",
"event": "sub",
"params": {
"binary": false
}
}
Response content:
{
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"topic": "depth",
"params": {
"realtimeInterval": "24h",
"binary": "false"
},
"data": [
{
"e": 301,
"s": "BTCUSDT",
"t": 1764599292355,
"v": "538222447_18",
"b": [
[
"86296.37",
"0.00046"
],
[
"86296.29",
"0.0006"
]
],
"a": [
[
"86296.38",
"0.00115"
],
[
"86300.51",
"0.00986"
]
],
"o": 0
}
],
"f": false,
"sendTime": 1764599292481,
"channelId": "0edeeafffed451ae-00000001-002a4da4-b065b0d60d88615a-688ef045",
"shared": false
}
Request the depth of the order book, can request up to limit of 200
Update frequency: 300ms
Subscription parameters:
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | BTCUSDT | Currency pair |
| topic | STRING | Y | depth | Topic name, default: "depth" |
| event | STRING | Y | sub | Event type |
| params | JSON Object | Y | Request expanded parameters | |
| params.binary | BOOLEAN | Y | false | True will return zip binary file |
WS Push Demo
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | BTCUSDT | Currency pair ID |
| symbol | STRING | BTCUSDT | Currency pair name |
| topic | STRING | depth | Topic name |
| params | JSON Object | Request expanded parameters | |
| params.realtimeInterval | STRING | 24h | Time period |
| params.binary | BOOLEAN | false | Whether it is a binary type |
| data | JSON Array | Return data | |
| data.e | INT64 | 301 | Exchange ID |
| data.s | STRING | BTUSDT | Currency pair |
| data.t | LONG | 1688199202314 | Timestamp in milliseconds (data time) |
| data.v | STRING | 6881_18 | Ignore this |
| data.o | INT64 | 0 | Ignore this |
| data.a | JSON Array | ["10004", "0.001"] | Ask price and quantity |
| data.b | JSON Array | ["10004", "0.001"] | Bid price and quantity |
| f | BOOLEAN | true | Whether it is the first return value |
| sendTime | LONG | 1688199337756 | Timestamp in milliseconds |
| shared | BOOLEAN | false | Whether to share (No longer in use) |
V2
Use Public stream V2
- Sandbox:
wss://stream-pro.sim.hashkeydev.com/quote/ws/v2 - Production:
wss://stream-pro.hashkey.com/quote/ws/v2
Kline
Request Example:
{
"topic":"kline",
"event":"sub",
"params":{
"symbol": "BTCUSDT",
"klineType":"1m"
}
}
Response content:
{
"topic": "kline",
"params": {
"symbol": "BTCUSDT",
"klineType": "1m"
},
"data": {
"t": 1766728080000,
"s": "BTCUSDT",
"sn": "BTCUSDT",
"c": "88947.71",
"h": "88947.71",
"l": "88947.71",
"o": "88947.71",
"v": "0"
}
}
Update frequency: Real-time push
Subscription parameters:
klineType could be:
1m- 1 minute3m- 3 minutes5m- 5 minutes15m- 15 minutes30m- 30 minutes1h- 1 hour2h- 2 hours4h- 4 hours6h- 6 hours8h- 8 hours12h- 12 hours1d- 1 day1w- 1 week1M- 1 month
| PARAMETER | TYPE | Req'd | Example | DESCRIPTION |
|---|---|---|---|---|
| topic | STRING | Y | kline | Topic for "kline" data push |
| event | STRING | Y | sub | Subscribe ("sub") or Unsubscribe ("cancel") |
| params | DICTIONARY | Y | Request Parameters | |
| params.symbol | STRING | Y | ETHUSDT | Trading Pairs see Get-Exchange-Information |
| params.klineType | STRING | Y | 1m | Type of Kline. |
WS Push Demo
| PARAMETER | TYPE | Example | DESCRIPTION |
|---|---|---|---|
| topic | STRING | kline | Topic for "kline" data push |
| params | DICTIONARY | Request Parameters | |
>symbol |
STRING | ETHUSDT | Trading Pairs see Get-Exchange-Information |
>klineType |
STRING | 1m | Type of Kline |
| data | DICTIONARY | WS Push Contenet Data | |
>t |
LONG | 1730100300000 | Data Time (milisecond) |
>s |
STRING | ETHUSDT | Trading Pair |
>sn |
STRING | ETHUSDT | Trading Pair Name |
>c |
STRING (decimal) | 1803.02 | close |
>h |
STRING (decimal) | 1806.97 | high |
>l |
STRING (decimal) | 1803.02 | low |
>o |
STRING (decimal) | 1806.07 | open |
>v |
STRING (decimal) | 0.075 | Total traded base asset volume |
Realtimes
Request Example:
{
"topic":"realtimes",
"event":"sub",
"params":{
"symbol": "BTCUSDT"
}
}
Response content:
{
"topic": "realtimes",
"params": {
"symbol": "BTCUSDT"
},
"data": {
"t": 1766728440004,
"s": "BTCUSDT",
"o": "87740.12",
"h": "89270.33",
"l": "86971.82",
"c": "88910.23",
"v": "0.20041",
"qv": "17621.0846565",
"m": "0.0133"
}
}
Update frequency: Real-time push
Subscription parameters:
| PARAMETER | TYPE | Req'd | Example | DESCRIPTION |
|---|---|---|---|---|
| topic | STRING | Y | realtimes | Topic for "realtimes" data push |
| event | STRING | Y | sub | Subscribe ("sub") or Unsubscribe ("cancel") |
| params | DICTIONARY | Y | Request Parameters | |
| params.symbol | STRING | Y | ETHUSDT | Trading Pairs see Get-Exchange-Information |
WS Push Demo
| PARAMETER | TYPE | Example | DESCRIPTION |
|---|---|---|---|
| topic | STRING | realtimes | Topic for "realtimes" data push |
| params | DICTIONARY | - | Request Parameters |
>symbol |
STRING | ETHUSDT | Trading Pairs see Get-Exchange-Information |
| data | DICTIONARY | - | WS Push Content Data |
>t |
LONG | 1730100239050 | Data Time (milisecond) |
>s |
STRING | ETHUSDT | Trading Pair |
>o |
STRING (decimal) | 1808.48 | Open price |
>h |
STRING (decimal) | 1808.48 | High price |
>l |
STRING (decimal) | 1803.02 | Low price |
>c |
STRING (decimal) | 1806.62 | Close price |
>v |
STRING (decimal) | 0.247 | Volume (in base currency) |
>qv |
STRING (decimal) | 445.91714 | Volume(in quote currency) |
>m |
STRING (decimal) | 0.0105 | 24H range |
Trade
Request Example:
{
"topic":"trade",
"event":"sub",
"params":{
"symbol": "ETHUSDT"
}
}
Response content:
{
"topic": "trade",
"params": {
"symbol": "ETHUSDT"
},
"data": {
"v": "4645465192627367936",
"t": 1766728952350,
"p": "2974.53",
"q": "0.0089",
"m": false
}
}
Update frequency: Real-time push
Subscription parameters:
| PARAMETER | TYPE | Req'd | Example | DESCRIPTION |
|---|---|---|---|---|
| topic | STRING | Y | trade | Topic for "trade" data push |
| event | STRING | Y | sub | Subscribe ("sub") or Unsubscribe ("cancel") |
| params | DICTIONARY | Y | Request Parameters | |
| params.symbol | STRING | Y | ETHUSDT | Trading Pairs see Get-Exchange-Information |
WS Push Demo
| PARAMETER | TYPE | Example | DESCRIPTION |
|---|---|---|---|
| topic | STRING | trade | Topic for "trade" data push |
| params | DICTIONARY | - | Request Parameters |
>symbol |
STRING | ETHUSDT | Trading Pairs see Get-Exchange-Information |
| data | DICTIONARY | - | WS Push Content Data |
>v |
STRING | 4620696263626366976 | Transaction record ID |
>t |
LONG | 1730100239050 | Data Time (milisecond) |
>p |
STRING (decimal) | ETHUSDT | Traded price |
>q |
STRING (decimal) | 1808.48 | Traded quantity |
>m |
BOOLEAN | true | true: buyer is the maker false: buyer is the taker |
Depth
Request Example:
{
"topic":"depth",
"event":"sub",
"params":{
"symbol": "BTCUSDT"
}
}
Response content:
{
"topic": "depth",
"params": {
"symbol": "BTCUSDT"
},
"data": {
"s": "BTCUSDT",
"t": 1764659869550,
"v": "735962141_2",
"b": [
[
"86962.98",
"0.04215"
],
[
"86961.35",
"0.00057"
]
],
"a": [
[
"86962.99",
"0.34497"
],
[
"86963.94",
"0.00114"
]
]
}
}
Update frequency: 100ms
Subscription parameters:
| PARAMETER | TYPE | Req'd | Example | DESCRIPTION |
|---|---|---|---|---|
| topic | STRING | Y | depth | Topic for "depth" data push |
| event | STRING | Y | sub | Subscribe ("sub") or Unsubscribe ("cancel") |
| params | DICTIONARY | Y | Request Parameters | |
| params.symbol | STRING | Y | ETHUSDT | Trading Pairs see Get-Exchange-Information |
WS Push Demo
| PARAMETER | TYPE | Example | DESCRIPTION |
|---|---|---|---|
| topic | STRING | depth | Topic for "depth" data push |
| params | DICTIONARY | - | Request Parameters |
>symbol |
STRING | - | Trading Pairs see Get-Exchange-Information |
| data | DICTIONARY | - | WS Push Contenet Data |
>s |
STRING | ETHUSDT | Trading Pair |
>t |
LONG | 1730100300000 | Data Time (milisecond) |
>v |
STRING | 55834575325_3 | Message Version |
>b |
JSON Array | ["0.704", "28.477"] | Bid price and quantity |
>a |
JSON Array | ["0.703", "46.671" ] | Ask price and quantity |
BBO
Request Example:
{
"topic":"bbo",
"event":"sub",
"params":{
"symbol": "ETHUSDT"
}
}
Response content:
{
"topic": "bbo",
"params": {
"symbol": "ETHUSDT"
},
"data": {
"s": "ETHUSDT",
"b": "2974.52",
"bz": "0.0202",
"a": "2974.85",
"az": "0.2838",
"t": 1766729017183
}
}
Update frequency: Real-time push
Subscription parameters:
| PARAMETER | TYPE | Req'd | Example | DESCRIPTION |
|---|---|---|---|---|
| topic | STRING | Y | bbo | Topic for "bbo" data push |
| event | STRING | Y | sub | Subscribe ("sub") or Unsubscribe ("cancel") |
| params | DICTIONARY | Y | Request Parameters | |
| params.symbol | STRING | Y | ETHUSDT | Trading Pairs see Get-Exchange-Information |
WS Push Demo
| PARAMETER | TYPE | Example | DESCRIPTION |
|---|---|---|---|
| topic | STRING | bbo | Topic for "bbo" data push |
| params | DICTIONARY | - | Request Parameters |
>symbol |
STRING | ETHUSDT | Trading Pairs see Get-Exchange-Information |
| data | DICTIONARY | - | WS Push Contenet Data |
>s |
STRING | ETHUSDT | Trading Pair |
>t |
LONG | 1730100239050 | Data Time (milisecond) |
>b |
STRING (decimal) | 1802.04 | Bid Price |
>bz |
STRING (decimal) | 0.008 | Bid Quantity |
>a |
STRING (decimal) | 1803.5 | Ask Price |
>az |
STRING (decimal) | 0.001 | Ask Quantity |
User Data Stream
Use Private stream
- Sandbox:
wss://stream-pro.sim.hashkeydev.com/api/v1/ws/{listenKey} - Production:
wss://stream-pro.hashkey.com/api/v1/ws/{listenKey}
Note: Replace {listenKey} with your actual listen key obtained from the Obtain ListenKey.
Account Update
Spot Account balance change
Whenever the account balance changes, an event outboundAccountInfo is sent containing the assets that may have been moved by the event that generated the balance change.
[
{
"e": "outboundAccountInfo",
"E": "1764932840383",
"T": true,
"W": true,
"D": true,
"B": [
{
"a": "BTC",
"f": "6086.715847759989968887",
"l": "0",
"r": ""
}
]
}
]
WS Push Parameter
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | ||
| e | STRING | outboundAccountInfo | Event type:outboundAccountInfooutboundCustodyAccountInfooutboundFiatAccountInfo |
| E | STRING | 1764932840383 | Event timeStamp |
| T | BOOLEAN | true | can trade |
| W | BOOLEAN | true | can withdraw |
| D | BOOLEAN | true | can deposit |
| B | Object Array | ||
>a |
STRING | BTC | asset |
>f |
STRING | 6086.7 | free amount |
>l |
STRING | 0 | locked amount |
>r |
STRING | remark |
Order Update
[
{
"e": "executionReport",
"E": "1766730014188",
"s": "BTCUSDT",
"c": "1766730014087296",
"S": "BUY",
"o": "MARKET_OF_QUOTE",
"f": "IOC",
"q": "0",
"p": "0",
"X": "PARTIALLY_FILLED",
"i": "2113879002607330816",
"l": "0.00885",
"z": "0.00885",
"L": "112934.82",
"n": "0.000013275",
"N": "BTC",
"u": true,
"w": true,
"m": false,
"O": "1766730014098",
"Z": "999.473157",
"C": false,
"v": "0",
"reqAmt": "1000",
"d": "2113879003035149824",
"r": "0",
"V": "112934.82",
"P": "0",
"lo": false,
"lt": "",
"x": ""
}
]
WS Push Parameter
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | ||
| e | STRING | executionReport | Execution Report |
| E | STRING | 1764936108760 | Event timeStamp |
| s | STRING | ETHUSD | symbol |
| c | STRING | 1764936108734433 | client order ID |
| S | STRING | SELL | side |
| o | STRING | LIMIT | order type |
| f | STRING | GTC | time in force |
| q | STRING | 0.01 | order quantity |
| p | STRING | 3150 | order price |
| X | STRING | FILLED | current order status |
| i | STRING | 2098830633787983872 | order ID |
| l | STRING | 0.01 | last executed quantity |
| z | STRING | 0.01 | cumulative filled quantity |
| L | STRING | 3150.11 | last executed price |
| n | STRING | 1.99 | commission amount |
| N | STRING | USD | commission asset |
| u | BOOLEAN | true | is the trade normal๏ผ ignore for now |
| w | BOOLEAN | true | is the order working? Stops will have |
| m | BOOLEAN | false | if the order is a limit maker order |
| O | STRING | 1764936108741 | order creation time |
| Z | STRING | 31.5011 | cumulative quote asset transacted quantity |
| C | BOOLEAN | false | is close, Is the buy close or sell close |
| v | STRING | 0 | leverage |
| reqAmt | STRING | 0 | requested cash amount |
| d | STRING | 2098830633863481345 | execution ID |
| r | STRING | 0 | unfilled quantity |
| V | STRING | 3150.11 | average executed price |
| P | STRING | Index price | |
| lo | BOOLEAN | Is liquidation Order | |
| lt | STRING | Liquidation type LIQUIDATION_MAKER_ADL, LIQUIDATION_MAKER, LIQUIDATION_TAKER |
|
| x | STRING | order cancel reject reason |
Ticket Push
[
{
"e": "ticketInfo",
"E": "1766730154173",
"s": "USDTAED",
"q": "1.00",
"t": "1766730154162",
"p": "91446.40",
"T": "2113880177556930560",
"o": "2113880177188611584",
"c": "99999999980006",
"a": "1695624199740137984",
"m": false,
"S": "BUY"
}
]
WS Push Parameter
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | ||
| e | STRING | ticketInfo | |
| E | STRING | 1764936108760 | Event timeStamp |
| s | STRING | USDTAED | symbol |
| q | STRING | 0.01 | order quantity |
| t | STRING | 1764938485085 | order matching time |
| p | STRING | 3150 | order price |
| T | STRING | 4629700489901088768 | ticketId |
| o | STRING | 2098850567964329984 | order ID |
| c | STRING | 1764938485067417 | clientOrderId |
| a | STRING | 1471090223379184384 | account ID |
| m | BOOLEAN | false | isMaker |
| S | STRING | BUY | side SELL or BUY |