### Subscribe to Data Channels with wscat Source: https://ascendex.github.io/ascendex-pro-api/index Connects to the Ascendex Pro WebSocket stream and subscribes to data channels. Requires the wscat tool to be installed. Examples include subscribing to 'depth:ASD/USDT' and 'bbo:BTC/USDT'. ```shell # Install wscat from Node.js if you haven't npm install -g wscat # Connect to websocket wscat -c wss://ascendex.com/0/api/pro/v1/stream -x '{"op":"sub", "ch": "depth:ASD/USDT"}' ``` -------------------------------- ### List All Assets with cURL Source: https://ascendex.github.io/ascendex-pro-api/index An example using cURL to fetch a list of all assets available on the AscendEX exchange. This is a public API endpoint and does not require authentication. ```curl curl -X GET "https://ascendex.com/api/pro/v2/assets" ``` -------------------------------- ### GET /api/pro/v1/barhist/info Source: https://ascendex.github.io/ascendex-pro-api/index This API returns a list of all bar intervals supported by the server, including their names and lengths in milliseconds. ```APIDOC ## GET /api/pro/v1/barhist/info ### Description This API returns a list of all bar intervals supported by the server. ### Method GET ### Endpoint /api/pro/v1/barhist/info ### Parameters #### Query Parameters This API endpoint does not take any parameters. ### Response #### Success Response (200) - **name** (String) - Name of the interval (e.g., "1", "5", "1d"). This value should be used as input to the Historical Bar Data API. - **intervalInMillis** (Long) - Length of the interval in milliseconds. Note that the one-month bar (`1m`) interval is indicative, and the actual reset time is at the month start. #### Response Example ```json { "code": 0, "data": [ { "name": "1", "intervalInMillis": 60000 }, { "name": "5", "intervalInMillis": 300000 }, { "name": "1d", "intervalInMillis": 86400000 }, { "name": "1m", "intervalInMillis": 2592000000 } ] } ``` ``` -------------------------------- ### Get Open Orders (Python) Source: https://ascendex.github.io/ascendex-pro-api/index This Python code snippet demonstrates how to retrieve a list of open orders from the AscendEX Pro API. It requires proper authentication and constructs the request URL. ```python import requests import json # Replace with your actual API key and secret api_key = "YOUR_API_KEY" api_secret = "YOUR_API_SECRET" base_url = "https://api.ascendex.com" timestamp = int(time.time() * 1000) # Construct the prehash string for signing prehash_string = f"{timestamp}+order/open" # Generate the signature (implementation depends on your signing method) signature = generate_signature(prehash_string, api_secret) headers = { "x-auth-key": api_key, "x-auth-signature": signature, "x-auth-timestamp": str(timestamp) } url = f"{base_url}/api/pro/v1/order/open" try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes orders = response.json() print(json.dumps(orders, indent=4)) except requests.exceptions.RequestException as e: print(f"Error fetching open orders: {e}") def generate_signature(message, secret): # Placeholder for signature generation logic # This typically involves HMAC-SHA256 import hmac import hashlib return hmac.new(secret.encode('utf-8'), message.encode('utf-8'), hashlib.sha256).hexdigest() ``` -------------------------------- ### List All Products (Cash and Margin) Source: https://ascendex.github.io/ascendex-pro-api/index This endpoint allows you to retrieve a list of all products available on the AscendEX exchange for both cash and margin trading. It requires a GET request to the specified API paths. ```curl curl -X GET "https://ascendex.com/api/pro/v1/cash/products" curl -X GET "https://ascendex.com/api/pro/v1/margin/products" ``` -------------------------------- ### GET /api/pro/v2/assets Source: https://ascendex.github.io/ascendex-pro-api/index Retrieve a list of all assets supported by the AscendEX exchange. This endpoint does not require authentication. ```APIDOC ## Market Data (Public) You don't need to sign the request to access public market data. ### List all Assets #### HTTP Request `GET /api/pro/v2/assets` #### Description You can obtain a list of all assets listed on the exchange through this API. #### Request Example ```bash curl -X GET "https://ascendex.com/api/pro/v2/assets" ``` #### Response Example (Success Response - 200) ```json { "code": 0, "data": [ { "assetCode": "USDT", "assetName": "Tether", "precisionScale": 9, "nativeScale": 4, "blockChain": [ { "chainName": "Omni", "withdrawFee": "30.0", "allowDeposit": true, "allowWithdraw": true, "minDepositAmt": "0.0", "minWithdrawal": "50.0", "numConfirmations": 3 }, { "chainName": "ERC20", "withdrawFee": "10.0", "allowDeposit": true, "allowWithdraw": true, "minDepositAmt": "0.0", "minWithdrawal": "20.0", "numConfirmations": 12 } ] } ] } ``` #### Response Fields (Success Response - 200) - **code** (integer) - Indicates the result of the request. `0` signifies success. - **data** (array) - An array of asset objects. - **assetCode** (string) - The unique code for the asset. - **assetName** (string) - The full name of the asset. - **precisionScale** (integer) - The precision scale for the asset. - **nativeScale** (integer) - The native scale for the asset. - **blockChain** (array) - An array of blockchain details for the asset. - **chainName** (string) - The name of the blockchain. - **withdrawFee** (string) - The fee for withdrawing the asset on this chain. - **allowDeposit** (boolean) - Whether deposits are allowed on this chain. - **allowWithdraw** (boolean) - Whether withdrawals are allowed on this chain. - **minDepositAmt** (string) - The minimum deposit amount for this chain. - **minWithdrawal** (string) - The minimum withdrawal amount for this chain. - **numConfirmations** (integer) - The number of confirmations required for transactions on this chain. ``` -------------------------------- ### Get VIP Fee Schedule Source: https://ascendex.github.io/ascendex-pro-api/index Retrieve the general VIP fee schedule for spot trading, including maker and taker fees for large and small cap assets. ```APIDOC ## GET /api/pro/v1/spot/fee/info ### Description See a demo at query fee. ### Method GET ### Endpoint `//api/pro/v1/spot/fee/info` ### Parameters #### Path Parameters - **account-group** (String) - Required - Your account group identifier. #### Query Parameters - **timestamp** (Long) - Required - UTC timestamp in milliseconds - **signature** (String) - Required - Signature generated according to the authentication method. ### Request Body None ### Response #### Success Response (200) - **code** (Int) - Response code - **data** (Json) - Fee schedule details - **domain** (String) - Trading domain (e.g., "spot") - **userUID** (String) - User's unique ID - **vipLevel** (Int) - User's VIP level - **genericFee** (Json) - General fee structure - **largeCap** (Json) - Fees for large cap assets - **maker** (String) - Maker fee rate - **taker** (String) - Taker fee rate - **smallCap** (Json) - Fees for small cap assets - **maker** (String) - Maker fee rate - **taker** (String) - Taker fee rate #### Response Example ```json { "code": 0, "data": { "domain": "spot", "userUID": "U0866943712", "vipLevel": 0, "genericFee": { "largeCap": { "maker": "0.00085", "taker": "0.00085" }, "smallCap": { "maker": "0.001", "taker": "0.001" } } } } ``` ``` -------------------------------- ### Get Account Info Source: https://ascendex.github.io/ascendex-pro-api/index Obtain account information, including account group, email, API key expiration, allowed IPs, and permission settings. ```APIDOC ## GET /api/pro/v1/info ### Description Obtain the account information. You can obtain your `accountGroup` from this API, which you will need to include in the URL for all your private RESTful requests. ### Method GET ### Endpoint `/api/pro/v1/info` ### Parameters #### Query Parameters - **timestamp** (Long) - Required - UTC timestamp in milliseconds - **signature** (String) - Required - Signature generated according to the authentication method. ### Request Body None ### Response #### Success Response (200) - **code** (Int) - Response code - **data** (Json) - Account details - **accountGroup** (Int) - non-negative integer - **email** (String) - User email - **expireTime** (Long) - The time when the API key will be expired (UTC timestamp in milliseconds). If -1, the api key will not expire. - **allowedIps** (List[String]) - List of IPs allowed for the api key - **cashAccount** (List[String]) - List of cash account identifiers - **marginAccount** (List[String]) - List of margin account identifiers - **userUID** (String) - An unique id associated with user - **tradePermission** (Boolean) - Indicates if trade permission is enabled - **transferPermission** (Boolean) - Indicates if transfer permission is enabled - **viewPermission** (Boolean) - Indicates if view permission is enabled #### Response Example ```json { "code": 0, "data": { "accountGroup": 0, "email": "yyzzxxz@gmail.com", "expireTime": 1604620800000, "allowedIps": ["123.123.123.123"], "cashAccount": [ "dadFNEYEJIJ93CRxdafd3LTCIDIJPCFNIX" ], "marginAccount": [ "mar2z3CMIEQx4UadasbtQ9JcxWJYgHmcb" ], "userUID": "U0866943712", "tradePermission": true, "transferPermission": true, "viewPermission": true } } ``` ``` -------------------------------- ### Cancel All Orders - Python Example Source: https://ascendex.github.io/ascendex-pro-api/index Python code to cancel all open orders for a given account on AscendEX. Optionally, it can filter cancellations by a specific symbol. The function returns the API response, indicating acknowledgment or errors. ```python import requests import time import hashlib API_KEY = "YOUR_API_KEY" API_SECRET = "YOUR_API_SECRET" BASE_URL = "https://api.ascendex.com" def sign_request(method, url, timestamp, body=""): message = f"{timestamp}+{method.upper()}+{url.split(BASE_URL)[1]}" if body: message += f"+{body}" signature = hashlib.sha256(message.encode()).hexdigest() return signature def cancel_all_orders(account_category="cash", symbol=None): timestamp = int(time.time() * 1000) url = f"{BASE_URL}/api/pro/v1/{account_category}/order/all" payload = { "time": timestamp } if symbol: payload["symbol"] = symbol signature = sign_request("DELETE", url, timestamp, str(payload)) headers = { "x-auth-key": API_KEY, "x-auth-signature": signature, "x-auth-timestamp": str(timestamp), "Content-Type": "application/json" } response = requests.delete(url, headers=headers, json=payload) return response.json() # Example usage: # result_all = cancel_all_orders() # print(result_all) # result_symbol = cancel_all_orders(symbol="BTC/USDT") # print(result_symbol) ``` -------------------------------- ### Get Subaccount Balance Transfer History (Python) Source: https://ascendex.github.io/ascendex-pro-api/index This Python code snippet shows how to retrieve the balance transfer history for subaccounts using the AscendEX Pro API. It allows filtering by asset, sub-user ID, start time, and end time, along with pagination parameters. ```python import requests import json url = "/api/pro/v2/subuser/subuser-transfer-hist" headers = { "Content-Type": "application/json", # Add authentication headers here } payload = { "subUserId": None, "asset": None, "startTime": None, "endTime": None, "page": 1, "pageSize": 10 } response = requests.post(url, headers=headers, data=json.dumps(payload)) print(response.json()) ``` -------------------------------- ### Get Margin Balance Snapshot (HTTP Request) Source: https://ascendex.github.io/ascendex-pro-api/index This is an HTTP GET request to retrieve the daily balance snapshot information for a margin account using the AscendEX Pro API. It's recommended to call this endpoint to get the initial sequence number (sn) for subsequent balance update queries. ```http GET api/pro/data/v1/margin/balance/snapshot ``` -------------------------------- ### List all Products API (Margin) Source: https://ascendex.github.io/ascendex-pro-api/index Retrieves a list of all available products for the margin account type. ```APIDOC ## GET /api/pro/v1/margin/products ### Description Retrieves a list of all available products for the margin account type. ### Method GET ### Endpoint /api/pro/v1/margin/products ### Parameters #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **products** (array) - List of available products. - **symbol** (string) - The trading symbol. - **displayName** (string) - The display name of the product. - **baseAsset** (string) - The base asset of the trading pair. - **quoteAsset** (string) - The quote asset of the trading pair. - **minNotional** (string) - The minimum notional value for orders. - **maxNotional** (string) - The maximum notional value for orders. - **tickSize** (string) - The minimum price increment. - **lotSize** (string) - The minimum quantity increment. - **minOrderValue** (string) - The minimum order value. - **maxOrderValue** (string) - The maximum order value. - **status** (string) - The status of the product (e.g., TRADING, DELISTED). #### Response Example { "code": 0, "message": "OK", "data": { "products": [ { "symbol": "BTC/USDT", "displayName": "Bitcoin / Tether", "baseAsset": "BTC", "quoteAsset": "USDT", "minNotional": "10.0", "maxNotional": "1000000.0", "tickSize": "0.01", "lotSize": "0.00001", "minOrderValue": "1.0", "maxOrderValue": "100000.0", "status": "TRADING" } ] } } ``` -------------------------------- ### List All Products Source: https://ascendex.github.io/ascendex-pro-api/index Retrieves a list of all products available on the exchange, categorized by cash or margin trading. This endpoint provides details about trading pairs, including minimum/maximum order quantities and pricing scales. ```APIDOC ## GET /api/pro/v1/{accountCategory}/products ### Description Retrieves a list of all products traded on the exchange for a specified account category (e.g., cash or margin). ### Method GET ### Endpoint `/api/pro/v1/{accountCategory}/products` ### Parameters #### Path Parameters - **accountCategory** (String) - Required - The category of products to list (e.g., `cash`, `margin`). #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET "https://ascendex.com/api/pro/v1/cash/products" curl -X GET "https://ascendex.com/api/pro/v1/margin/products" ``` ### Response #### Success Response (200) - **code** (Integer) - Response code, 0 for success. - **data** (Array) - An array of product objects. - **symbol** (String) - Trading pair symbol (e.g., "BTC/USDT"). - **displayName** (String) - Display name of the symbol. - **domain** (String) - Trading domain (e.g., "USDS"). - **tradingStartTime** (Number) - Timestamp when trading started. - **collapseDecimals** (String) - Decimal collapse settings. - **minQty** (String) - Minimum order quantity. - **maxQty** (String) - Maximum order quantity. - **minNotional** (String) - Minimum order notional value. - **maxNotional** (String) - Maximum order notional value. - **statusCode** (String) - Status code of the symbol (e.g., "Normal"). - **statusMessage** (String) - Status message for the symbol. - **tickSize** (String) - The minimum price increment. - **useTick** (Boolean) - Whether to use tick size for price. - **lotSize** (String) - The minimum quantity increment. - **useLot** (Boolean) - Whether to use lot size for quantity. - **commissionType** (String) - Type of commission (e.g., "Quote"). - **commissionReserveRate** (String) - Commission reserve rate. - **qtyScale** (Number) - Scale for quantity. - **priceScale** (Number) - Scale for price. - **notionalScale** (Number) - Scale for notional value. #### Response Example ```json { "code": 0, "data": [ { "symbol": "BTC/USDT", "displayName": "BTC/USDT", "domain": "USDS", "tradingStartTime": 1546300800000, "collapseDecimals": "1,0.1,0.01", "minQty": "0.000000001", "maxQty": "1000000000", "minNotional": "5", "maxNotional": "400000", "statusCode": "Normal", "statusMessage": "", "tickSize": "0.01", "useTick": false, "lotSize": "0.00001", "useLot": false, "commissionType": "Quote", "commissionReserveRate": "0.001", "qtyScale": 5, "priceScale": 2, "notionalScale": 4 } ] } ``` ``` -------------------------------- ### Get Cash Balance Snapshot (HTTP Request) Source: https://ascendex.github.io/ascendex-pro-api/index This is an HTTP GET request to retrieve the daily balance snapshot information for a cash account using the AscendEX Pro API. It's recommended to call this endpoint to get the initial sequence number (sn) for subsequent balance update queries. ```http GET api/pro/data/v1/cash/balance/snapshot ``` -------------------------------- ### WebSocket Error Response Example Source: https://ascendex.github.io/ascendex-pro-api/index An example of an error response received via WebSocket. It includes the message topic, an identifier, an error code, and a reason for the error. ```json { "m": "error", "id": "ab123", "code": 100005, "reason": "INVALID_WS_REQUEST_DATA", "info": "Invalid request action: trade-snapshot" } ``` -------------------------------- ### List all Assets API (v2) Source: https://ascendex.github.io/ascendex-pro-api/index Retrieves a list of all supported assets (version 2). ```APIDOC ## GET /api/pro/v1/assets ### Description Retrieves a list of all supported assets (version 2). ### Method GET ### Endpoint /api/pro/v1/assets ### Parameters #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **assets** (array) - List of assets. - **asset** (string) - The asset name. - **depositEnabled** (boolean) - Whether deposit is enabled for the asset. - **withdrawEnabled** (boolean) - Whether withdrawal is enabled for the asset. - **minWithdrawAmount** (string) - The minimum withdrawal amount. - **maxWithdrawAmount** (string) - The maximum withdrawal amount. - **withdrawFee** (string) - The withdrawal fee. #### Response Example { "code": 0, "message": "OK", "data": { "assets": [ { "asset": "USDT", "depositEnabled": true, "withdrawEnabled": true, "minWithdrawAmount": "1.0", "maxWithdrawAmount": "1000000.0", "withdrawFee": "0.5" } ] } } ``` -------------------------------- ### WS: Place Order Source: https://ascendex.github.io/ascendex-pro-api/index Place a new order via WebSocket. This endpoint allows users to submit buy or sell orders with various parameters. ```APIDOC ## WS: Place Order ### Description Place a new order via WebSocket. This endpoint allows users to submit buy or sell orders with various parameters. ### Method WebSocket (op: "req") ### Endpoint N/A (WebSocket connection) ### Parameters #### Request Body - **op** (String) - Required - Must be "req". - **action** (String) - Required - Must be "place-Order". - **account** (String) - Required - The account type (e.g., "cash"). - **args** (Object) - Required - Contains the order details. - **time** (Long) - Required - Timestamp of the order placement. - **id** (String) - Required - A unique identifier for the order request. - **symbol** (String) - Required - The trading symbol (e.g., "EOS/USDT"). - **orderPrice** (String) - Required - The price of the order. - **orderQty** (String) - Required - The quantity of the order. - **orderType** (String) - Required - The type of order (e.g., "limit", "market"). - **side** (String) - Required - The order side (e.g., "buy", "sell"). - **postOnly** (Boolean) - Optional - If true, the order will only be posted to the order book. - **respInst** (String) - Optional - Response instruction (e.g., "ACK"). ### Request Example ```json { "op": "req", "action": "place-Order", "account": "cash", "args": { "time": 1573772908483, "id": "11eb9a8355fc41bd9bf5b08bc0d18f6b", "symbol": "EOS/USDT", "orderPrice": "3.27255", "orderQty": "30.557210737803853", "orderType": "limit", "side": "buy", "postOnly": false, "respInst": "ACK" } } ``` ### Response #### Success Response (ACK) - **m** (String) - Message type, "order". - **accountId** (String) - The account ID. - **ac** (String) - Account type. - **action** (String) - Action performed, "place-order". - **status** (String) - Status of the order, "Ack". - **info** (Object) - Order details. - **symbol** (String) - The trading symbol. - **orderType** (String) - The type of order. - **timestamp** (Long) - Timestamp of the order. - **id** (String) - Echoed request ID. - **orderId** (String) - Server-generated order ID. #### Error Response (ERR) - **m** (String) - Message type, "order". - **accountId** (String) - The account ID. - **ac** (String) - Account type. - **action** (String) - Action performed, "place-order". - **status** (String) - Status of the order, "Err". - **info** (Object) - Error details. - **id** (String) - Echoed request ID. - **symbol** (String) - The trading symbol. - **code** (Integer) - Error code. - **message** (String) - Error message. - **reason** (String) - Error reason. #### Successful ACK Message Example ```json { "m": "order", "accountId": "cshQtyfq8XLAA9kcf19h8bXHbAwwoqDo", "ac": "CASH", "action": "place-order", "status": "Ack", "info": { "symbol": "BTC/USDT", "orderType": "Limit", "timestamp": 1576015701441, "id": "17e1f6809122469589ffc991523b505d", "orderId": "s16ef1daefbe08669437121523b505d" } } ``` #### Error Response Message Example ```json { "m": "order", "accountId": "cshQtyfq8XLAA9kcf19h8bXHbAwwoqDo", "ac": "CASH", "action": "place-order", "status": "Err", "info": { "id": "69c482a3f29540a0b0d83e00551bb623", "symbol": "ETH/USDT", "code": 300011, "message": "Not Enough Account Balance", "reason": "INVALID_BALANCE" } } ``` ``` -------------------------------- ### Get Ticker for a Single Trading Pair Source: https://ascendex.github.io/ascendex-pro-api/index Retrieve summary statistics for a specific trading pair on the AscendEX spot market. This involves a GET request to the /api/pro/v1/spot/ticker endpoint with the 'symbol' query parameter. ```curl // curl -X GET 'https://ascendex.com/api/pro/v1/spot/ticker?symbol=ASD/USDT' { "code": 0, "data": { "symbol": "ASD/USDT", "open": "0.06777", "close": "0.06809", "high": "0.06899", "low": "0.06708", "volume": "19823722", "ask": [ "0.0681", "43641" ], "bid": [ "0.0676", "443" ] } } ``` -------------------------------- ### Get Order Book Depth (Python) Source: https://ascendex.github.io/ascendex-pro-api/index Fetches the order book depth for a given symbol. This function makes a GET request to the Ascendex API and returns the depth data, including sequence number, timestamp, asks, and bids. ```Python import requests def get_order_book_depth(symbol): base_url = "https://ascendex.com/api/pro/v1/depth" params = { "symbol": symbol } response = requests.get(base_url, params=params) response.raise_for_status() # Raise an exception for bad status codes return response.json() # Example usage: # depth_data = get_order_book_depth("ASD/USDT") # print(depth_data) ``` -------------------------------- ### Sign RESTful Request with Java Source: https://ascendex.github.io/ascendex-pro-api/index A Java 1.8+ example demonstrating how to sign RESTful API requests using HMAC SHA256 and Base64 encoding. This is essential for authenticating requests that access private user data. ```java // java 1.8+ import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; public class SignatureExample { public static void main(String[] args) { try { long timestamp = System.currentTimeMillis(); // 1562952827927 String api_path = "user/info"; String secret = "hV8FgjyJtpvVeAcMAgzgAFQCN36wmbWuN7o3WPcYcYhFd8qvE43gzFGVsFcCqMNk"; String message = timestamp + "+" + api_path; Mac sha256_HMAC = Mac.getInstance("HmacSHA256"); SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256"); sha256_HMAC.init(secret_key); String hash = Base64.encodeBase64String(sha256_HMAC.doFinal(message.getBytes())); System.out.println(hash); // vBZf8OQuiTJIVbNpNHGY3zcUsK5gJpwb5lgCgarpxYI= } catch (Exception e) { System.out.println("Error"); } } } ``` -------------------------------- ### GET /api/pro/v1/wallet/transactions Source: https://ascendex.github.io/ascendex-pro-api/index Query Wallet Transaction History - Retrieves a history of wallet transactions, including deposits and withdrawals. ```APIDOC ## GET /api/pro/v1/wallet/transactions ### Description Query Wallet Transaction History - Retrieves a history of wallet transactions, including deposits and withdrawals. ### Method GET ### Endpoint `/api/pro/v1/wallet/transactions` ### Parameters #### Query Parameters (No specific query parameters mentioned in the provided text, but typically includes pagination parameters like `page` and `pageSize`) ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **data** (Array) - A list of transaction objects, where each object contains: - **asset** (String) - The asset code. - **amount** (String) - The transaction amount. - **commission** (String) - The transaction commission. - **destAddress** (Object) - The destination address object, containing: - **address** (String) - The destination wallet address. - **networkTransactionId** (String) - The ID of the transaction on the network. - **numConfirmations** (Integer) - The number of confirmations for the transaction. - **numConfirmed** (Integer) - The number of confirmations required for the transaction to be considered confirmed. - **requestId** (String) - The unique request ID for the transaction. - **status** (String) - The status of the transaction (e.g., `confirmed`). - **time** (Long) - The timestamp of the transaction in milliseconds. - **transactionType** (String) - The type of transaction (`withdrawal` or `deposit`). - **hasNext** (Boolean) - Indicates if there are more pages of results. - **page** (Integer) - The current page number. - **pageSize** (Integer) - The number of items per page. #### Response Example ```json { "code": 0, "data": { "data": [ { "asset": "USDT", "amount": "400", "commission": "0", "destAddress": { "address": "1wX8...iHih" }, "networkTransactionId": "Slc8...xo2d", "numConfirmations": 3, "numConfirmed": 0, "requestId": "ZgO7...cctn", "status": "confirmed", "time": 1595001735000, "transactionType": "withdrawal" } ], "hasNext": true, "page": 1, "pageSize": 2 } } ``` ``` -------------------------------- ### List all Products API (Cash) Source: https://ascendex.github.io/ascendex-pro-api/index Retrieves a list of all available products for the cash account type. ```APIDOC ## GET /api/pro/v1/cash/products ### Description Retrieves a list of all available products for the cash account type. ### Method GET ### Endpoint /api/pro/v1/cash/products ### Parameters #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **products** (array) - List of available products. - **symbol** (string) - The trading symbol. - **displayName** (string) - The display name of the product. - **baseAsset** (string) - The base asset of the trading pair. - **quoteAsset** (string) - The quote asset of the trading pair. - **minNotional** (string) - The minimum notional value for orders. - **maxNotional** (string) - The maximum notional value for orders. - **tickSize** (string) - The minimum price increment. - **lotSize** (string) - The minimum quantity increment. - **minOrderValue** (string) - The minimum order value. - **maxOrderValue** (string) - The maximum order value. - **status** (string) - The status of the product (e.g., TRADING, DELISTED). #### Response Example { "code": 0, "message": "OK", "data": { "products": [ { "symbol": "BTC/USDT", "displayName": "Bitcoin / Tether", "baseAsset": "BTC", "quoteAsset": "USDT", "minNotional": "10.0", "maxNotional": "1000000.0", "tickSize": "0.01", "lotSize": "0.00001", "minOrderValue": "1.0", "maxOrderValue": "100000.0", "status": "TRADING" } ] } } ``` -------------------------------- ### GET /api/pro/v1/wallet/deposit/address Source: https://ascendex.github.io/ascendex-pro-api/index Query Deposit Addresses - Retrieves the deposit addresses for a specified asset, optionally filtered by blockchain. ```APIDOC ## GET /api/pro/v1/wallet/deposit/address ### Description Query Deposit Addresses - Retrieves the deposit addresses for a specified asset, optionally filtered by blockchain. ### Method GET ### Endpoint `/api/pro/v1/wallet/deposit/address` ### Parameters #### Query Parameters - **asset** (String) - Required - The asset code to query deposit addresses for (e.g., `BTC`). - **blockchain** (Boolean) - Optional - A filter for the blockchain name. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **asset** (String) - Asset code. - **assetName** (String) - Asset name. - **address** (List) - A list of address objects, where each object contains: - **address** (String) - The wallet address. - **blockchain** (String) - The name of the blockchain. - **destTag** (String) - The destination tag (or memo) attached to the address. Can be an empty string. #### Response Example ```json { "code": 0, "data": { "asset": "USDT", "assetName": "Tether", "address": [ { "address": "1P67...TnG3", "blockchain": "Omni", "destTag": "" }, { "address": "0xd3...c466", "blockchain": "ERC20", "destTag": "" }, { "address": "TPpK...ovJk", "blockchain": "TRC20", "destTag": "" } ] } } ``` ``` -------------------------------- ### Sign RESTful Request with Bash Source: https://ascendex.github.io/ascendex-pro-api/index Demonstrates how to sign a RESTful API request using bash, including generating a timestamp, constructing the message, and creating the HMAC SHA256 signature. This is used for accessing private data. ```bash #!/bin/bash APIPATH=info APIKEY=CEcrjGyipqt0OflgdQQSRGdrDXdDUY2x SECRET=hV8FgjyJtpvVeAcMAgzgAFQCN36wmbWuN7o3WPcYcYhFd8qvE43gzFGVsFcCqMNk TIMESTAMP=`date +%s%N | cut -c -13` # 1608133910000 MESSAGE=$TIMESTAMP+$APIPATH SIGNATURE=`echo -n $MESSAGE | openssl dgst -sha256 -hmac $SECRET -binary | base64` echo $SIGNATURE # /pwaAgWZQ1Xd/J4yZ4ReHSPQxd3ORP/YR8TvAttqqYM= curl -X GET -i \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "x-auth-key: $APIKEY" \ -H "x-auth-signature: $SIGNATURE" \ -H "x-auth-timestamp: $TIMESTAMP" \ https://ascendex.com/api/pro/v1/info ``` -------------------------------- ### GET /api/pro/v1/margin/balance Source: https://ascendex.github.io/ascendex-pro-api/index Retrieves the margin account balance for a user. Similar to the cash balance, it can be filtered by asset or show all assets. ```APIDOC ## GET /api/pro/v1/margin/balance ### Description Retrieves the margin account balance for a user. This endpoint allows querying the balance of a specific asset or all assets, including those with zero balances, along with borrowed amounts and interest. ### Method GET ### Endpoint `/api/pro/v1/margin/balance` ### Parameters #### Query Parameters - **asset** (String) - Optional - Valid asset code (e.g., `BTC`). Used to query the balance of a single asset. - **showAll** (Boolean) - Optional - `true` / `false`. By default, only assets with non-zero balances are returned. Set to `true` to include all assets. ### Request Example ``` GET /api/pro/v1/margin/balance?showAll=true ``` ### Response #### Success Response (200) - **asset** (String) - Asset code. - **totalBalance** (String) - Total balance in string format. - **availableBalance** (String) - Available balance in string format. - **borrowed** (String) - Borrowed amount in string format. - **interest** (String) - Interest owed in string format. #### Response Example ```json { "code": 0, "data": [ { "asset": "USDT", "totalBalance": "11200", "availableBalance": "11200", "borrowed": "0", "interest": "0" } ] } ``` ``` -------------------------------- ### Balance Snapshot API Source: https://ascendex.github.io/ascendex-pro-api/index Provides REST APIs to get daily balance snapshots and intraday balance/order fill update details. Rate limit is 8 per minute. Data query for the most recent 7 days is supported. ```APIDOC ## Balance Snapshot API ### Description Provides REST API to get daily balance snapshot, and intraday balance and order fills update details. It is recommended to call the balance snapshot endpoint (`/balance/snapshot`) to get the balance at the beginning of the day and the sequence number `sn`; then start to query balance or order fills update from `/balance/history` by setting the parameter `sn` value to be `sn + 1`. Rate limit is 8 per minute. Data query for the most recent 7 days is supported. ### Balance Snapshot This API returns cash or margin balance snapshot information on a daily basis. #### Method GET #### Endpoint For cash: `api/pro/data/v1/cash/balance/snapshot` For margin: `api/pro/data/v1/margin/balance/snapshot` ### Parameters (No specific request parameters are listed for the snapshot endpoint in the provided text, but it's implied that the type of balance (cash/margin) determines the endpoint.) ### Response (Response structure for balance snapshot is not detailed in the provided text.) ### Related Endpoints - `/balance/history` (for intraday updates) ``` -------------------------------- ### GET /api/pro/v1/risk-limit-info (Deprecated) Source: https://ascendex.github.io/ascendex-pro-api/index Retrieves risk limit information for WebSocket connections. This endpoint is deprecated and users should migrate to v2. ```APIDOC ## GET /api/pro/v1/risk-limit-info ### Description Retrieves risk limit information for WebSocket connections. This endpoint is deprecated and users should migrate to v2. ### Method GET ### Endpoint /api/pro/v1/risk-limit-info ### Parameters #### Query Parameters - **ip** (String) - Optional - valid ip address - The client's IP address to be checked if it is banned due to violation of risk limits. ### Request Example ``` GET https://ascendex.com/api/pro/v1/risk-limit-info?ip=0.0.0.0 ``` ### Response #### Success Response (200) - **code** (Integer) - Response code. - **data** (Object) - Response data. - **ip** (String) - The client's IP address. - **webSocket** (Object) - WebSocket risk limit details. - **windowSizeInMinutes** (Integer) - The time window in minutes for request rate limiting. - **maxNumRequests** (Integer) - The maximum number of requests allowed within the window. - **maxSessionPerIp** (Integer) - The maximum number of WebSocket sessions allowed per IP address. - **isBanned** (Boolean) - Indicates if the IP address is currently banned. - **bannedUntil** (Long) - The timestamp (in milliseconds) until which the IP address is banned. - **violationCode** (Integer) - The code indicating the type of violation. - **reason** (String) - The reason for the ban or violation. #### Response Example ```json { "code": 0, "data": { "ip": "0.0.0.0", "webSocket": { "windowSizeInMinutes": 5, "maxNumRequests": 45, "maxSessionPerIp": 30, "isBanned": true, "bannedUntil": 1644807691158, "violationCode": 100014, "reason": "exceeds MAX_REQ_COUNT_PER_IP[45], 49 requests recently" } } } ``` ```