OVERVIEW
Introduction
Welcome to HashKey Global 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
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
REST Sample
import time
import requests
import hashlib
import hmac
import json
from urllib.parse import urlencode
"""
####################################################################################################################################
# Test REST API
#
# Copyright: Hashkey Trading 2024 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., ETHUSD).
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/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-glb.hashkey.com
api_client = RestAPIClient(
base_url="https://api-glb.sim.hashkeydev.com",
user_key="your_user_key",
user_secret="your_user_secret"
)
# Place an order with the desired parameters
api_client.place_order("ETHUSDT", "BUY", "LIMIT", "0.01", "3000")
Sandbox Environment
Restful URL:
https://api-glb.sim.hashkeydev.comWebSocket:
wss://stream-glb.sim.hashkeydev.comWebsite: https://global.sim.hashkeydev.com
Production Environment
Restful URL:
https://api-glb.hashkey.comWebSocket:
wss://stream-glb.hashkey.comWebsite: https://global.hashkey.com
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.
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 |
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'
Time-base security
📘 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
}
📘 A relatively small recvWindow (5000 or less) is recommended!
- 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 initiated.
- An optional parameter (not mandatory)
recvWindowcan 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 - 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.
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.0
POST /api/v1/spot/order
📘 We provide two endpoints for creating spot trading orders:
1. Legacy Endpoint: /api/v1/spot/order
2. New Endpoint: /api/v1.1/spot/order
- Key Differences:
- Market Order Support:
- v1: Supports specifying only the cash amount for market buy orders and the quantity for market sell orders
- v1.1: Supports specifying both the cash amount and the quantity for market orders, regardless of whether it's a buy or sell order
- Quantity and Amount:
- v1: Uses a single 'quantity' parameter for specifying order size
- v1.1: Splits the order size into separate 'quantity' and 'amount' parameters
- Market Order Support:
Recommendation:
For enhanced functionality and flexibility, we strongly recommend using the new v1.1 endpoint (/api/v1.1/spot/order) for all order creations
create-order-v1.1
Certain parameters are mandatory depending on the order type:
| Type | Mandatory parameters |
|---|---|
| LIMIT | quantity, price |
| MARKET | quantity |
| 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 | Y | 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 |
| 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 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 |
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. |
Futures Trading
Change Futures Leverage
POST /api/v1/futures/leverage
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract |
| leverage | INTEGER | Y | 5 | Leverage |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"code": "0000",
"symbolId": "BTCUSDT-PERPETUAL",
"leverage": "5"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | LONG | 0000 | Return code of request |
| symbolId | STRING | ETHUSDT-PERPETUAL | Name of the contract |
| leverage | STRING | 5 | Leverage |
Query Futures Leverage
GET /api/v1/futures/leverage
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
[
{
"symbolId": "BTCUSDT-PERPETUAL",
"leverage": "5",
"marginType": "CROSS"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbolId | STRING | ETHUSDT-PERPETUAL | Name of the contract |
| leverage | STRING | 5 | Leverage |
| marginType | STRING | CROSS | Margin type. Possible values include CROSS, ISOLATED. |
Create New Futures Order
POST /api/v1/futures/order
This endpoint allows you to create a new Futures order. There are two main types of orders you can place: Limit orders and Market orders. Here's how to use them:
{
"symbol": "ETHUSDT-PERPETUAL",
"side": "BUY_OPEN",
"type": "LIMIT",
"quantity": 10000,
"price": 3000,
"priceType": "INPUT",
"timeInForce": "GTC",
"clientOrderId": "limit_order_001",
"timestamp": 1714311403031
}
Limit Order
A Limit order allows you to set a specific price at which you want to buy or sell.
To place a Limit order:
- Set "type" to "LIMIT"
- Set "priceType" to "INPUT" (this is the default, so you can omit it if you prefer)
- Specify the "price" at which you want to execute the order
- Set other required parameters like "symbol", "side", "quantity", etc.
{
"symbol": "ETHUSDT-PERPETUAL",
"side": "SELL_OPEN",
"type": "LIMIT",
"quantity": 5000,
"priceType": "MARKET",
"timeInForce": "GTC",
"clientOrderId": "market_order_001",
"timestamp": 1714311503031
}
Market Order
A Market order is executed immediately at the best available current market price.
To place a Market order:
- Set "type" to "LIMIT"
- Set "priceType" to "MARKET"
- Do not specify a "price" (it will be ignored if included)
- Set other required parameters like "symbol", "side", "quantity", etc.
You can get contracts' price, quantity precision configuration data in the Get Exchange Information
Weight: 1
Request Parameters
📘 Quick tip how to input your position type
BUY_OPEN: Initiating a long position by buying. This results in a long position
SELL_CLOSE: Closing a long position by selling. This reduces the long position
SELL_OPEN: Initiating a short position by selling. This results in a short position
BUY_CLOSE: Closing a short position by buying. This reduces the short position
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of contract |
| side | STRING | Y | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| type | STRING | Y | LIMIT | The order type, possible types: LIMIT, STOP. |
| quantity | INTEGER | Y | 10000 | The number of contracts to buy, should be integer for example 10 |
| price | FLOAT | Required for (LIMIT & INPUT) orders | 3000 | Price of the order |
| priceType | STRING | INPUT | The price type, possible types include: INPUT and MARKET. |
|
| stopPrice | FLOAT | Required for STOP orders | 2800 | The price at which the trigger order will be executed. |
| timeInForce | STRING | GTC | Time in force for LIMIT orders. Possible values include: GTC,FOK,IOC,LIMIT_MAKER. |
|
| clientOrderId | STRING | Y | 99999999980000 | A unique ID of the order (up to 255 characters) |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
| stpMode | ENUM | C | EXPIRE_TAKER | Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKERDefault EXPIRE_TAKER if not specified. |
Response Content
TYPE = LIMIT
{
"time": "1766383455843",
"updateTime": "1766383456057",
"orderId": "2110971860351002112",
"clientOrderId": "999999999122201",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91251",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "18.2502",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "NEW",
"priceType": "INPUT",
"contractMultiplier": "0.00100000"
}
TYPE = LIMIT
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when the order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| executedQty | STRING | 0 | Quantity of orders that has been executed |
| avgPrice | STRING | 0 | Average price of filled orders. |
| marginLocked | STRING | 6000 | Amount of margin locked for this order. This includes the actually margin needed plus fees to open and close the position. |
| type | STRING | LIMIT | The order type, possible types: LIMITLIMIT_MAKERMARKET_OF_BASE |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| timeInForce | STRING | GTC | Time in force for LIMIT orders. Possible values include: GTC,FOK,IOC,LIMIT_MAKER. |
| status | STRING | NEW | The state of the order. Possible values include: NEWPARTIALLY_FILLEDFILLEDCANCELEDPARTIALLY_CANCELEDREJECTED |
| priceType | STRING | INPUT | The price type. Possible values include INPUT and MARKET. |
| contractMultiplier | STRING | 0.00100000 | Contract multiplier |
TYPE = STOP
{
"time": "1766387741913",
"updateTime": "1766387741913",
"orderId": "2111007815426518272",
"accountId": "1649292498437183234",
"clientOrderId": "999999999122202",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91252",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_NEW",
"stopPrice": "91260",
"stpMode": "EXPIRE_TAKER"
}
TYPE = STOP
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| accountId | STRING | 1649292498437183234 | Account ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| type | STRING | STOP | The order type, possible types: STOP |
| side | STRING | BUY | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| status | STRING | NEW | The state of the order. Possible values include: ORDER_NEWORDER_FILLEDORDER_REJECTEDORDER_CANCELEDORDER_FAILEDORDER_NOT_EFFECTIVE |
| stopPrice | STRING | 3000 | Average price of filled orders |
| stpMode | STRING | EXPIRE_TAKER | Self Trade Prevention Mode. |
Set Trading Stop
POST /api/v1/futures/position/trading-stop
Weight: 3
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | Name of the contract | |
| side | ENUM | Y | Position side,LONG or SHORT | |
| stopProfit | STRING | REQUIRED for stopLoss not send | Stop profit price | |
| stopLoss | STRING | REQUIRED for stopProfit not send | Stop loss price | |
| tpTriggerBy | ENUM | Take profit The price type to trigger take profit: MARK_PRICE, CONTRACT_PRICE. Default CONTRACT_PRICE |
||
| slTriggerBy | ENUM | Stop loss The price type to trigger stop loss: MARK_PRICE, CONTRACT_PRICE. Default CONTRACT_PRICE |
||
| recvWindow | LONG | 5000 | recv window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"symbolId": "BTCUSDT-PERPETUAL",
"side": "LONG",
"stopProfitPrice": "100000",
"stopProfitTriggerConditionType": "CONTRACT_PRICE",
"stopLossPrice": "",
"stopLossTriggerConditionType": "CONTRACT_PRICE"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | BTCUSDT-PERPETUAL | Name of the contract |
| side | STRING | LONG | Position side, LONG or SHORT |
| stopProfit | STRING | 29037.2 | Stop profit price |
| stopLoss | STRING | 27037 | Stop loss price |
| tpTriggerBy | ENUM | CONTRACT_PRICE | The price type to trigger take profit: MARK_PRICE, CONTRACT_PRICE |
| slTriggerBy | ENUM | CONTRACT_PRICE | The price type to trigger stop loss: MARK_PRICE, CONTRACT_PRICE |
Batch Create New Futures Orders
POST /api/v1/futures/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/futures/batchOrders?timestamp=1714404830102&signature=8c47cf48ec60bda57146e465f436aeb2906ed4316fa15d77cfaac32e4092e08f' \
--header 'X-HK-APIKEY: XAzx6DLW2HNsvDc6CccEaBWXsFoR3EAXjxvq0PjfGtSxHikQysiIkDIP12AMWpDs' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
[
{
"symbol": "ETHUSDT-PERPETUAL",
"side": "BUY_OPEN",
"type": "LIMIT",
"price": 3000,
"priceType": "INPUT",
"quantity": 10000,
"clientOrderId": "122455"
},
{
"symbol": "ETHUSDT-PERPETUAL",
"side": "BUY_OPEN",
"type": "LIMIT",
"price": 3100,
"priceType": "INPUT",
"quantity": 10000,
"clientOrderId": "122433"
}
]
'
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | Name of contract | |
| side | ENUM | Y | Side: BUY_OPEN SELL_OPEN BUY_CLOSE SELL_CLOSE |
|
| type | ENUM | Y | The order type, possible types: LIMIT, STOP. |
|
| quantity | LONG | Y | The number of contracts to buy, e.g. non integers will still treat as 1 | |
| price | DECIMAL | Required for (LIMIT & INPUT) orders | Price required for LIMIT & INPUT orders | |
| priceType | Y | Price type INPUT and MARKET |
||
| timeInForce | The time command (Time in Force) of LIMIT order, the currently supported types are GTC, FOK, IOC, LIMIT_MAKER |
|||
| clientOrderId | Y | The ID of the order, defined by the user (up to 255 characters) | ||
| stpMode | ENUM | C | EXPIRE_TAKER | Self Trade Prevention Mode. Enum: EXPIRE_TAKER, EXPIRE_MAKER Default EXPIRE_TAKER if not specified. |
Response Content
{
"code": "0000",
"result": [
{
"code": "0000",
"order": {
"time": "1766395364481",
"updateTime": "1766395364502",
"orderId": "2111071758043915776",
"clientOrderId": "test1222a",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91310",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "18.262",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "NEW",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER",
"locked": "1"
}
},
{
"code": "0000",
"order": {
"time": "1766395364517",
"updateTime": "1766395364568",
"orderId": "2111071758413014528",
"clientOrderId": "test1223b",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91311",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "18.2622",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "NEW",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER",
"locked": "1"
}
}
]
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | STRING | 0000 | Return code of request |
| result | Object Array | Create futures order result list |
Cancel Futures Order
DELETE /api/v1/futures/order
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| orderId | STRING | REQUIRED for clientOrderId not send | 1674945624754144000 | Order Id |
| clientOrderId | STRING | REQUIRED for orderId not send | 99999999980002 | Client Order Id |
| type | STRING | Y | LIMIT | Type |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract | |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
TYPE = LIMIT
{
"time": "1766395364481",
"updateTime": "1766395364502",
"orderId": "2111071758043915776",
"clientOrderId": "test1222a",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91310",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "18.262",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "NEW",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER",
"locked": "1"
}
TYPE = LIMIT
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when the order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| executedQty | STRING | 0 | Quantity of orders that has been executed |
| avgPrice | STRING | 0 | Average price of filled orders. |
| marginLocked | STRING | 6000 | Amount of margin locked for this order. This includes the actually margin needed plus fees to open and close the position. |
| type | STRING | LIMIT | The order type, possible types: LIMITLIMIT_MAKERMARKET_OF_BASE |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| timeInForce | STRING | GTC | Time in force for LIMIT orders. Possible values include: GTC,FOK,IOC,LIMIT_MAKER. |
| status | STRING | NEW | The state of the order. Possible values include: NEWPARTIALLY_FILLEDFILLEDCANCELEDPARTIALLY_CANCELEDREJECTED |
| priceType | STRING | INPUT | The price type. Possible values include INPUT and MARKET. |
| isLiquidationOrder | BOOLEAN | Whether the order is a liquidation order | |
| indexPrice | STRING | Index price. Available when isLiquidationOrder is true | |
| liquidationType | STRING | Available when isLiquidationOrder is trueLIQUIDATION_MAKER_ADLLIQUIDATION_MAKERLIQUIDATION_TAKER |
|
| ordCxlReason | STRING | Order cancel reason | |
| stpMode | STRING | Self Trade Prevention Mode. | |
| locked | STRING |
TYPE = STOP
{
"time": "1766456692298",
"updateTime": "1766457370108",
"orderId": "2111586213177732352",
"accountId": "1649292498437183234",
"clientOrderId": "99999999980009",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91500",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_CANCELED",
"stopPrice": "100000",
"stpMode": "EXPIRE_TAKER"
}
TYPE = STOP
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| accountId | STRING | 1649292498437183234 | Account ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| type | STRING | STOP | The order type, possible types: STOP |
| side | STRING | BUY | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| status | STRING | NEW | The state of the order. Possible values include: ORDER_NEWORDER_FILLEDORDER_REJECTEDORDER_CANCELEDORDER_FAILEDORDER_NOT_EFFECTIVE |
| stopPrice | STRING | 3000 | Average price of filled orders |
| stpMode | STRING | EXPIRE_TAKER | Self Trade Prevention Mode. |
Batch Cancel Futures Order by Symbol
DELETE /api/v1/futures/batchOrders
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract |
| side | STRING | BUY | BUY or SELL | |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"message": "success",
"timestamp": 1766457891750,
"code": "0000"
}
| 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 | 1541161088303 | Timestamp when returning |
Batch Cancel Futures Open Orders
DELETE /api/v1/futures/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
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. Return results for all symbols if not specified. |
|
| side | STRING | BUY | BUY or SELL | |
| recvWindow | ||||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
| fromOrderId | LONG | 1470930457684189696 | From Order ID. For exmaple, OrderIds:1004,1003,1002,1001, if fromOrderId=1003, then 1002 and 1001 will be canceled |
|
| limit | INTEGER | 20 | Default 100, Maximum 200 |
Response Content
{
"code": "0000",
"message": "success",
"timestamp": 1766459041259,
"lastOrderId": 0
}
| 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 | 1541161088303 | Timestamp when returning |
| lastOrderId | LONG | 0 | Last Order ID to be canceled (return 0 if no order can be cacencelled) |
Batch Cancel Futures Order By Order Ids
DELETE /api/v1/futures/cancelOrderByIds
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| ids | STRING | Y | 2111604238425597440,2111603153979909632 | Order id (multiple separated by ,) |
| recvWindow | LONG | 5000 | recv window | |
| timestamp | LONG | Y | 1714311403031 | timestamp |
Response Content
{
"code": "0000",
"result": []
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | STRING | 0000 | Return code of cancellation request |
| result | Object Arrays | ||
| orderId | LONG | 1234567543 | Order Id |
| msg | STRING | Order not found | Return msg of cancellation request |
Query Futures Order
GET /api/v1/futures/order
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| orderId | INTEGER | REQUIRED for clientOrderId when not sent | 1674945624754144000 | Order Id |
| clientOrderId | STRING | REQUIRED for orderId when not sent | 99999999980002 | Client Order Id |
| type | STRING | Y | LIMIT | LIMIT or STOP. Only return LIMIT Order if not specify. |
| recvWindow | LONG | 5000 | recvWindow | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
TYPE = LIMIT
{
"time": "1766458711805",
"updateTime": "1766460473293",
"orderId": "2111603153979909632",
"clientOrderId": "test1222abc3",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91312",
"leverage": "5",
"origQty": "2",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "CANCELED",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "USER_CANCEL",
"stpMode": "EXPIRE_TAKER",
"locked": "0"
}
TYPE = LIMIT
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when the order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| executedQty | STRING | 0 | Quantity of orders that has been executed |
| avgPrice | STRING | 0 | Average price of filled orders. |
| marginLocked | STRING | 6000 | Amount of margin locked for this order. This includes the actually margin needed plus fees to open and close the position. |
| type | STRING | LIMIT | The order type, possible types: LIMITLIMIT_MAKERMARKET_OF_BASE |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| timeInForce | STRING | GTC | Time in force for LIMIT orders. Possible values include: GTC,FOK,IOC,LIMIT_MAKER. |
| status | STRING | NEW | The state of the order. Possible values include: NEWPARTIALLY_FILLEDFILLEDCANCELEDPARTIALLY_CANCELEDREJECTED |
| priceType | STRING | INPUT | The price type. Possible values include INPUT and MARKET. |
| isLiquidationOrder | BOOLEAN | Whether the order is a liquidation order | |
| indexPrice | STRING | Index price. Available when isLiquidationOrder is true | |
| liquidationType | STRING | Available when isLiquidationOrder is trueLIQUIDATION_MAKER_ADLLIQUIDATION_MAKERLIQUIDATION_TAKER |
|
| ordCxlReason | STRING | USER_CANCEL | Order cancel reason |
| stpMode | STRING | Self Trade Prevention Mode. | |
| locked | STRING |
TYPE = STOP
{
"time": "1766456692298",
"updateTime": "1766457370108",
"orderId": "2111586213177732352",
"accountId": "1649292498437183234",
"clientOrderId": "99999999980009",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91500",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_CANCELED",
"stopPrice": "100000",
"stpMode": "EXPIRE_TAKER"
}
TYPE = STOP
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| accountId | STRING | 1649292498437183234 | Account ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| type | STRING | STOP | The order type, possible types: STOP |
| side | STRING | BUY | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| status | STRING | NEW | The state of the order. Possible values include: ORDER_NEWORDER_FILLEDORDER_REJECTEDORDER_CANCELEDORDER_FAILEDORDER_NOT_EFFECTIVE |
| stopPrice | STRING | 3000 | Average price of filled orders |
| stpMode | STRING | EXPIRE_TAKER | Self Trade Prevention Mode. |
Query Open Futures Order
GET /api/v1/futures/openOrders
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract | |
| fromOrderId | INTEGER | Default 0 | From Order ID. For exmaple, OrderIds:1004,1003,1002,1001, if fromOrderId=1003, then 1002 and 1001 will be returned |
|
| type | STRING | Y | The order type, possible types: LIMIT and STOP |
|
| limit | INTEGER | 20 | Number of entries to return, Max 500. | |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
TYPE = LIMIT
[
{
"time": "1766462203737",
"updateTime": "1766462203760",
"orderId": "2111632446428620288",
"clientOrderId": "test122322",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91252",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "18.2504",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "NEW",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER",
"locked": "1"
},
{
"time": "1766462203688",
"updateTime": "1766462203722",
"orderId": "2111632445984024064",
"clientOrderId": "test122311",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91251",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "18.2502",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "NEW",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER",
"locked": "1"
}
]
TYPE = LIMIT
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when the order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| executedQty | STRING | 0 | Quantity of orders that has been executed |
| avgPrice | STRING | 0 | Average price of filled orders. |
| marginLocked | STRING | 6000 | Amount of margin locked for this order. This includes the actually margin needed plus fees to open and close the position. |
| type | STRING | LIMIT | The order type, possible types: LIMITLIMIT_MAKERMARKET_OF_BASE |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| timeInForce | STRING | GTC | Time in force for LIMIT orders. Possible values include: GTC,FOK,IOC,LIMIT_MAKER. |
| status | STRING | NEW | The state of the order. Possible values include: NEWPARTIALLY_FILLEDFILLEDCANCELEDPARTIALLY_CANCELEDREJECTED |
| priceType | STRING | INPUT | The price type. Possible values include INPUT and MARKET. |
| isLiquidationOrder | BOOLEAN | Whether the order is a liquidation order | |
| indexPrice | STRING | Index price. Available when isLiquidationOrder is true | |
| liquidationType | STRING | Available when isLiquidationOrder is trueLIQUIDATION_MAKER_ADLLIQUIDATION_MAKERLIQUIDATION_TAKER |
|
| ordCxlReason | STRING | USER_CANCEL | Order cancel reason |
| stpMode | STRING | Self Trade Prevention Mode. | |
| locked | STRING |
TYPE = STOP
[
{
"time": "1766462557553",
"updateTime": "1766462557553",
"orderId": "2111635414502747392",
"accountId": "1649292498437183234",
"clientOrderId": "99999999980006",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91256",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_NEW",
"stopPrice": "100000",
"stpMode": "EXPIRE_TAKER"
},
{
"time": "1766462546968",
"updateTime": "1766462546968",
"orderId": "2111635325709331712",
"accountId": "1649292498437183234",
"clientOrderId": "99999999980005",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91255",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_NEW",
"stopPrice": "100000",
"stpMode": "EXPIRE_TAKER"
},
{
"time": "1766387741913",
"updateTime": "1766387741913",
"orderId": "2111007815426518272",
"accountId": "1649292498437183234",
"clientOrderId": "999999999122202",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91252",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_NEW",
"stopPrice": "91260",
"stpMode": "EXPIRE_TAKER"
}
]
TYPE = STOP
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| accountId | STRING | 1649292498437183234 | Account ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| type | STRING | STOP | The order type, possible types: STOP |
| side | STRING | BUY | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| status | STRING | NEW | The state of the order. Possible values include: ORDER_NEWORDER_FILLEDORDER_REJECTEDORDER_CANCELEDORDER_FAILEDORDER_NOT_EFFECTIVE |
| stopPrice | STRING | 3000 | Average price of filled orders |
| stpMode | STRING | EXPIRE_TAKER | Self Trade Prevention Mode. |
Query Futures Trades
GET /api/v1/futures/userTrades
- Cover Futures trading records only, for Spot trading records see: Get-Account-Trade-List
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract |
| limit | INTEGER | 20 | The number of trades returned default 20 (max to 1000) | |
| fromId | LONG | TradeId to retrieve from | ||
| toId | LONG | TradeId to retrieve to | ||
| startTime | LONG | Start Timestamp, Only supports the last 30 days timeframe | ||
| endTime | LONG | End Timestamp | ||
| recvWindow | LONG | recv Window | ||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
[
{
"time": "1766473927096",
"tradeId": "2111730810566551040",
"orderId": "2111730788798113280",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91439",
"quantity": "2",
"commissionAsset": "USDT",
"commission": "0.1097268",
"makerRebate": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"realizedPnl": "0",
"isMaker": false,
"ticketId": "2111730789141266436"
},
{
"time": "1766473927095",
"tradeId": "2111730809266316800",
"orderId": "2111730788798113280",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91437.8",
"quantity": "4",
"commissionAsset": "USDT",
"commission": "0.21945072",
"makerRebate": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"realizedPnl": "0",
"isMaker": false,
"ticketId": "2111730789132877869"
},
{
"time": "1766473927095",
"tradeId": "2111730807815087616",
"orderId": "2111730788798113280",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91437.4",
"quantity": "5",
"commissionAsset": "USDT",
"commission": "0.2743122",
"makerRebate": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"realizedPnl": "0",
"isMaker": false,
"ticketId": "2111730789132877864"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714359493905 | Timestamp when the order is created |
| tradeId | STRING | 1674563238321331712 | The ID for the trade |
| orderId | STRING | 1673994449678549760 | The ID of the order |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3250 | Price of the trade. |
| quantity | STRING | 120 | Quantity of the trade. |
| commissionAsset | STRING | USDT | Currency of commission fee |
| commission | STRING | 0.234 | Commission fee |
| makerRebate | STRING | 0 | Return |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| type | STRING | LIMIT | The order type, possible types: LIMIT, MARKET |
| realizedPnl | STRING | 0 | Profit and loss |
| isMarker | BOOLEAN | true | Whether the trade is a maker |
| ticketId | STRING | 1863037473639448576 | The Matching ID for the trade. Both maker and taker share the same ticketId for a single trade. |
Query Futures Positions
GET /api/v1/futures/positions
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. Return results for all symbols if not specified | |
| side | STRING | LONG | LONG or SHORT. Direction of the position. If not sent, positions for both sides will be returned. |
|
| recvWindow | LONG | 5000 | recv window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
[
{
"symbol": "BTCUSDT-PERPETUAL",
"side": "LONG",
"avgPrice": "91435.1",
"position": "59",
"available": "60",
"leverage": "5",
"lastPrice": "87561.6",
"positionValue": "5394.6758",
"liquidationPrice": "-16858442.6",
"margin": "1075.7551",
"marginRate": "0",
"unrealizedPnL": "-213.0409",
"profitRate": "-0.1974",
"realizedPnL": "-3.2368",
"minMargin": "0",
"updateTime": "1766473929707",
"marginType": "CROSS",
"reducibleQty": "0"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | BTCUSDT-PERPETUAL | Name of the contract. Return results for all symbols if not specified |
| side | STRING | LONG | Position side, LONG or SHORT |
| avgPrice | STRING | 100 | Average price for opening the position. |
| position | STRING | 20 | Amount of contracts opened |
| available | STRING | 15 | Amount of contracts available to close |
| leverage | STRING | 5 | Leverage of the position |
| lastPrice | STRING | 100 | Last trade price of the symbol |
| positionValue | STRING | 2000 | Current position value. |
| liquidationPrice | STRING | 80 | Forced liquidation price |
| margin | STRING | 20 | Margin for this position. |
| marginRate | STRING | 0.2 | Margin rate for current position |
| profitRate | STRING | 0.0000333 | Rate of return for the position |
| unrealizedPnL | STRING | 0 | Unrealized profit and loss for current position held |
| realizedPnL | STRING | 6.8 | Cumulative realized profit and loss for this symbol |
| marginType | STRING | ISOLATED | Margin type. Possible values include CROSS, ISOLATED |
| minMargin | STRING | 2334.344 | {Depreciated} Min margin. Implies the maximun value allowed for deduction. Will rename to"reducibleQty" next iteration |
| reducibleQty | STRING | 2334.344 | Min margin. Implies the maximun value allowed for deduction. |
| updateTime | STRING | 1766473929707 | Update time |
Change Margin Type
POST /api/v1/futures/marginType
Change the user's margin mode on the specified symbol contract: isolated margin or cross margin.
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract. |
| marginType | STRING | Y | CROSS | Margin type. Possible values include CROSS, ISOLATED |
| recvWindow | LONG | 5000 | recv window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"code": "0000",
"symbolId": "ETHUSDT-PERPETUAL",
"marginType": "CROSS"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | STRING | 0000 | Return code of request |
| symbol | STRING | BTCUSDT-PERPETUAL | Name of the contract. |
| marginType | STRING | CROSS | Margin type. Possible values include CROSS, ISOLATED. |
Modify Isolated Position Margin
POST /api/v1/futures/positionMargin
Change the user's isolated position margin.
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract. |
| side | ENUM | Y | SHORT | Position side. Possible values include LONG、 SHORT |
| amount | DECIMAL | Y | -12344.345 | Increase (positive value) or decrease (negative value) the amount of margin. Please note that this quantity refers to the underlying pricing asset of the contract (that is, the underlying of the contract settlement) |
| recvWindow | LONG | 5000 | recv window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"code": "0000",
"symbol":"BTCUSDT-PERPETUAL",
"margin":"12344.345",
"timestamp":"1726869763318"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| code | STRING | 0000 | Return code of request |
| symbol | STRING | BTCUSDT-PERPETUAL | Name of the contract. |
| margin | STRING | 12344.345 | Position margin |
| timestamp | LONG | 1726869763318 | Timestamp |
Query Futures History Orders
GET /api/v1/futures/historyOrders
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | Name of the contract | |
| fromOrderId | INTEGER | From Order ID. For exmaple, OrderIds:1004,1003,1002,1001, if fromOrderId=1003, then 1002 and 1001 will be returned |
||
| type | STRING | Y | The order type, possible types: LIMIT, STOP |
|
| startTime | LONG | Start Timestamp | ||
| endTime | LONG | End Timestamp | ||
| limit | INTEGER | 20 | Number of entries to return, max 500 | |
| recvWindow | LONG | recv Window | ||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
TYPE = LIMIT
[
{
"time": "1766386468962",
"updateTime": "1766395347052",
"orderId": "2110997137047234048",
"clientOrderId": "999999999122202",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91251",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "CANCELED",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "USER_CANCEL",
"stpMode": "EXPIRE_MAKER",
"locked": "0"
},
{
"time": "1766383455843",
"updateTime": "1766395347052",
"orderId": "2110971860351002112",
"clientOrderId": "999999999122201",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91251",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "CANCELED",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "USER_CANCEL",
"stpMode": "EXPIRE_TAKER",
"locked": "0"
}
]
TYPE = LIMIT
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when the order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| executedQty | STRING | 0 | Quantity of orders that has been executed |
| avgPrice | STRING | 0 | Average price of filled orders. |
| marginLocked | STRING | 6000 | Amount of margin locked for this order. This includes the actually margin needed plus fees to open and close the position. |
| type | STRING | LIMIT | The order type, possible types: LIMITLIMIT_MAKERMARKET_OF_BASE |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| timeInForce | STRING | GTC | Time in force for LIMIT orders. Possible values include: GTC,FOK,IOC,LIMIT_MAKER. |
| status | STRING | NEW | The state of the order. Possible values include: NEWPARTIALLY_FILLEDFILLEDCANCELEDPARTIALLY_CANCELEDREJECTED |
| priceType | STRING | INPUT | The price type. Possible values include INPUT and MARKET. |
| isLiquidationOrder | BOOLEAN | Whether the order is a liquidation order | |
| indexPrice | STRING | Index price. Available when isLiquidationOrder is true | |
| liquidationType | STRING | Available when isLiquidationOrder is trueLIQUIDATION_MAKER_ADLLIQUIDATION_MAKERLIQUIDATION_TAKER |
|
| ordCxlReason | STRING | USER_CANCEL | Order cancel reason |
| stpMode | STRING | Self Trade Prevention Mode. | |
| locked | STRING |
TYPE = STOP
[
{
"time": "1766456692298",
"updateTime": "1766457370108",
"orderId": "2111586213177732352",
"accountId": "1649292498437183234",
"clientOrderId": "99999999980009",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91500",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_CANCELED",
"stopPrice": "100000",
"stpMode": "EXPIRE_TAKER"
},
{
"time": "1766387741913",
"updateTime": "1766478959961",
"orderId": "2111007815426518272",
"accountId": "1649292498437183234",
"clientOrderId": "999999999122202",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91252",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_CANCELED",
"stopPrice": "91260",
"stpMode": "EXPIRE_TAKER"
}
]
TYPE = STOP
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| accountId | STRING | 1649292498437183234 | Account ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| type | STRING | STOP | The order type, possible types: STOP |
| side | STRING | BUY | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| status | STRING | NEW | The state of the order. Possible values include: ORDER_NEWORDER_FILLEDORDER_REJECTEDORDER_CANCELEDORDER_FAILEDORDER_NOT_EFFECTIVE |
| stopPrice | STRING | 3000 | Average price of filled orders |
| stpMode | STRING | EXPIRE_TAKER | Self Trade Prevention Mode. |
Query Futures Account Balance
GET /api/v1/futures/balance
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| recvWindow | LONG | Recv Window. Default 5000 | ||
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"balance": "1000070.94955233",
"availableBalance": "998752.09256178",
"positionMargin": "1075.237",
"orderMargin": "0",
"asset": "USDT",
"crossUnRealizedPnl": "-220.7718"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| asset | STRING | USDT | Token Id |
| balance | STRING | 12345.1234 | Token balance |
| availableBalance | STRING | 10000 | Available balance, include cross unrealised PnL |
| positionMargin | STRING | 23.45 | Position Margin |
| orderMargin | STRING | 1234.45 | Order Margin |
| crossUnRealizedPnl | STRING | 12345 | Cross Unrealised PnL |
Get Liquidation Assign Status
GET /api/v1/futures/liquidationAssignStatus
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| subAccountId | LONG | 12345678 | Sub account ID | |
| recvWindow | LONG | recv Window | ||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
[
{
"status": "ACTIVE",
"minAccountBalance": "100000000",
"maintAccountBalance": "100000000",
"liqOrderLimitRatio": "1"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| status | STRING | ACTIVE | Assign Status: ACTIVE, INACTIVE |
| minAccountBalance | STRING | 100000000 | Min Account Balance to maintain ACTIVE status |
| maintAccountBalance | STRING | 100000000 | Maintenance Account Balance to maintain ACTIVE status |
| liqOrderLimitRatio | STRING | 1 | Liquidation order limit ratio |
Futures Reference Data
Query Futures Funding Rate
GET /api/v1/futures/fundingRate
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. Return results for all symbols if not specified | |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
[
{
"symbol": "ETHUSDT-PERPETUAL",
"rate": "-0.00375",
"nextSettleTime": "1766592000000"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract |
| rate | STRING | 0.0001 | The funding rate for this interval |
| nextSettleTime | STRING | 1714320000000 | Next fund fee settlement time |
Query Futures History Funding Rate
GET /api/v1/futures/historyFundingRate
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract. |
| fromId | LONG | 0 | Start Id | |
| endId | LONG | 0 | End Id | |
| limit | INTEGER | 20 | Returns the number of entries. Default 20. (Min 1 to Max 100) |
|
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
[
{
"id": "3032665",
"symbol": "ETHUSDT-PERPETUAL",
"settleTime": "1766563200000",
"settleRate": "-0.00375"
},
{
"id": "3032651",
"symbol": "ETHUSDT-PERPETUAL",
"settleTime": "1766534400000",
"settleRate": "-0.00375"
},
{
"id": "3032634",
"symbol": "ETHUSDT-PERPETUAL",
"settleTime": "1766505600000",
"settleRate": "-0.00375"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Arrays | ||
| id | STRING | 3032361 | Unique identifier |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract |
| settleTime | STRING | 1766016000000 | Capital rate settlement time |
| settleRate | STRING | -0.00375 | Fund rate |
Query Futures Risk Limit
GET /api/v1/futures/riskLimit
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract. |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
[
{
"riskLimitAmount": "1000.00",
"maintainMargin": "0.005",
"initialMargin": "0.10",
"side": "SELL_OPEN"
},
{
"riskLimitAmount": "1000.00",
"maintainMargin": "0.005",
"initialMargin": "0.10",
"side": "BUY_OPEN"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| riskLimitAmount | STRING | 1000.00 | Risk limit (Maximum position) |
| maintainMargin | STRING | 0.005 | Maintenance margin rate |
| initialMargin | STRING | 0.10 | Initial margin rate |
| side | STRING | SELL_OPEN | Side, possible side include: BUY_OPEN, SELL_OPEN |
Query Futures Commission Rate
GET /api/v1/futures/commissionRate
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract. |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"symbol": "BTCUSDT-PERPETUAL",
"openMakerFee": "0.00025",
"openTakerFee": "0.0006",
"closeMakerFee": "0.00025",
"closeTakerFee": "0.0006"
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract |
| openMakerFee | STRING | 0.0006 | The commission rate for opening pending orders |
| openTakerFee | STRING | 0.0006 | The commission rate for open position taker |
| closeMakerFee | STRING | 0.0006 | The commission rate for closing pending orders |
| closeTakerFee | STRING | 0.0006 | The commission rate for closing a taker order |
Query Futures Best Order
GET /api/v1/futures/getBestOrder
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract. |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
{
"bid": {
"time": "1765170387553",
"price": "91045.2",
"leftQty": "1",
"side": "BUY"
},
"ask": {
"time": "1765158076399",
"price": "91445.2",
"leftQty": "1",
"side": "SELL"
}
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| bid | Object | Best buy order info | |
| bid.time | STRING | 1551062936784 | |
| bid.price | STRING | 8200 | Order price |
| bid.leftQty | STRING | 8000 | Left Order quantity |
| bid.side | STRING | BUY | Buying and selling direction(BUY、SELL) |
| ask | Object | Best sell order info | |
| ask.time | STRING | 1551062936784 | |
| ask.price | STRING | 8200 | Order price |
| ask.leftQty | STRING | 8000 | Left Order quantity |
| ask.side | STRING | SELL | Buying and selling direction(BUY、SELL) |
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 | Y | 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
- Cover Spot trading record only, for Future trading records see: Query-Futures-Trades
- 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": "2108873677089089024",
"clientOrderId": "1766133332140288",
"ticketId": "4636458453587902466",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"orderId": "2108873672953505280",
"matchOrderId": "0",
"price": "112922.4",
"qty": "0.03157",
"commission": "5.347440252",
"commissionAsset": "USDT",
"time": "1766133332383",
"isBuyer": false,
"isMaker": false,
"fee": {
"feeCoinId": "USDT",
"feeCoinName": "USDT",
"fee": "5.347440252",
"originCoinId": "USDT",
"originCoinName": "USDT",
"originFee": "5.347440252"
},
"feeCoinId": "USDT",
"feeAmount": "5.347440252",
"makerRebate": "0",
"hskDeduct": false,
"hskDeductPrice": ""
},
{
"id": "2108873676543829504",
"clientOrderId": "1766133332140288",
"ticketId": "4636458453587902465",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"orderId": "2108873672953505280",
"matchOrderId": "0",
"price": "112922.4",
"qty": "0.035",
"commission": "5.928426",
"commissionAsset": "USDT",
"time": "1766133332383",
"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": ""
},
{
"id": "2108873674916439552",
"clientOrderId": "1766133332140288",
"ticketId": "4636458453587902464",
"symbol": "BTCUSDT",
"symbolName": "BTCUSDT",
"orderId": "2108873672953505280",
"matchOrderId": "0",
"price": "112922.4",
"qty": "0.03343",
"commission": "5.662493748",
"commissionAsset": "USDT",
"time": "1766133332382",
"isBuyer": false,
"isMaker": false,
"fee": {
"feeCoinId": "USDT",
"feeCoinName": "USDT",
"fee": "5.662493748",
"originCoinId": "USDT",
"originCoinName": "USDT",
"originFee": "5.662493748"
},
"feeCoinId": "USDT",
"feeAmount": "5.662493748",
"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 |
| 3 | Main Future Account |
| 5 | Custody Account |
| 6 | Fiat Account |
| 1 | Sub Main Trading Account |
| 3 | Sub Main Future 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": "1649292498437183232",
"accountLabel": "Main Trading Account",
"accountType": 1,
"accountIndex": 0,
"userId": "1649292498445571840"
},
{
"accountId": "1649292498437183234",
"accountLabel": "Main Future Account",
"accountType": 3,
"accountIndex": 0,
"userId": "1649292498445571840"
},
{
"accountId": "1649292498437183235",
"accountLabel": "Custody Account",
"accountType": 5,
"accountIndex": 0,
"userId": "1649292498445571840"
},
{
"accountId": "1649292498437183236",
"accountLabel": "Fiat Account",
"accountType": 6,
"accountIndex": 0,
"userId": "1649292498445571840"
},
{
"accountId": "1673782460192774144",
"accountLabel": "Sub Main Trading Account",
"accountType": 1,
"accountIndex": 0,
"userId": "1673782460159472128"
},
{
"accountId": "1673966708350661632",
"accountLabel": "Sub Main Future Account",
"accountType": 3,
"accountIndex": 0,
"userId": "1673782460159472128"
}
]
| 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 Fund Statement
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 | Default 20. Up to 1000 | |
| fromId | STRING | From FlowId | |
| endId | STRING | End FlowId | |
| flowType | INTEGER | Value 1 (Trade, recent-7-day data)Value 2 (FEE, recent-7-day data)Value 32 (Funding FEE, recent-30-day data)Value 51 (INTERNAL_ACCOUNT_TRANSFER, recent-30-day data)Value 900 (CUSTODY_DEPOSIT, recent-30-day data)Value 904 (CUSTODY_WITHDRAW, recent-30-day data) |
|
| accountType | INTEGER | Value 1 Trading Account Record (Spot)Value 3 Trading Account Record (Futures)Value 5 Custody Account Record |
|
| timestamp | LONG | Y | Timestamp |
Response Content
[
{
"id": "2112659076261422592",
"accountId": "1649292498437183232",
"coin": "BTC",
"coinId": "BTC",
"coinName": "BTC",
"flowTypeValue": 1,
"flowType": "TRADE",
"flowName": "",
"change": "-0.02657",
"total": "61.106456639",
"created": "1766584587213",
"symbol": "BTCUSDT"
}
]
[
{
"id": "2112659076278199808",
"accountId": "1649292498437183232",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 2,
"flowType": "FEE",
"flowName": "",
"change": "-4.500522252",
"total": "217656.5702165348009",
"created": "1766584587213",
"symbol": "BTCUSDT"
}
]
[
{
"id": "2112480170933822976",
"accountId": "1649292498437183234",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 32,
"flowType": "FUNDING_SETTLEMENT",
"flowName": "",
"change": "-0.51425641478",
"total": "1000069.4005962924527",
"created": "1766563260359",
"symbol": "BTCUSDT"
}
]
[
{
"id": "2112647482878010880",
"accountId": "1649292498437183232",
"coin": "USDT",
"coinId": "USDT",
"coinName": "USDT",
"flowTypeValue": 51,
"flowType": "USER_ACCOUNT_TRANSFER",
"flowName": "",
"change": "-0.01",
"total": "206381.2685765348009",
"created": "1766583205503",
"symbol": ""
}
]
| 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 (decimal) | 1689856479058 | Create Timestamp |
| symbol | STRING |
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 |
Get Sub Account Futures Open Orders
GET /api/v1/futures/subAccount/openOrders
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| subAccountId | STRING | Y | 1650801631044854016 | Sub Account ID |
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract |
| fromOrderId | INTEGER | Default 0 | From Order ID. For exmaple, OrderIds:1004,1003,1002,1001, if fromOrderId=1003, then 1002 and 1001 will be returned |
|
| type | STRING | Y | The order type, possible types: LIMIT and STOP |
|
| limit | INTEGER | 20 | Number of entries to return, Default 20, Max 1000. | |
| recvWindow | LONG | 5000 | recv Window | |
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
TYPE = LIMIT
[
{
"time": "1766587942726",
"updateTime": "1766587942819",
"orderId": "2112687221416994304",
"clientOrderId": "999999999800061224",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91100",
"leverage": "10",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "9.11",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "NEW",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "",
"stpMode": "EXPIRE_TAKER",
"locked": "1"
}
]
TYPE = LIMIT
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when the order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| executedQty | STRING | 0 | Quantity of orders that has been executed |
| avgPrice | STRING | 0 | Average price of filled orders. |
| marginLocked | STRING | 6000 | Amount of margin locked for this order. This includes the actually margin needed plus fees to open and close the position. |
| type | STRING | LIMIT | The order type, possible types: LIMITLIMIT_MAKERMARKET_OF_BASE |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| timeInForce | STRING | GTC | Time in force for LIMIT orders. Possible values include: GTC,FOK,IOC,LIMIT_MAKER. |
| status | STRING | NEW | The state of the order. Possible values include: NEWPARTIALLY_FILLEDFILLEDCANCELEDPARTIALLY_CANCELEDREJECTED |
| priceType | STRING | INPUT | The price type. Possible values include INPUT and MARKET. |
| isLiquidationOrder | BOOLEAN | Whether the order is a liquidation order | |
| indexPrice | STRING | Index price. Available when isLiquidationOrder is true | |
| liquidationType | STRING | Available when isLiquidationOrder is trueLIQUIDATION_MAKER_ADLLIQUIDATION_MAKERLIQUIDATION_TAKER |
|
| ordCxlReason | STRING | USER_CANCEL | Order cancel reason |
| stpMode | STRING | Self Trade Prevention Mode. | |
| locked | STRING |
TYPE = STOP
[
{
"time": "1766587911006",
"updateTime": "1766587911006",
"orderId": "2112686955481401088",
"accountId": "1695624199740137984",
"clientOrderId": "999999999800061224",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91100",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_NEW",
"stopPrice": "100000",
"stpMode": "EXPIRE_TAKER"
}
]
TYPE = STOP
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| accountId | STRING | 1649292498437183234 | Account ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| type | STRING | STOP | The order type, possible types: STOP |
| side | STRING | BUY | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| status | STRING | NEW | The state of the order. Possible values include: ORDER_NEWORDER_FILLEDORDER_REJECTEDORDER_CANCELEDORDER_FAILEDORDER_NOT_EFFECTIVE |
| stopPrice | STRING | 3000 | Average price of filled orders |
| stpMode | STRING | EXPIRE_TAKER | Self Trade Prevention Mode. |
Get Sub Account Futures History Orders
GET /api/v1/futures/subAccount/historyOrders
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| subAccountId | STRING | Y | 1650801631044854016 | Sub Account ID |
| symbol | STRING | Y | Name of the contract | |
| fromOrderId | INTEGER | From Order ID. For exmaple, OrderIds:1004,1003,1002,1001, if fromOrderId=1003, then 1002 and 1001 will be returned |
||
| type | STRING | Y | The order type, possible types: LIMIT, STOP |
|
| startTime | LONG | Start Timestamp, Only supports the last 90 days timeframe | ||
| endTime | LONG | End Timestamp | ||
| limit | INTEGER | 20 | Number of entries to return, max 500 | |
| recvWindow | LONG | recv Window | ||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
TYPE = LIMIT
[
{
"time": "1766386468962",
"updateTime": "1766395347052",
"orderId": "2110997137047234048",
"clientOrderId": "999999999122202",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91251",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "CANCELED",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "USER_CANCEL",
"stpMode": "EXPIRE_MAKER",
"locked": "0"
},
{
"time": "1766383455843",
"updateTime": "1766395347052",
"orderId": "2110971860351002112",
"clientOrderId": "999999999122201",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91251",
"leverage": "5",
"origQty": "1",
"executedQty": "0",
"avgPrice": "0",
"marginLocked": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"timeInForce": "GTC",
"status": "CANCELED",
"priceType": "INPUT",
"isLiquidationOrder": false,
"indexPrice": "0",
"liquidationType": "",
"ordCxlReason": "USER_CANCEL",
"stpMode": "EXPIRE_TAKER",
"locked": "0"
}
]
TYPE = LIMIT
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when the order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| executedQty | STRING | 0 | Quantity of orders that has been executed |
| avgPrice | STRING | 0 | Average price of filled orders. |
| marginLocked | STRING | 6000 | Amount of margin locked for this order. This includes the actually margin needed plus fees to open and close the position. |
| type | STRING | LIMIT | The order type, possible types: LIMITLIMIT_MAKERMARKET_OF_BASE |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| timeInForce | STRING | GTC | Time in force for LIMIT orders. Possible values include: GTC,FOK,IOC,LIMIT_MAKER. |
| status | STRING | NEW | The state of the order. Possible values include: NEWPARTIALLY_FILLEDFILLEDCANCELEDPARTIALLY_CANCELEDREJECTED |
| priceType | STRING | INPUT | The price type. Possible values include INPUT and MARKET. |
| isLiquidationOrder | BOOLEAN | Whether the order is a liquidation order | |
| indexPrice | STRING | Index price. Available when isLiquidationOrder is true | |
| liquidationType | STRING | Available when isLiquidationOrder is trueLIQUIDATION_MAKER_ADLLIQUIDATION_MAKERLIQUIDATION_TAKER |
|
| ordCxlReason | STRING | USER_CANCEL | Order cancel reason |
| stpMode | STRING | Self Trade Prevention Mode. | |
| locked | STRING |
TYPE = STOP
[
{
"time": "1766456692298",
"updateTime": "1766457370108",
"orderId": "2111586213177732352",
"accountId": "1649292498437183234",
"clientOrderId": "99999999980009",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91500",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_CANCELED",
"stopPrice": "100000",
"stpMode": "EXPIRE_TAKER"
},
{
"time": "1766387741913",
"updateTime": "1766478959961",
"orderId": "2111007815426518272",
"accountId": "1649292498437183234",
"clientOrderId": "999999999122202",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91252",
"leverage": "0",
"origQty": "1",
"type": "STOP",
"side": "BUY_OPEN",
"status": "ORDER_CANCELED",
"stopPrice": "91260",
"stpMode": "EXPIRE_TAKER"
}
]
TYPE = STOP
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714403283482 | Timestamp when order is created |
| updateTime | STRING | 1714403283501 | Last time this order was updated |
| orderId | STRING | 1674930571497840128 | Order ID |
| accountId | STRING | 1649292498437183234 | Account ID |
| clientOrderId | STRING | 99999999980001 | A unique ID of the order. |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3000 | Price of the order. |
| leverage | STRING | 5 | Leverage of the order. |
| origQty | STRING | 10000 | Quantity ordered |
| type | STRING | STOP | The order type, possible types: STOP |
| side | STRING | BUY | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| status | STRING | NEW | The state of the order. Possible values include: ORDER_NEWORDER_FILLEDORDER_REJECTEDORDER_CANCELEDORDER_FAILEDORDER_NOT_EFFECTIVE |
| stopPrice | STRING | 3000 | Average price of filled orders |
| stpMode | STRING | EXPIRE_TAKER | Self Trade Prevention Mode. |
Get Sub Account Futures Trades
GET /api/v1/futures/subAccount/userTrades
Weight: 1
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| subAccountId | STRING | Y | 1650801631044854016 | Sub Account ID |
| symbol | STRING | Y | ETHUSDT-PERPETUAL | Name of the contract |
| limit | INTEGER | 20 | The number of trades returned default 20 (max to 1000) | |
| fromId | LONG | TradeId to retrieve from | ||
| toId | LONG | TradeId to retrieve to | ||
| startTime | LONG | Start Timestamp, Only supports the last 30 days timeframe | ||
| endTime | LONG | End Timestamp | ||
| recvWindow | LONG | recv Window | ||
| timestamp | LONG | Y | 1714311403031 | Timestamp |
Response Content
[
{
"time": "1766589158703",
"tradeId": "2112697422803183104",
"orderId": "2112697421712664064",
"symbol": "BTCUSDT-PERPETUAL",
"price": "91445.2",
"quantity": "1",
"commissionAsset": "USDT",
"commission": "0.05486712",
"makerRebate": "0",
"type": "LIMIT",
"side": "BUY_OPEN",
"realizedPnl": "0",
"isMaker": false,
"ticketId": "2112697421921599488"
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| time | STRING | 1714359493905 | Timestamp when the order is created |
| tradeId | STRING | 1674563238321331712 | The ID for the trade |
| orderId | STRING | 1673994449678549760 | The ID of the order |
| symbol | STRING | ETHUSDT-PERPETUAL | Name of the contract. |
| price | STRING | 3250 | Price of the trade. |
| quantity | STRING | 120 | Quantity of the trade. |
| commissionAsset | STRING | USDT | Currency of commission fee |
| commission | STRING | 0.234 | Commission fee |
| makerRebate | STRING | 0 | Return |
| side | STRING | BUY_OPEN | Direction of the order. Possible values include: BUY_OPENSELL_OPENBUY_CLOSESELL_CLOSE |
| type | STRING | LIMIT | The order type, possible types: LIMIT, MARKET |
| realizedPnl | STRING | 0 | Profit and loss |
| isMarker | BOOLEAN | true | Whether the trade is a maker |
| ticketId | STRING | 1863037473639448576 | The Matching ID for the trade. Both maker and taker share the same ticketId for a single trade. |
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. |
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": "BTC",
"coinName": "BTC",
"chainTypeList": [
"BTC"
]
}
]
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| * | Object Array | ||
| coinId | STRING | BTC | Coin Name |
| coinName | STRING | BTC | Coin Name |
| chainTypeList | LIST | ["BTC"] | List of supported chain types. |
Public Market Data (Spot & Futures)
✅ 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", "BTCUSDT-PERPETUAL", "ETHUSDT-PERPETUAL" |
Response Content
{
"symbol": "BTCUSDT-PERPETUAL",
"symbolName": "BTCUSDT-PERPETUAL",
"status": "TRADING",
"baseAsset": "BTCUSDT-PERPETUAL",
"baseAssetName": "BTCUSDT-PERPETUAL",
"baseAssetPrecision": "0.001",
"baseUcid": "",
"quoteAsset": "USDT",
"quoteAssetName": "USDT",
"quotePrecision": "0.00000001",
"quoteUcid": "",
"retailAllowed": false,
"piAllowed": false,
"corporateAllowed": false,
"omnibusAllowed": false,
"icebergAllowed": false,
"isAggregate": false,
"allowMargin": false,
"filters": [
{
"minPrice": "0.1",
"maxPrice": "100000.00000000",
"tickSize": "0.1",
"filterType": "PRICE_FILTER"
},
{
"minQty": "0.001",
"maxQty": "10",
"stepSize": "0.001",
"marketOrderMinQty": "0.001",
"marketOrderMaxQty": "3",
"filterType": "LOT_SIZE"
},
{
"minNotional": "0",
"filterType": "MIN_NOTIONAL"
},
{
"maxSellPrice": "999999",
"buyPriceUpRate": "0.03",
"sellPriceDownRate": "0.03",
"maxEntrustNum": 200,
"maxConditionNum": 200,
"filterType": "LIMIT_TRADING"
},
{
"buyPriceUpRate": "0.03",
"sellPriceDownRate": "0.03",
"filterType": "MARKET_TRADING"
},
{
"noAllowMarketStartTime": "0",
"noAllowMarketEndTime": "0",
"limitOrderStartTime": "0",
"limitOrderEndTime": "0",
"limitMinPrice": "0",
"limitMaxPrice": "0",
"filterType": "OPEN_QUOTE"
}
],
"site": "BMU"
}
| 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 | |
| contracts.exchangeId | STRING | 301 | Exchange Id |
| contracts.symbol | STRING | BTCUSD | Currency pair |
| contracts.symbolName | STRING | BTCUSD | Currency pair |
| contracts.status | ENUM | TRADING | Trading pair status |
| contracts.baseAsset | STRING | BTC | Base Asset |
| contracts.baseAssetPrecision | STRING | 0.00001 | Precision of base asset |
| contracts.quoteAsset | STRING | USD | Quoted Asset |
| contracts.quotePrecision | STRING | 0.00000001 | Precision of quoted asset |
| contracts.icebergAllowed | BOOLEAN | false | Currently not in use |
| contracts.inverse | BOOLEAN | false | Whether it is an inverse contract |
| contracts.index | STRING | USDT | The settlement or reference index. |
| contracts.marginToken | STRING | USDT | The currency used for margin. |
| contracts.marginPrecision | STRING | 0.0001 | Precision for margin values. |
| contracts.contractMultiplier | STRING | 0.001 | Contract multiplier |
| contracts.underlying | STRING | BTC | |
| contracts.filters | Object Array | List of trading pair restrictions | |
| contracts.filters.filterType=PRICE_FILTER | STRING | PRICE_FILTER | Trading restriction type refer to appendix "Trading restriction type" |
| contracts.filters.minPrice | STRING | 0.01 | Depreciated, no longer in-use |
| contracts.filters.maxPrice | STRING | 100000.00000000 | Depreciated, no longer in-use |
| contracts.filters.tickSize | STRING | 0.01 | Minimum price change, only for PRICE_FILTER types |
| contracts.filters.filterType=LOT_SIZE | STRING | LOT_SIZE | Trading restriction type |
| contracts.filters.minQty | STRING | 0.0003 | Minimum number of transactions, only for LOT_SIZE types / 最小交易量 |
| contracts.filters.maxQty | STRING | 4 | Maximum number of transactions, only for LOT_SIZE types / 最大交易量 |
| contracts.filters.stepSize | STRING | 0.00001 | Minimal change in quantity, only used for LOT_SIZE types |
| contracts.filters.marketOrderMinQty | STRING | 1 | Minimum no. of coin for base Asset allowed for Market Order |
| contracts.filters.marketOrderMaxQty | STRING | 10000 | Maximum no. of coin for base Asset allowed Market Orders |
| contracts.filters.filterType=MIN_NOTIONAL | STRING | MIN_NOTIONAL | |
| contracts.filters.minNotional | STRING | 10 | Minimum notional turnover, only for MIN_NOTIONAL types |
| contracts.filters.filterType=LIMIT_TRADING | STRING | ||
| contracts.filters.maxSellPrice | STRING | 0 | Depreciated, no longer in-use |
| contracts.filters.buyPriceUpRate ("filterType": "LIMIT_TRADING") | STRING | 0.2 | Limit Buy cannot be higher than the mark price / 买入不能高于标记价格 |
| contracts.filters.sellPriceDownRate ("filterType": "LIMIT_TRADING") | STRING | 0.2 | Limit Sell cannot be lower than the mark price / 卖出不能低于标记价格 |
| contracts.filters.maxEntrustNum ("filterType": "LIMIT_TRADING") | INTEGER | 200 | Maximum number of active limit orders |
| contracts.filters.maxConditionNum ("filterType": "LIMIT_TRADING") | INTEGER | 200 | Maximum number of active conditional orders |
| contracts.filters.filterType=MARKET_TRADING | STRING | ||
| contracts.filters.buyPriceUpRate ("filterType": "MARKET_TRADING") | STRING | 0.2 | Market buy cannot be higher than the mark price / 买入不能高于标记价格 |
| contracts.filters.sellPriceDownRate ("filterType": "MARKET_TRADING") | STRING | 0.2 | Market sell cannot be lower than the mark price / 卖出不能低于标记价格 |
| contracts.filters.filterType=OPEN_QUOTE | STRING | ||
| contracts.filters.noAllowMarketStartTime | STRING | 1668483032058 | Market order start time is not allowed, only for OPEN_QUOTE types |
| contracts.filters.noAllowMarketEndTime | STRING | 1668483032058 | Market order end time is not allowed, only for OPEN_QUOTE types |
| contracts.filters.limitOrderStartTime | STRING | 1668483032058 | Time limit order start time, only for OPEN_QUOTE types |
| contracts.filters.limitOrderEndTime | STRING | 1668483032058 | Time limit order end time, only for OPEN_QUOTE types |
| contracts.filters.limitMinPrice | STRING | 0.1 | Lowest price for a limited time limit order, only for OPEN_QUOTE types |
| contracts.filters.limitMaxPrice | STRING | 1000 | Limit order maximum price, only for OPEN_QUOTE types |
| contracts.riskLimits | Object Array | Margin requirements based on position size | |
| contracts.riskLimits.riskLimitId | STRING | 200010463 | Risk limit Id |
| contracts.riskLimits.quantity | STRING | 1000.00 | Position Quantity |
| contracts.riskLimits.initialMargin | STRING | 0.05 | Initial Margin Ratio |
| contracts.riskLimits.maintMargin | STRING | 0.005 | Maintenance Margin Ratio |
| contracts.riskLimits.isWhite | BOOLEAN | false | Limits apply to regular users |
| contracts.tradeStatus | STRING | TRADABLE | Trade Status |
| options | Object Array | Not currently in use | |
| site | STRING | BMU | Site |
Get Coin Information
GET /api/v1/coinInfo
Get the supported list of coin information such as withdrawal fee, min/max deposit or withdrawal quantity
Request Parameters
| PARAMETER | TYPE | Req'd | DESCRIPTION |
|---|---|---|---|
| coinId | STRING | C | Coin Name. e.g: "BTC", "ETH" |
Response Content
{
"timezone": "UTC",
"serverTime": 1766717615319,
"coins": [
{
"orgId": 9001,
"coinId": "BTC",
"coinName": "BTC",
"coinFullName": "Bitcoin",
"allowWithdraw": true,
"allowDeposit": true,
"cmcId": "",
"chainTypes": [
{
"chainType": "Bitcoin",
"withdrawFee": "0.00008",
"minWithdrawQuantity": "0.0004",
"maxWithdrawQuantity": "0",
"minDepositQuantity": "0.0005",
"allowDeposit": true,
"allowWithdraw": true
},
{
"chainType": "Merlin Chain",
"withdrawFee": "0.00001",
"minWithdrawQuantity": "0.00002",
"maxWithdrawQuantity": "0",
"minDepositQuantity": "0.00002",
"allowDeposit": false,
"allowWithdraw": false
}
]
}
]
}
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| timezone | STRING | UTC | Timezone |
| serverTime | LONG | 1727068513801 | Server Millisecond Timestamp |
| coins | Object Array | ||
| coins.orgId | 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 |
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 |
| ... |
Get Mark Price
GET /quote/v1/markPrice
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | Y | ETHUSD | Currency pair |
Response Content
{
"exchangeId": 301,
"symbolId": "BTCUSDT-PERPETUAL",
"price": "88752.8",
"time": 1766719381000
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| exchangeId | LONG | 301 | Exchange id |
| symbolId | STRING | BTCUSDT-PERPETUAL | Symbol |
| price | STRING | 59363.009693333333273969 | Mark price |
| time | LONG | 1714662274000 | Time |
Get Index Price
GET /quote/v1/index
Request Parameters
| PARAMETER | TYPE | Req'd | Example values | DESCRIPTION |
|---|---|---|---|---|
| symbol | STRING | ETHUSD | Currency pair |
Response Content
{
"index": {
"BTCUSDT": "88872.674"
},
"edp": {
"BTCUSDT": "88871.27269"
}
}
| PARAMETER | TYPE | Example values | DESCRIPTION |
|---|---|---|---|
| index | OBJECT | Index Price | |
| BTCUSDT | STRING | 88872.674 | |
| ... | |||
| edp | OBJECT | The average of the index for the last 10 minutes | |
| BTCUSDT | STRING | 88871.27269 | |
| ... |
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-glb.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-HK-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-glb.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-glb.sim.hashkeydev.com/quote/ws/v1 - MarketData public stream V2:
wss://stream-glb.sim.hashkeydev.com/quote/ws/v2 - Private stream:
wss://stream-glb.sim.hashkeydev.com/api/v1/ws/{listenKey}
Production Environment
- MarketData public stream V1:
wss://stream-glb.hashkey.com/quote/ws/v1 - MarketData public stream V2:
wss://stream-glb.hashkey.com/quote/ws/v2 - Private stream:
wss://stream-glb.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-glb.sim.hashkeydev.com/quote/ws/v1orwss://stream-glb.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-glb.sim.hashkeydev.com/quote/ws/v1 - Production:
wss://stream-glb.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-glb.sim.hashkeydev.com/quote/ws/v2 - Production:
wss://stream-glb.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-glb.sim.hashkeydev.com/api/v1/ws/{listenKey} - Production:
wss://stream-glb.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": "outboundContractAccountInfo",
"E": "1766730154347",
"T": true,
"W": true,
"D": true,
"B": [
{
"a": "USDT",
"f": "9972.456",
"l": "27.39031752444795",
"r": "",
"v": "0"
}
]
}
]
WS Push Parameter
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | ||
| e | STRING | outboundAccountInfo | Event type:outboundAccountInfooutboundContractAccountInfooutboundCustodyAccountInfooutboundFiatAccountInfooutboundOptAccountInfo |
| 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": ""
}
]
[
{
"e": "contractExecutionReport",
"E": "1766730154345",
"s": "BTCUSDT-PERPETUAL",
"c": "99999999980006",
"S": "BUY_OPEN",
"o": "LIMIT",
"f": "GTC",
"q": "1",
"p": "91448",
"X": "FILLED",
"i": "2113880177188611584",
"l": "1",
"z": "1",
"L": "91446.4",
"n": "0.05486784",
"N": "USDT",
"u": true,
"w": true,
"m": false,
"O": "1766730154131",
"Z": "91446.4",
"C": false,
"v": "10",
"reqAmt": "0",
"d": "2113880177884866048",
"r": "0",
"V": "91446.4",
"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": "BTCUSDT-PERPETUAL",
"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 | ETHUSD | 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 |
Position Push
[
{
"e": "outboundContractPositionInfo",
"E": "1766730154352",
"A": "1695624199740137984",
"s": "BTCUSDT-PERPETUAL",
"S": "LONG",
"p": "91445.8",
"P": "2",
"a": "2",
"f": "0",
"m": "18.1357",
"r": "-0.1097",
"up": "-4.2345",
"pr": "-0.2315",
"pv": "182.8916",
"v": "10.00",
"mt": "CROSS",
"mm": "0",
"d": "11",
"u": "1766730154294"
}
]
WS Push Parameter
| PARAMETER | TYPE | Example Values | DESCRIPTION |
|---|---|---|---|
| - | Object Array | ||
| e | STRING | outboundContractPositionInfo | |
| E | STRING | 1764936108760 | Event timeStamp |
| A | STRING | 1695624199740137984 | Account ID |
| s | STRING | BTCUSDT-PERPETUAL | Symbol |
| S | STRING | LONG | Side, LONG or SHORT |
| p | STRING | 91445.8 | Average price |
| P | STRING | 2 | Total position |
| a | STRING | 2 | Available position |
| f | STRING | 0 | Liquidation price |
| m | STRING | 18.1357 | Portfolio margin |
| r | STRING | -0.1097 | Realised profit and loss (Pnl) |
| up | STRING | -4.2345 | Unrealized profit and loss (unrealizedPnL) |
| pr | STRING | -0.2315 | Profit rate of current position |
| pv | STRING | 182.8916 | Position value (USDT) |
| v | STRING | 10.00 | Leverage |
| mt | STRING | CROSS | Position type |
| mm | STRING | 0 | Min margin |
| d | STRING | 11 | Data version |
| u | STRING | 1766730154294 | Update time |