NAV Navbar
shell python

Introduction

Connect your custom trading applications and strategies to AAX via our feature-rich API.

The REST endpoints offer you secure access to manage your orders and positions. Low-latency websocket channels are also available for you to subscribe to market data, your orders status and more.

You will also find code samples in Shell and Python alongside our documentation to guide you through your implementation.

Change Log

2021.08.20

New

Improvements

2021.07.07

New

Improvements

2021.06.17

New

Improvements

2021.04.27

New

Improvements

2020.12.08

New

2020.12.04

New

Improvements

2020.10.16

New

Improvements

2020.09.01

New

2020.08.15

New

2020.07.20

New

Improvements

2020.07.08

New

Improvements

2020.06.12

Improvements

2020.04.30

New

2020.04.28

New

2020.03.23

New

2020.02.24

New

Improvements

2019.12.11

New

Improvements

API Key

The API key and the API secret are required to access the authenticated part of the API. You can generate as many API keys as you need on this page. Below table shows the different permissions you can set for each API key.

Permissions Read Write
Account info Default --
Spot Trading Default Optional
Futures Trading Default Optional

By default, API keys have read-only access to user data such as positions, margins, orders and executions. In order to be able to send and manage orders, please set “Spot Trading” and/or “Futures Trading” to “Write”.

REST

Overview

RESTful endpoints provide a wide range of data using HTTPS, a secure request-response protocol.

Endpoints

Base URL: https://api.aax.com

For Chinese users, we recommend to use https://api.aaxlab.com.

Public Endpoints

Public endpoints are available to retrieve data, such as instrument details, without authentication.

Private Endpoints

Private endpoints are available for order management and retrieving account details such as positions. To use private endpoints, you must authenticate using your API keys.

Authentication

To authenticate using your API key, use this code:

import hmac, hashlib, time, requests

API_KEY = '***YOUR_API_KEY***';
API_SECRET = '***YOUR_API_SECRET***';

class Auth(requests.auth.AuthBase):
    def __init__(self, api_key, secret_key):
        self.api_key = api_key
        self.secret_key = secret_key

    def __call__(self, request):
        nonce = str(int(1000 * time.time()))
        strBody = request.body.decode() if request.body else ''
        message = nonce + ':' + request.method + request.path_url + (strBody or '')
        signature = hmac.new(self.secret_key.encode(), message.encode(), hashlib.sha256).hexdigest()
        request.headers.update({
            'X-ACCESS-NONCE': nonce,
            'X-ACCESS-KEY': self.api_key,
            'X-ACCESS-SIGN': signature,
        })
        return request

auth = Auth(API_KEY, API_SECRET)

AAX offers SecretAPIKey for authentication. Never share your keys. Keep SecretAPIKey secured. When you are logged in, please follow the link to manage your active keys.

Authentication is done by sending the following HTTP headers:

X-ACCESS-KEY: Your public API key.

X-ACCESS-NONCE: A UNIX timestamp in milliseconds after which the request is no longer valid. This is to prevent replay attacks.

X-ACCESS-SIGN: Signature for your API request. It is calculated as follows: HEX(HMAC_SHA256(apiSecret, str(nonce) + ':' + verb + path + data)). The data part of the HMAC construction should be exactly equal to the raw message body you wish to send to the server and needs to be a JSON-encoded.

In order to check if your signature calculation is correct, try the inputs in the following examples and see if the results match:

# Below apiKey and apiSecret are just examples for testing purpose
import hmac, hashlib
apiKey = 'a0R6FlTcxM6IidDB9GCQPkkktU'
apiSecret = 'ce353da330bc73ef5cfbc85c70a5cf96'


# GET
verb = 'GET'
path = '/v2/futures/orders?symbol=BTCUSDFP'
expires = 1573617003403 # 2019-11-13T03:50:03.403Z
data = ''

# HEX(HMAC_SHA256(apiSecret, '1573617003403:GET/v2/futures/orders?symbol=BTCUSDFP'))
# Result is: 'cad62d62f09c142ab05c01418483b5a66090f107c002c45d072013aa95a63655'
signature = hmac.new(apiSecret.encode(), (str(expires) + ':' + verb + path + data).encode(), hashlib.sha256).hexdigest()


# POST
verb = 'POST'
path = '/v2/spot/orders'
expires = 1573617153689 # 2019-11-13T03:52:53.689Z
data = '{"orderType": "MARKET", "symbol": "BTCUSDT", "orderQty": 0.02, "side": "BUY"}'

# HEX(HMAC_SHA256(apiSecret, '1573617153689:POST/v2/spot/orders{"orderType": "MARKET", "symbol": "BTCUSDT", "orderQty": 0.02, "side": "BUY"}'
# Result is: '7beec00f1f10ad3351eaaad72764e494ddba6a45cdc949cfd33dcedc451656ae'
signature = hmac.new(apiSecret.encode(), (str(expires) + ':' + verb + path + data).encode(), hashlib.sha256).hexdigest()


# PUT
verb = 'PUT'
path = '/v2/spot/orders'
expires = 1573617359274 # 2019-11-13T03:55:59.274Z
data = '{"orderID": "wPy5no0Rr", "orderQty": 0.05}'

# HEX(HMAC_SHA256(apiSecret, '1573617359274:PUT/v2/spot/orders{"orderID": "wPy5no0Rr", "orderQty": 0.05}'
# Result is: '1492cbdf1c0b63756ad081851ba88db84e381f3d8b6a611edd81ec1c0a96c17d'
signature = hmac.new(apiSecret.encode(), (str(expires) + ':' + verb + path + data).encode(), hashlib.sha256).hexdigest()


# DELETE
verb = 'DELETE'
path = '/v2/spot/orders/cancel/all'
expires = 1573617359532 # 2019-11-13T03:55:59.3532Z
data = '{"symbol": "BTCUSDT"}'

# HEX(HMAC_SHA256(apiSecret, '1573617359532:DELETE/v2/spot/orders/cancel/all{"symbol": "BTCUSDT"}'
# Result is: '60213445ca0f7e08b16c6dd0f1172f32a0effba1c74077e408e34b54424ebeda'
signature = hmac.new(apiSecret.encode(), (str(expires) + ':' + verb + path + data).encode(), hashlib.sha256).hexdigest()
# Below apiKey and apiSecret are just examples for testing purpose
#!/usr/bin/env bash

apiKey='a0R6FlTcxM6IidDB9GCQPkkktU'
apiSecret='ce353da330bc73ef5cfbc85c70a5cf96'


# GET
verb='GET'
path='/v2/futures/orders?symbol=BTCUSDFP'
expires=1573617003403 # 2019-11-13T03:50:03.403Z
data=''

# HEX(HMAC_SHA256(apiSecret, '1573617003403:GET/v2/futures/orders?symbol=BTCUSDFP'))
# Result is: 'cad62d62f09c142ab05c01418483b5a66090f107c002c45d072013aa95a63655'
signature=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${apiSecret}`


# POST
verb='POST'
path='/v2/spot/orders'
expires=1573617153689 # 2019-11-13T03:52:53.689Z
data={"orderType": "MARKET", "symbol": "BTCUSDT", "orderQty": 0.02, "side": "BUY"}

# HEX(HMAC_SHA256(apiSecret, '1573617153689:POST/v2/spot/orders{"orderType": "MARKET", "symbol": "BTCUSDT", "orderQty": 0.02, "side": "BUY"}'
# Result is: '7beec00f1f10ad3351eaaad72764e494ddba6a45cdc949cfd33dcedc451656ae'
signature=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${apiSecret}`


# PUT
verb='PUT'
path='/v2/spot/orders'
expires=1573617359274 # 2019-11-13T03:55:59.274Z
data={"orderID": "wPy5no0Rr", "orderQty": 0.05}

# HEX(HMAC_SHA256(apiSecret, '1573617359274:PUT/v2/spot/orders{"orderID": "wPy5no0Rr", "orderQty": 0.05}'
# Result is: '1492cbdf1c0b63756ad081851ba88db84e381f3d8b6a611edd81ec1c0a96c17d'
signature=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${apiSecret}`


# DELETE
verb = 'DELETE'
path = '/v2/spot/orders/cancel/all'
expires = 1573617359532 # 2019-11-13T03:55:59.3532Z
data = {"symbol": "BTCUSDT"}

# HEX(HMAC_SHA256(apiSecret, '1573617359532:DELETE/v2/spot/orders/cancel/all{"symbol": "BTCUSDT"}'
# Result is: '60213445ca0f7e08b16c6dd0f1172f32a0effba1c74077e408e34b54424ebeda'
signature=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${apiSecret}`

HTTP Request

Each HTTP request must contain the header Accept: application/json.

HTTP Responses

All the responses are returned in JSON format.

HTTP Success

Successful HTTP responses have the status code 200. Examples of responses are provided for each endpoint in the documentation.

HTTP Errors

All HTTP requests with response status code not equal to 200 must be considered as failed. Below is the list of errors you may find in the response body if your request fails:

Error Code Description
400 Bad Request – There is something wrong with your request
401 Unauthorized – Your API key or signature is wrong
403 Forbidden – Your API key does not have enough privileges to access this resource
429 Too many requests – You have exceeded your API key rate limits
500 Internal Server - Internal Server Error
503 Service Unavailable - Service is down for maintenance
504 Gateway Timeout. Request timeout expired
550 No data – You requested data that is not available at this moment

Rate Limits

Request rate limit for each endpoint for a given API key:

API Per Second Per Minute Per Hour
Cancel Spot Order 20 200 6000
Cancel Futures Order 20 200 6000
Cancel All Spot Orders 2 30 600
Cancel All Futures Orders 2 30 600
Close Futures Position 2 30 600
Update Futures position Leverage 15 200
All Other Authenticated Endpoints 10 150 5000

Market Data

Method Path Description
GET /v2/announcement/maintenance System Maintenance Notice
GET /v2/time Get Current Server Time
GET /v2/instruments Get trading pairs information
GET /v2/currencies Get Currencies
GET /v2/market/orderbook Order Book
GET /v2/futures/position/openInterest Open Interest
GET /v2/market/tickers Get the Last 24h Market Summary
GET /v2/market/candles Get Current Candlestick
GET /v2/market/trades Get Recent Trades
GET /v2/market/markPrice Get Current Mark Price
GET /v2/futures/funding/predictedFunding/{symbol} Get Predicted Funding Rate
GET /v2/futures/funding/prevFundingRate/{symbol} Get Last Funding Rate
GET /v2/futures/funding/fundingRate Get Funding Rate History
GET /v2/market/candles/index Get Current Index Candlestick

System Maintenance Notice

Description

This endpoint returns information related to planned and ongoing system maintenance.

HTTP Request
import requests

response = requests.get('https://api.aax.com/v2/announcement/maintenance').json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/announcement/maintenance"
verb="GET"
output=`curl -s -H "accept: application/json;charset=UTF-8" -X ${verb} "${domain}${path}"`
echo "result: $output"

GET /v2/announcement/maintenance

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "startTime":"2020-06-25T02:15:00.000Z",
      "endTime":"2020-06-25T02:45:00.000Z"
      "description":"Spot Trading :UTC Jun 25, 2020 02:15 to 02:45 (HKT Jun 25 10:15 to 10:45),Futures Trading: UTC Jun 25, 2020 02:15 to 02:45 (HKT Jun 25 10:15 to 10:45).We apologize for any inconvenience caused. Thank you for your patience and understanding.Should you have any enquiries, please do not hesitate our live chat support or via email at cs@aax.com.",
      "haltReason":1,
      "systemStatus":{
                      "spotTrading":"readOnly",
                      "futuresTreading":"closeOnly",
                      "walletOperating":"enable",
                      "otcTrading":"disable"
                     }
    }
   "message":"success",
   "ts":1593043237000
}
Field Data Type Description
startTime String Estimated start time of system maintenance
endTime String Estimated end time of system maintenance
description String System maintenance description
haltReason Integer Halt reason,0:Emergency maintenance;1:Planned maintenance
systemStatus Object Status of each services of the AAX platform.

Note

Get Current Server Time

Description

This endpoint allows you to get the current server time.The unit is millisecond

HTTP Request

GET /v2/time

import requests
response = requests.get('https://api.aax.com/v2/time').json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/time"
verb="GET"
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"

The above command returns JSON structured like this:

{
   "code":1,
   "data":1573542445411,  // unit: millisecond
   "message":"success",
   "ts":1573542445411
}

Instruments

Description

This endpoint is used to retrieve information for all or specific instruments.

HTTP Request

GET /v2/instruments

Request Parameters
import requests

response = requests.get('https://api.aax.com/v2/instruments').json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/instruments"
verb="GET"
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
symbol No String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":[
      {
         "tickSize":"0.1",
         "lotSize":"0.0001",
         "base":"BTC",
         "quote":"USDT",
         "settleType":null,
         "settleCurrency":null,
         "minQuantity":"0.0010000000",
         "maxQuantity":"999900.0000000000",
         "minPrice":"0.1000000000",
         "maxPrice":"10000000.0000000000",
         "status":"enable",
         "symbol":"BTCUSDT",
         "code":null,
         "takerFee":"0.00000",
         "makerFee":"0.00000",
         "multiplier":"1.000000000000",
         "mmRate":"0.02500",
         "imRate":"0.05000",
         "type":"spot"
      },
      ...
   ],
   "message":"success",
   "ts":1573561743499
}
Field Data Type Description
tickSize String Minimum price movement for this specific instrument
lotSize String The intervals that a quantity can be increased/decreased by
base String Base Currency in a trading pair
quote String Quote Currency in a trading pair
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
settleCurrency String Settlement currency
minQuantity String Minimum order amount in Base Currency for buying or selling
maxQuantity String Maximum order amount in Base Currency for buying or selling
minPrice String Minimum price/stopPrice allowed
maxPrice String Maximum price/stopPrice allowed
status String Status of the trading pair (enable, disable or readonly)
symbol String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
code String Applicable for futures only. 'FP' for perpetual futures, null for spot
takerFee String Taker fee
makerFee String Maker fee
multiplier String Multiplier for futures, ignore for spot
mmRate String Maintenance margin rate for futures, ignore for spot
imRate String Initial margin rate for futures, ignore for spot
type String Trading pairs type i.e. spot or futures

Get Currencies

Description

This endpoint is used to retrieve all or single AAX supported trading currencies information.

HTTP Request

GET /v2/currencies

Request Parameters
import requests
response = requests.get('https://api.aax.com/v2/currencies').json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/currencies"
verb="GET"
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
currency No String Currency, e.g. BTC, ETH
Response Content

The above command returns JSON structured like this:

{
    "code": 1,
    "data": [
        {
            "chain": "BTC",
            "displayName": "Bitcoin",
            "withdrawFee": "0.0004",
            "withdrawMin": "0.001",
            "otcFee": "0",
            "enableOTC": true,
            "visible": true,
            "enableTransfer": true,
            "transferMin": "0.00001",
            "depositMin": "0.0005",
            "enableWithdraw": true,
            "enableDeposit": true,
            "addrWithMemo": false,
            "withdrawPrecision": "0.00000001",
            "currency": "BTC",
            "network": "BTC",
            "minConfirm": "3"
        },
        {
            "chain": "BEP20-BTC",
            "displayName": "BTCB Token",
            "withdrawFee": "0.000038",
            "withdrawMin": "0.000076",
            "otcFee": "0",
            "enableOTC": false,
            "visible": true,
            "enableTransfer": false,
            "transferMin": "0",
            "depositMin": "0.0005",
            "enableWithdraw": true,
            "enableDeposit": true,
            "addrWithMemo": false,
            "withdrawPrecision": "0.00000001",
            "currency": "BTC",
            "network": "BEP20",
            "minConfirm": "15"
        }
    ],
    "message": "success",
    "ts": 1622519781275
}
Field Data Type Description
chain String Name of the blockchain
displayName String Display name of the blockchain
withdrawFee String Withdrawal fee
withdrawMin String Minimum withdrawal amount
otcFee String Fees for OTC transactions
enableOTC Boolean OTC trading available
visible Boolean Currency visible or not
enableTransfer Boolean Internal transfer supported
transferMin String Minimum amount for internal transfer
depositMin String Minimum deposit amount
enableWithdraw Boolean Withdrawal supported
enableDeposit Boolean Deposit supported
addrWithMemo Boolean Memo required for withdrawal
withdrawPrecision String Withdrawal amount precision
currency String Currency
network String Blockchain network
minConfirm String Minimum confirmations on-chain required before withdrawal/deposit are reflected in AAX balance

Order Book

import requests

params = {"symbol": "BTCUSDFP", "level": 20}
response = requests.get('https://api.aax.com/v2/market/orderbook', params=params).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/market/orderbook?symbol=BTCUSDFP&level=20"
verb="GET"

output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`

echo "result: $output"
Description

This endpoint allows you to retrieve the current order book for a specific symbol.

HTTP Request

GET /v2/market/orderbook

Request Parameters
Parameter Required Data Type Default Description
symbol Yes String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
level Yes Integer Depth support 20, 50
Response Content

The above command returns JSON structured like this:

{
   "asks":[
      [
         "10823.00000000", #price
         "0.004000"  #size
      ],
      [
         "10823.10000000",
         "0.100000"
      ],
      [
         "10823.20000000",
         "0.010000"
      ]
   ],
   "bids":[
      [
         "10821.20000000",
         "0.002000"
      ],
      [
         "10821.10000000",
         "0.005000"
      ],
      [
         "10820.40000000",
         "0.013000"
      ]
   ],
   "e":"BTCUSDT@book_50",
   "t":1561543614756
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
asks Array List of asks currently in orderbook[price, size]
bids Array List of bids currently in orderbook[price, size]

Open Interest

Description

The endpoint allows you retrieve the current open interest for a specific symbol.

HTTP Request

GET /v2/futures/position/openInterest

Request Parameters
import requests

params = {
            "symbol": "BTCUSDFP"
          }
response = requests.get('https://api.aax.com/v2/futures/position/openInterest', params=params).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/futures/position/openInterest?symbol=BTCUSDFP"
verb="GET"
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "symbol":"BTCUSDFP",
      "openInterest":"1034600",
      "openInterestUSD":"1034600"
   },
   "message":"success",
   "ts":1573542445411
}
Field Data Type Description
openInterest String Number of contracts in open interest
openInterestUSD String Open interest in USD value
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'

Get the Last 24h Market Summary

import requests

response = requests.get('https://api.aax.com/v2/market/tickers').json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/market/tickers"
verb="GET"

output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`

echo "result: $output"
Description

This endpoint allows you to retrieve the trading summary for all the symbols over the past 24 hours.

HTTP Request

GET /v2/market/tickers

Response Content

The above command returns JSON structured like this:

{
    "e": "tickers",
    "t": 1624589459436,
    "tickers": [{
        "a": "0.00000000",
        "c": "0.00000000",
        "d": "0.00000000",
        "h": "0.00000000",
        "l": "0.00000000",
        "o": "0.00000000",
        "s": "ZILETH",
        "v": "0.00000000"
    },  {
        "a": "0.00000000",
        "c": "0.05718800",
        "d": "-1.73545483",
        "h": "0.05869600",
        "l": "0.05682100",
        "o": "0.05819800",
        "s": "ETHBTC",
        "v": "0.69041905"
    }]
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
s String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
o String Open price
h String High price
l String Low price
c String Close price
v String The trading volume in quote currency of last 24 hours
a String The trading volume in USD in the last 24 hours(only support Futures)
d String Difference in percentages ((close-open)/open) * 100.0

Get Current Candlestick

import requests

params = {"symbol": "BTCUSDFP", "timeFrame": "1m"}
response = requests.get('https://api.aax.com/v2/market/candles', params=params).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/market/candles?symbol=BTCUSDFP&timeFrame=1m"
verb="GET"

output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`

echo "result: $output"
Description

This endpoint allows you to retrieve candlestick data for a specific symbol.

HTTP Request

GET /v2/market/candles

Request Parameters
Parameter Required Data Type Default Description
symbol Yes String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
timeFrame Yes String The period of each candlesticks , 1m, 3m, 5m, 15m, 30m, 1h, 2h, 3h, 4h, 8h, 1d
Response Content

The above command returns JSON structured like this:

{
   "c": "9308.34000000",
   "e": "BTCUSDT@1m_candles",
   "h": "9316.97000000",
   "l": "9304.82000000",
   "o": "9304.82000000",
   "s": 1592548440,
   "t": 1592548470,
   "v": "4806.98608000"
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
h String High price
l String Low price
o String Open price
s Integer Start time of the candlestick(seconds)
v String Trade volume
c String Close price

Get Historical Candlestick

import requests

params = {"symbol": "BTCUSDFP", "timeFrame": "30m", "start":1611335920, "end":1611405000}
response = requests.get('https://api.aax.com/v2/market/history/candles', params=params).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/market/history/candles?start=1611335920&end=1611336600&timeFrame=30m&symbol=BTCUSDTFP"
verb="GET"

output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`

echo "result: $output"
Description

This endpoint allows you to retrieve historical candlestick data for a specific symbol.

HTTP Request

GET /v2/market/history/candles

Request Parameters
Parameter Required Data Type Description
symbol Yes String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
timeFrame Yes String The period of each candlesticks , 1m, 3m, 5m, 15m, 30m, 1h, 2h, 3h, 4h, 8h, 1d
start Yes Integer The start time of the window
end Yes Integer The end time of the window
Response Content

The above command returns JSON structured like this:

{
   "data":[
      [
         32442.45,     // Open Price
         32552.6,      // High Price
         32302.5,      // Low Price
         32373.1,      // Close Price
         1463,         // Volume
         1611334800    // Open Time
      ],
      [
         32373.1,
         32480.25,
         32140.9,
         32371.3,
         2184,
         1611336600
      ]
   ],
   "success":true,
   "t":1611578772
}

Field Data Type Description
o Decimal Open price
h Decimal High price
l Decimal Low price
c Decimal Close price
v Integer Trade volume
t Integer Open Time

Get Recent Trades

import requests

params = {"symbol": "BTCUSDFP", "limit": 2}
response = requests.get('https://api.aax.com/v2/market/trades', params=params).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/market/trades?symbol=BTCUSDFP&limit=2"
verb="GET"

output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`

echo "result: $output"
Description

This endpoint allows you to retrieve recent trades(up to last 2000)

HTTP Request

GET /v2/market/trades

Request Parameters
Parameter Required Data Type Default Description
symbol Yes String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
limit Yes Integer Number of trade records. Max 2000
Response Content

The above command returns JSON structured like this:

{
  "e":"BTCUSDFP@trades",
  "trades":
      [ { "p":"9395.50000000",
         "q":"50.000000",
         "t":1592563996718
       },
      {  "p":"9395.50000000",
         "q":"50.000000",
         "t":1592563993577
      }]
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
p String Price (Positive for Buy, Negative for Sell, e.g. -6573.2 for Sell)
q String Quantity

Get Current Mark Price

import requests

params = {"symbol": "BTCUSDFP"}
response = requests.get('https://api.aax.com/v2/market/markPrice', params=params).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/market/markPrice?symbol=BTCUSDFP"
verb="GET"

output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`

echo "result: $output"
Description

This endpoint allows you to retrieve the current mark price for a specific futures symbol.

HTTP Request

GET /v2/market/markPrice

Request Parameters
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
Response Content

The above command returns JSON structured like this:

{
    "T": 1607356800000,    //Next Funding time  (milliseconds)
    "e": "BTCUSDTFP@mark", //Event Name
    "i": "18152.79000000",  //Index Price
    "p": "19204.54499999",  //Mark Price
    "r": "0.0003000000",    //Predicted Funding Rate
    "t": 1607341980826      //Event Time (milliseconds)
}
Field Data Type Description
e String Event name
p String Mark price
i String Index price
r String Predicted funding rate
T Integer Next Funding time
t Integer Event time (unit: milliseconds)

Get Predicted Funding Rate

Description

This endpoint is used to get Predicted funding rate without authentication

HTTP Request

GET /v2/futures/funding/predictedFunding/{symbol}

Request Parameters
import requests

response = requests.get('https://api.aax.com/v2/futures/funding/predictedFunding/BTCUSDFP').json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
path='/v2/futures/funding/predictedFunding/BTCUSDFP'
verb='GET'
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "predictedFundingRate": "0.001",
      "nextFundingTime":  "2020-02-12T08:00:00Z"
      "indexPrice": "13000.94"
   },
   "message":"success",
   "ts":1573542445411
}
Field Data Type Description
predictedFundingRate String Predicted funding rate. When the funding rate is positive, longs pay shorts. When it is negative, shorts pay longs.
nextFundingTime String Next funding time with UTC time
indexPrice String Index Price

Get Last Funding Rate

import requests

response = requests.get('https://api.aax.com/v2/futures/funding/prevFundingRate/BTCUSDFP').json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path='/v2/futures/funding/prevFundingRate/'
data="BTCUSDFP"
verb='GET'
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Description

This endpoint is used to get last funding rate without authentication. The funding rate is generated every 8 hours at 00:00 UTC, 08:00 UTC and 16:00 UTC.

HTTP Request

GET /v2/futures/funding/prevFundingRate/{symbol}

Request Parameters
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "symbol": "BTCUSDFP",
      "markPrice": "11192.5",
      "fundingRate": "0.001",
      "fundingTime": "2020-08-12T08:00:00Z",
      "nextFundingTime": "2020-08-12T16:00:00Z"
   },
   "message":"success",
   "ts":1573542445411
}
Response Content
Field Data Type Description
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
markPrice String Mark price
fundingRate String The latest funding rate. When the funding rate is positive, longs pay shorts. When it is negative, shorts pay longs.
fundingTime String The funding time with UTC time
nextFundingTime String The next funding time with UTC time

Get Funding Rate History

Description

This endpoint is used to retrieve historical funding rate for a specific futures symbol.

HTTP Request

GET /v2/futures/funding/fundingRate

Request Parameters
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
startTime No Integer Timestamp in second
endTime No Integer Timestamp in second
limit No Integer Default:100; max:1000
import requests
params = {"symbol": "BTCUSDFP", "limit": 1}
response = requests.get("https://api.aax.com/v2/futures/funding/fundingRate", params=params).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path='/v2/futures/funding/fundingRate?symbol=BTCUSDTFP&limit=1'
verb='GET'
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Response Content
Field Data Type Description
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
fundingRate String The funding rate. When the funding rate is positive, longs pay shorts. When it is negative, shorts pay longs.
fundingTime String The funding time with UTC time

The above command returns JSON structured like this:

{
   "code":1,
   "data":[
          {
            "symbol": "BTCUSDTFP",
            "fundingRate":"0.001",
            "fundingTime": "2020-08-12T08:00:00Z"
          }
    ],
   "message":"success",
   "ts":1573542445411
}

Get Current Index Candlestick

import requests

params = {"symbol": "BTCUSD", "timeFrame": "1m"}
response = requests.get('https://api.aax.com/v2/market/index/candles', params=params).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path="/v2/market/index/candles?symbol=BTCUSD&timeFrame=1m"
verb="GET"

output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -X ${verb} "${domain}${path}"`

echo "result: $output"
Description

This endpoint allows you to retrieve index candlestick data for a specific symbol. Supported symbols: ADAUSDT, BCHUSDT, BTCUSD, BTCUSDT, COMPUSDT, ETHUSDT, LINKUSDT, SOLUSDT, XRPUSDT.

HTTP Request

GET /v2/market/index/candles

Request Parameters
Parameter Required Data Type Description
symbol Yes String The trading symbol to trade. Convention is 'Base Currency + Quote Currency'
timeFrame Yes String The period of each candlesticks , 1m, 3m, 5m, 15m, 30m, 1h, 2h, 3h, 4h, 8h, 1d

The above command returns JSON structured like this:

{
   'c': "9308.34000000",
   'e': "BTCUSD_INDEX@1m_candles",
   'h': "9316.97000000",
   'l': "9304.82000000",
   'o': "9304.82000000",
   's': 1592548440,
   't': 1592548470,
   'v': "4806.98608000"
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
h String High price
l String Low price
o String Open price
s Integer Start time of the candlestick(seconds)
v String Trade volume
c String Close price

Authenticated Endpoints

Available endpoints
Field Path Description
GET /v2/user/info Retrieve user information
GET /v2/account/balances Get Account Balances
GET /v2/account/deposit/address Query Deposit Address
GET /v2/account/deposits Get Deposit History
GET /v2/account/withdraws Get Withdraw History
POST /v2/account/transfer Asset Transfer
POST /v2/spot/orders Create a new spot order
PUT /v2/spot/orders Amend spot order
DELETE /v2/spot/orders/cancel Cancel a spot order
DELETE /v2/spot/orders/cancel/all Batch cancel spot orders
POST /v2/spot/orders/cancelAllOnTimeout Automatically cancel all your spot orders after a specified timeout.
GET /v2/spot/trades Retrieve trades details for a spot order
GET /v2/spot/openOrders Retrieve spot open orders
GET /v2/spot/orders Retrieve historical spot orders
POST /v2/futures/orders Create a new futures order
PUT /v2/futures/orders Amend the quantity of an open futures order
DELETE /v2/futures/orders/cancel Cancel a futures order
DELETE /v2/futures/orders/cancel/all Batch cancel futures orders
POST /v2/futures/orders/cancelAllOnTimeout Automatically cancel all your futures orders after a specified timeout.
GET /v2/futures/position Get positions for all contracts
POST /v2/futures/position/close Close position
GET /v2/futures/position/closed Get closed positions
POST /v2/futures/position/leverage Update leverage for position
POST /v2/futures/position/margin Modify Isolated Position Margin
GET /v2/futures/trades Retrieve trade details for a futures order
GET /v2/futures/openOrders Retrieve futures open orders
GET /v2/futures/orders Retrieve historical futures orders
GET /v2/futures/funding/predictedFundingFee/{symbol} Get predicted funding fee
GET /v2/futures/funding/fundingFee Get Historical Funding Fee

Account

User information

Description

Retrieve the user ID associated with the API key used.

HTTP Request
import requests

response = requests.get('https://api.aax.com/v2/user/info', auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/user/info'
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"

GET /v2/user/info

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "userID":"216214"
   },
   "message":"success",
   "ts":1573530400495
}
Field Data Type Description
userID String user id

Get Account Balances

Description

This endpoint allows you to retrieve your accounts balance.

Account types
HTTP Request
import requests

params= {'purseType': "FUTP"}
response = requests.get('https://api.aax.com/v2/account/balances', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/account/balances?purseType=FUTP'
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"

GET /v2/account/balances

Request Parameters
Parameter Required Data Type Description
purseType No String Account Type, e.g 'SPTP, FUTP, F2CP, VLTP, RWDP'
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":[
         {
            "purseType":"FUTP",
            "currency":"BTC",
            "available":"0.41000000",
            "unavailable":"0.00000000"
         },
         {
            "purseType":"FUTP",
            "currency":"USDT",
            "available":"0.21000000",
            "unvaliable":"0.00000000"
         }
      ]
 "message":"success",
 "ts":1573530401020
}
Field Data Type Description
unavailable String Locked balance
available String Available balance for placing orders
currency String Currency code (e.g. BTC)
purseType String Account types

Asset Transfer

Description

This endpoint is used to transfer different coins between your own accounts. You can use this endpoint to transfer coins from your Spot account (SPTP) to your other accounts (Futures, OTC or Savings accounts) or vice-versa.

HTTP Request

POST /v2/account/transfer

Request Parameters
import requests

data= {"fromPurse": "FUTP",
       "toPurse": "SPTP",
       "currency": "BTC",
       "quantity": 0.001
      }
response = requests.post('https://api.aax.com/v2/account/transfer', json=data, auth=auth).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/account/balances?fromPurse=FUTP&toPurse=SPTP&currency=BTC&quantity=0.001'
verb='POST'
std_sign=`echo -n "${expires}:${verb}${path}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
fromPurse Yes String Sending account (Valid values: SPTP, FUTP, F2CP, VLTP)
toPurse Yes String Receiving account (Valid values: SPTP, FUTP, F2CP, VLTP)
currency Yes String Currency code (e.g. BTC)
quantity Yes Number Quantity to transfer
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
           "transferID": "177",
           "transferTime": "2020-09-06 12:00:00.000Z"
          }
 "message":"success",
 "ts":1573530401020
}
Field Data Type Description
transferID Integer Transfer ID
transferTime String Transfer time

Wallet

Query Deposit Address

Description

This endpoint is used to retreive your account's deposit addresses.

HTTP Request

GET /v2/account/deposit/address

Request Parameters
import requests
response = requests.get('https://api.aax.com/v2/account/deposit/address?currency=USDT&network=ERC20', auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/account/deposit/address?currency=USDT&network=ERC20'
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
currency Yes String Crypto currency
network No String The network for different currency,including OMNI,ERC20 and TRC20.
Network

For ERC20 tokens: network=ERC20,USDT currency with null network represents OMNI network.

Response Content

The above command returns JSON structured like this:

{
    "code": 1,
    "data": {
        "address": "0x075a753babcff7dae043f32eb4fd72bf4b9891c5",
        "tag": None,
        "currency": "USDT",
        "network": "ERC20"
    },
    "message": "success",
    "ts": 1622020499968
}
Field Data Type Description
address String Deposit address
tag String tag, memo, paymentId for particular currencies (XRP, XMR, ...)
currency String Crypto currency
network String Protocal

Get Deposit History

Description

This endpoint is used to get your accounts deposits history.

HTTP Request

GET /v2/account/deposits

Request Parameters
import requests
params = { "currency": "USDT" }
response = requests.get('https://api.aax.com/v2/account/deposits', params=params, auth=auth).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path='/v2/account/deposits?currency=ETH'
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
currency No String Currency
status No String Deposit status,"1: pending,2: confirmed, 3:failed"
startTime No Integer Default: 90 days from current timestamp.
endTime No Integer Default: present timestamp.
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data": [
     {
          "currency":"USDT",
          "network":"USDT",
          "quantity":"19.000000000000",
          "txHash":"75eb2e5f037b025c535664c49a0f7cc8f601dae218a5f4fe82290ff652c43f3d",
          "address":"1GkB7Taf7uttcguKEb2DmmyRTnihskJ9Le",
          "status":"2",
          "createdTime":"2021-01-08T19:45:01.354Z",
          "updatedTime":"2021-01-08T20:03:05.000Z",
     }
]
   "message":"success",
   "ts":1573561743499
}
Field Data Type Description
currency String Deposit currency
network String Protocol name
quantity String Deposit amount
txHash String The on-chain transaction hash
address String Deposit address
status String Deposit status. "1: pending,2: confirmed, 3:failed"
createdTime String Submit time
updatedTime String Update time

Get Withdraw History

Description

This endpoint is used to get your account withdraws history.

HTTP Request

GET /v2/account/withdraws

Request Parameters
import requests
params = { "currency": "USDT" }
response = requests.get('https://api.aax.com/v2/account/withdraws', params=params, auth=auth).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
path='/v2/account/withdraws?currency=ETH'
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
currency No String Currency
status No String Withdraw status: "0: Under Review, 1: Manual Review, 2: On Chain, 3: Review Failed, 4: On Chain, 5: Completed, 6: Failed"
startTime No Integer Default: 30 days from current timestamp.
endTime No Integer Default: present timestamp
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data": [
     {
          "currency":"USDT",
          "network":"USDT",
          "quantity":"19.000000000000",
          "fee":"0.10000"
          "txHash":"75eb2e5f037b025c535664c49a0f7cc8f601dae218a5f4fe82290ff652c43f3d",
          "address":"1GkB7Taf7uttcguKEb2DmmyRTnihskJ9Le",
          "addressTag": "",
          "status":"2",
          "createdTime":"2021-01-08T19:45:01.354Z",
          "updatedTime":"2021-01-08T20:03:05.000Z",
     }
]
   "message":"success",
   "ts":1573561743499
}
Field Data Type Description
currency String Withdrawal currency
network String Protocol name
quantity String Withdrawal amount
fee String Withdrawal fee
txHash String The on-chain transaction hash
address String Withdraw address
addressTag String Withdraw address tag
status String Withdraw status: "0: Under Review, 1: Manual Review, 2: On Chain, 3: Review Failed, 4: On Chain, 5: Completed, 6: Failed"
createdTime String Submit time
updatedTime String Update time

Spot Trading

Place Spot Order

Description

This endpoint is used for placing spot orders. See individual fields below for more details on its usage.

orderType

HTTP Request

POST /v2/spot/orders

Request Parameters
import requests

data = {
           "orderType":"LIMIT",
           "symbol":"BTCUSDT",
           "price":8000,
           "orderQty":0.02,
           "side":"BUY",
           "clOrdID":"aax"
        }


response = requests.post('https://api.aax.com/v2/spot/orders', json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/spot/orders'
data="{\"orderType\":\"LIMIT\",\"symbol\":\"BTCUSDT\",\"price\":8000,\"orderQty\":0.02,\"side\":\"BUY\", \"clOrdID\":\"aax\"}"
verb='POST'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d "${data}"`
echo "result: $output"
Parameter Required Data Type Description
orderType Yes String Accepted values: MARKET, LIMIT,STOP, STOP-LIMIT
symbol Yes String Trading symbol to trade. Convention is 'Base Currency' + 'Quote Currency'
price No String Limit price in limit and stop-limit order
orderQty Yes String Buying or selling quantity
side Yes String “BUY” or “SELL” the Base Currency
stopPrice No String Trigger price for stop-limit order or stop order
clOrdID No String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
timeInForce No String GTC/IOC/FOK, default is GTC
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "avgPrice":"0",
      "base":"BTC",
      "clOrdID":"aax",
      "commission":"0",
      "createTime":null,
      "cumQty":"0",
      "id":null,
      "isTriggered":null,
      "lastPrice":"0",
      "lastQty":"0",
      "leavesQty":"0",
      "orderID":"wJ4L366KB",
      "orderQty":"0.02",
      "orderStatus":0,
      "orderType":2,
      "price":"8000",
      "quote":"USDT",
      "rejectCode":0,
      "rejectReason":null,
      "side":1,
      "stopPrice":"0",
      "symbol":"BTCUSDT",
      "transactTime":null,
      "updateTime":null,
      "timeInForce":1,
      "execInst": "",
      "userID":"216214"
   },
   "message":"success",
   "ts":1573530401264
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
clOrdID String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
lastPrice String Price of the last fill
lastQty String Quantity of the last fill
cumQty String Cumulative filled quantity of the order
updateTime String Last update time of the order
isTriggered Boolean Used by STOP_LIMIT and STOP, True or False
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Quote Currency code, for example, 'BTC'
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
leavesQty String Outstanding quantity of the order that remains to be filled
orderID String AAX order ID
side Integer Buy or Sell the Base Currency, '1:Buy, 2:Sell'
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
stopPrice String Trigger price for stop-limit order or stop order
symbol String The trading symbol to trade. Convention is 'Base Currency + Quote Currency'
orderQty String Order quantity
transactTime String Last execution time
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
execInst String Post-Only or ''
userID String User id

Cancel Spot Order

Description

This endpoint is used to cancel an order.

HTTP Request

DELETE /v2/spot/orders/cancel/{orderID}

Request Parameters
import requests

response = requests.delete('https://api.aax.com/v2/spot/orders/cancel/vuULm8UEM', auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/spot/orders/cancel'
data="/vuULm8UEM"
verb='DELETE'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
orderID Yes String Order ID of the order to cancel
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "avgPrice":"0",
      "base":"BTC",
      "clOrdID":"aax",
      "commission":"0",
      "createTime":"2019-11-12T03:46:41Z",
      "cumQty":"0",
      "id":"114330021504606208",
      "isTriggered":false,
      "lastPrice":"0",
      "lastQty":"0",
      "leavesQty":"0",
      "orderID":"wJ4L366KB",
      "orderQty":"0.05",
      "orderStatus":1,
      "orderType":2,
      "price":"8000",
      "quote":"USDT",
      "rejectCode":0,
      "rejectReason":null,
      "side":1,
      "stopPrice":"0",
      "symbol":"BTCUSDT",
      "transactTime":null,
      "updateTime":"2019-11-12T03:46:41Z",
      "timeInForce":1,
      "execInst": "",
      "userID":"216214"
   },
   "message":"success",
   "ts":1573530402029
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
orderID String AAX order ID
clOrdID String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
lastPrice String Price of the last fill
lastQty String Quantity of the last fill
cumQty String Cumulative filled quantity of the order
updateTime String Last update time of the order
isTriggered Boolean Used by STOP_LIMIT and STOP, True or False
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Quote Currency code, for example, 'BTC'
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
leavesQty String Outstanding quantity of the order that remains to be filled
side Integer Buy or Sell the Base Currency, '1:Buy, 2:Sell'
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
stopPrice String Trigger price for stop-limit order or stop order
symbol String The trading symbol to trade. Convention is 'Base Currency + Quote Currency'
orderQty String Order quantity
transactTime String Last execution time
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
execInst String Post-Only or ''
userID String User id

Batch Cancel Spot Order

Description

This endpoint is used to batch cancel your spot orders. By default, all spot orders for the specified trading symbol will be cancelled. You can choose to only cancel a specific list of orders by either providing a list of ordersID or clOrdID.

HTTP Request

DELETE /v2/spot/orders/cancel/all

Request Parameters
import requests

data = {
          "orderID": "vBCc46OI0,vBC9rXsEE",
          "symbol" :"BTCUSDT"
       }
response = requests.delete('https://api.aax.com/v2/spot/orders/cancel/all',json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/spot/orders/cancel/all'
data="{\"symbol\":\"BTCUSDT\"}"
verb='DELETE'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d ${data}`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol to trade. Convention is 'Base Currency' + 'Quote Currency'
orderID No String List of order IDs to cancel. Use a comma ',' to separate
clOrdID No String Your customized Order IDs. Use a comma ',' to separate
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":[
      "vBC9rXsEE",
      "vBCc46OI0"
   ],
   "message":"success",
   "ts":1572597435470
}
Field Data Type Description
data Array List of orderID that will be cancelled

Cancel All Spot Orders On Timeout

Description

This endpoint can be used as protection against the events of unexpected issues such as loss of your datacenter connectivity or other network issues where you would be losing control over your orders. One can call this endpoint to set a timer (in milliseconds). The endpoint will have to be called again to 'reset the timer' before time runs out. If time runs out, all your Spot orders for all symbols will be cancelled.

In order to cancel the timer and keep your orders alive, you can pass a 'timeout' of '0'.

We recommend not to set the timeout to less than 5 seconds to avoid seeing your orders being cancelled in case of short network blips or congestion.

HTTP Request

POST /v2/spot/orders/cancelAllOnTimeout

Request Parameters
import requests

data = {
          "timeout": 30000
       }
response = requests.post('https://api.aax.com/v2/spot/orders/cancelAllOnTimeout',json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/spot/orders/cancelAllOnTimeout'
data="{\"timeout\":30000}"
verb='POST'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d ${data}`
echo "result: $output"
Parameter Required Data Type Description
timeout Yes Integer Timeout in ms. Set to 0 to cancel this timer. Max timeout is 1 hour
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
       "endTime": "2020-03-13T08:26:55Z",
       "startTime": "2020-03-13T08:26:25Z",
   }
   "message":"success",
   "ts":158408795346
}
Field Data Type Description
startTime String Timestamp of the start time in RFC3339 in UTC
endTime String Timestamp of the end time in RFC3339 in UTC

Retrieve Spot Trades

Description

This endpoint is used to retrieve your orders execution details.

HTTP Request

GET /v2/spot/trades

Request Parameters
import requests
params = {
           "pageNum":1,
           "pageSize":1,
           "base":"BTC",
           "quote":"USDT"
         }
response = requests.get('https://api.aax.com/v2/spot/trades', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/spot/trades'
data="?pageNum=1&pageSize=1&base=BTC&quote=USDT"
verb='GET'
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
pageNum No Integer Pagination page number, default '1'
pageSize No Integer Pagination page size, default '10'
orderID No String Specify order id if you want to retrieve trade details related to specific order
base No String Base Currency code, for example, 'BTC'
quote No String Quote Currency code, for example, 'BTC'
startDate No String Search starts date, format to use: yyyy-mm-dd
endDate No String Search ends date, format to use: yyyy-mm-dd
startTime No Integer Search starts time, Unix timestamps in seconds.
endTime No Integer Search ends time, Unix timestamps in seconds.
side No String Filter on the direction of the trade, BUY or SELL
orderType No String Types of order to include in the search, 'MARKET, LIMIT, STOP, STOP-LIMIT'

Note

startTime, endTime, startDate and endDate will exist at the same for a period of time,startDate and endDate take effect by default.startDate and endDate will be gradually deprecated.

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "list":[
         {
            "avgPrice":"8000",
            "base":"BTC",
            "commission":"0.00000888",
            "createTime":"2019-11-12T03:18:35Z",
            "cumQty":"0.0148",
            "filledPrice":"8000",
            "filledQty":"0.0148",
            "id":"114322949580906499",
            "leavesQty":"0.0052",
            "orderID":"wFo9ZPxAJ",
            "clOrdID":"aax",
            "tradeID":"E03GseMJLjfn",
            "orderQty":"0.02",
            "orderStatus":2,
            "orderType":2,
            "price":"8000",
            "quote":"USDT",
            "rejectCode":0,
            "rejectReason":null,
            "side":1,
            "stopPrice":"0",
            "symbol":"BTCUSDT",
            "taker":false,
            "transactTime":"2019-11-12T03:16:16Z",
            "updateTime":null,
            "userID":"216214"
         }
      ],
      "pageNum":1,
      "pageSize":1,
      "total":10
   },
   "message":"success",
   "ts":1573532934832
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
orderID String AAX order ID
clOrdID String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
tradeID String Trade ID
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
filledPrice String Price of the last fill
cumQty String Cumulative filled quantity of the order
updateTime String Last update time of the order
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Quote Currency code, for example, 'BTC'
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
leavesQty String Outstanding quantity of the order that remains to be filled
side Integer Buy or Sell the Base Currency, '1:Buy, 2:Sell'
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
stopPrice String Trigger price for stop-limit order or stop order
symbol String The trading symbol to trade. Convention is 'Base Currency + Quote Currency'
orderQty String Order quantity
transactTime String Last execution time
filledQty String Filled quantity for the trade
taker Boolean True: taker, False: maker
userID String User id
pageNum Integer Pagination page number
pageSize Integer Pagination page size
total Integer Total number of records returned from the search

Retrieve Spot Open Orders

Description

This endpoint is used to retrieve spot open orders.

HTTP Request

GET /v2/spot/openOrders

Request Parameters
import requests

params = {
           "symbol":"BTCUSDT"
         }
response = requests.get('https://api.aax.com/v2/spot/openOrders', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/spot/openOrders'
data="?symbol=BTCUSDT"
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
pageNum No Integer Pagination page number, default '1'
pageSize No Integer Pagination page size, default '10'
symbol No String Trading symbol to trade. Convention is 'Base Currency' + 'Quote Currency'
orderID No String AAX order ID
side No String Filter on the direction of the trade, BUY or SELL
clOrdID No String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "list":[
         {
            "avgPrice":"0",
            "base":"BTC",
            "clOrdID":"aax",
            "commission":"0",
            "createTime":"2019-11-12T03:41:52Z",
            "cumQty":"0",
            "isTriggered":false,
            "lastPrice":"0",
            "lastQty":"0",
            "leavesQty":"0",
            "orderID":"wJ3qitASB",
            "orderQty":"0.02",
            "orderStatus":1,
            "orderType":2,
            "price":"8000",
            "quote":"USDT",
            "rejectCode":0,
            "rejectReason":null,
            "side":1,
            "stopPrice":"0",
            "symbol":"BTCUSDT",
            "transactTime":null,
            "updateTime":"2019-11-12T03:41:52Z",
            "timeInForce":1,
            "execInst": "",
            "userID":"216214"
         },
         ...
      ],
      "pageNum":1,
      "pageSize":2,
      "total":2
   },
   "message":"success",
   "ts":1573553718212
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
orderID String AAX order ID
clOrdID String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
lastPrice String Price of the last fill
lastQty String Quantity of the last fill
cumQty String Cumulative filled quantity of the order
updateTime String Last update time of the order
isTriggered Boolean Used by STOP_LIMIT and STOP, True or False
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Quote Currency code, for example, 'BTC'
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
leavesQty String Outstanding quantity of the order that remains to be filled
side Integer Buy or Sell the Base Currency, '1:Buy, 2:Sell'
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
stopPrice String Trigger price for stop-limit order or stop order
symbol String The trading symbol to trade. Convention is 'Base Currency + Quote Currency'
orderQty String Order quantity
transactTime String Last execution time
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
execInst String Post-Only or ''
userID String User id
pageNum Integer Pagination page number
pageSize Integer Pagination page size
total Integer Total number of records returned from the search

Retrieve Spot Historical Order(s)

Description

This endpoint is used to query historical orders.

HTTP Request

GET /v2/spot/orders

Request Parameters
import requests

params = {
           "side":"BUY"
         }
response = requests.get('https://api.aax.com/v2/spot/orders', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/spot/orders'
data="?orderID=vBGlDcLwk&side=BUY"
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
pageNum No Integer Pagination page number, default '1'
pageSize No Integer Pagination page size, default '10'
symbol No String Trading symbol to trade. Convention is 'Base Currency' + 'Quote Currency'
orderID No String AAX order ID
base No String Base Currency code, for example, 'BTC'
quote No String Quote Currency code, for example, 'BTC'
orderStatus No Integer Status of orders to include in the search, '1:new, 2:filled, 3:cancel'
startDate No String Search starts date, format to use: yyyy-mm-dd
endDate No String Search ends date, format to use: yyyy-mm-dd
startTime No Integer Search starts time, Unix timestamps in seconds.
endTime No Integer Search ends time, Unix timestamps in seconds.
orderType No String Types of order to include in the search, 'MARKET, LIMIT, STOP, STOP-LIMIT'
side No String Filter on the direction of the trade, BUY or SELL
clOrdID No String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.

Note

startTime, endTime, startDate and endDate will exist at the same for a period of time,startDate and endDate take effect by default.startDate and endDate will be gradually deprecated.

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "total":19,
      "pageSize":10,
      "list":[
         {
            "orderType":2,
            "symbol":"BTCUSDT",
            "avgPrice":"0",
            "orderStatus":0,
            "userID":"7225",
            "quote":"USDT",
            "rejectReason":null,
            "rejectCode":0,
            "price":"0",
            "orderQty":"0.002",
            "commission":"0",
            "isTriggered":null,
            "side":1,
            "orderID":"vBGlDcLwk",
            "cumQty":"0",
            "leavesQty":"0",
            "updateTime":null,
            "clOrdID":"0001",
            "lastQty":"0",
            "stopPrice":"0",
            "createTime":"2019-11-01T08:49:33Z",
            "transactTime":null,
            "timeInForce":1,
            "execInst": "",
            "base":"BTC",
            "lastPrice":"0"
         }
      ],
      "pageNum":1
   },
   "message":"success",
   "ts":1572598173682
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
orderID String AAX order ID
clOrdID String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
lastPrice String Price of the last fill
lastQty String Quantity of the last fill
cumQty String Cumulative filled quantity of the order
updateTime String Last update time of the order
isTriggered Boolean Used by STOP_LIMIT and STOP, True or False
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Quote Currency code, for example, 'BTC'
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
leavesQty String Outstanding quantity of the order that remains to be filled
side Integer Buy or Sell the Base Currency, '1:Buy, 2:Sell'
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
stopPrice String Trigger price for stop-limit order or stop order
symbol String The trading symbol to trade. Convention is 'Base Currency + Quote Currency'
orderQty String Order quantity
transactTime String Last execution time
execInst String Post-Only or ''
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
userID String User id
pageNum Integer Pagination page number
pageSize Integer Pagination page size
total Integer Total number of records returned from the search

Futures Trading

Place Futures Order

Description

This endpoint is used for placing futures orders. See individual fields below for more details on its usage.

orderType

TimeInForce

timeInForce is a special instruction used when placing an order to indicate how long the order will remain active before it is executed or expires.

liqType

settleType

Parameter Settlement currency Example Description
Inverse Settlement Base Currency Settlement BTCUSDFP The settlement of the futures contract is calculated using BTC, the Base Currency
Vanilla Settlement Quote Currency Settlement EOSBTCFP The settlement of the futures contract is calculated using BTC, the Quote Currency
HTTP Request

POST /v2/futures/orders

Request Parameters
import requests

data= {
       "orderType":"LIMIT",
       "symbol":"BTCUSDFP",
       "price":8000,
       "orderQty":100,
       "side":"BUY",
       "clOrdID":"aax_futures"
      }
response=requests.post('https://api.aax.com/v2/futures/orders',json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/orders'
data="{\"orderType\":\"LIMIT\",\"symbol\":\"BTCUSDFP\",\"price\":8000,\"orderQty\":100,\"side\":\"BUY\", \"clOrdID\":\"aax_futures\"}"
verb='POST'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d "${data}"`
echo "result: $output"
Parameter Required Data Type Description
orderType Yes String Accepted values: MARKET, LIMIT,STOP, STOP-LIMIT
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
price No String Limit price in limit and stop-limit order
orderQty Yes String This is the quantity of contracts you wish to buy or sell
side Yes String 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
stopPrice No String Trigger price for stop-limit order or stop order
clOrdID No String Client order ID
execInst No String Optional execution instructions. Valid options: Post-Only. By using Post-Only orders, your order limit order will be cancelled if this order would have executed on placement.
timeInForce No String GTC/IOC/FOK, default is GTC
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "avgPrice":"0",
      "base":"BTC",
      "clOrdID":"aax_futures",
      "code":"FP",
      "commission":"0",
      "createTime":null,
      "cumQty":"0",
      "id":"114375893764395008",
      "isTriggered":null,
      "lastPrice":"0",
      "lastQty":null,
      "leavesQty":"100",
      "leverage":"1",
      "liqType":0,
      "marketPrice":"8760.7500000000",
      "orderID":"wJTewQc81",
      "orderQty":"100",
      "orderStatus":0,
      "orderType":2,
      "price":"8000",
      "quote":"USD",
      "rejectCode":0,
      "rejectReason":null,
      "settleType":"INVERSE",
      "side":1,
      "stopPrice":"0",
      "symbol":"BTCUSDFP",
      "transactTime":null,
      "updateTime":null,
      "timeInForce":1,
      "execInst": "",
      "userID":"216214"
   },
   "message":"success",
   "ts":1573541338074
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
clOrdID String Client order ID
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
cumQty String Cumulative filled quantity of the order
lastPrice String Price of the last fill
leavesQty String Outstanding quantity of the order that remains to be filled
leverage String leverage
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
marketPrice String Market price. (best bid + best ask)/2
orderID String AAX order ID
orderQty String Order quantity
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Base Currency code, for example, 'BTC'
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
side Integer 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
stopPrice String Trigger price for stop-limit order or stop order
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
transactTime String Last execution time
updateTime String Last update time of the order
execInst String Post-Only or ''
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
userID String User id

Cancel Futures Order

Description

This endpoint is used to cancel an order.

HTTP Request

DELETE /v2/futures/orders/cancel/{orderID}

Request Parameters
import requests

response = requests.delete('https://api.aax.com/v2/futures/orders/cancel/wJTewQc81', auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/orders/cancel'
data="/wJTewQc81"
verb='DELETE'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
orderID Yes String Order ID of the order to cancel
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "avgPrice":"0",
      "base":"BTC",
      "clOrdID":"aax_futures",
      "code":"FP",
      "commission":"0",
      "createTime":"2019-11-12T06:48:58Z",
      "cumQty":"0",
      "id":"114375893764395008",
      "isTriggered":false,
      "lastPrice":"0",
      "lastQty":null,
      "leavesQty":"300",
      "leverage":"1",
      "liqType":0,
      "marketPrice":"8760.75",
      "orderID":"wJTewQc81",
      "orderQty":"300",
      "orderStatus":1,
      "orderType":2,
      "price":"8000",
      "quote":"USD",
      "rejectCode":0,
      "rejectReason":null,
      "settleType":"INVERSE",
      "side":1,
      "stopPrice":"0",
      "symbol":"BTCUSDFP",
      "transactTime":"2019-11-12T06:48:58Z",
      "updateTime":"2019-11-12T06:48:58Z",
      "timeInForce":1,
      "execInst": "",
      "userID":"216214"
   },
   "message":"success",
   "ts":1573541642970
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
clOrdID String Client order ID
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
cumQty String Cumulative filled quantity of the order
lastPrice String Price of the last fill
leavesQty String Outstanding quantity of the order that remains to be filled
leverage String leverage
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
marketPrice String Market price. (best bid + best ask)/2
orderID String AAX order ID
orderQty String Order quantity
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Base Currency code, for example, 'BTC'
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
side Integer 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
stopPrice String Trigger price for stop-limit order or stop order
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
transactTime String Last execution time
updateTime String Last update time of the order
execInst String Post-Only or ''
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
userID String User id

Batch Cancel Futures Order

Description

This endpoint is used to batch cancel your futures orders.

HTTP Request

DELETE /v2/futures/orders/cancel/all

Request Parameters
import requests

data = {
           "symbol":"BTCUSDFP"
       }
response = requests.delete('https://api.aax.com/v2/futures/orders/cancel/all', json=data,auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/orders/cancel/all'
data="{\"symbol\":\"BTCUSDFP\"}"
verb='DELETE'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d ${data}`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
orderID No String List of order IDs to cancel. Use a comma ',' to separate
clOrdID No String Your customized Order IDs. Use a comma ',' to separate
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":[
      "wKQf3hpV7"
   ],
   "message":"success",
   "ts":1573556374435
}
Field Data Type Description
data Array List of orderID that will be cancelled

Cancel All Futures Orders On Timeout

Description

This endpoint can be used as protection against the events of unexpected issues such as loss of your datacenter connectivity or other network issues where you would be losing control over your orders. One can call this endpoint to set a timer (in milliseconds). The endpoint will have to be called again to 'reset the timer' before time runs out. If time runs out, all your Spot orders for all symbols will be cancelled.

In order to cancel the timer and keep your orders alive, you can pass a 'timeout' of '0'.

We recommend not to set the timeout to less than 5 seconds to avoid seeing your orders being cancelled in case of short network blips or congestion.

HTTP Request

POST /v2/futures/orders/cancelAllOnTimeout

Request Parameters
import requests

data = {
          "timeout": 30000
       }
response = requests.post('https://api.aax.com/v2/futures/orders/cancelAllOnTimeout',json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/orders/cancelAllOnTimeout'
data="{\"timeout\":30000}"
verb='POST'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d ${data}`
echo "result: $output"
Parameter Required Data Type Description
timeout Yes Integer Timeout in ms. Set to 0 to cancel this timer. Max timeout is 1 hour
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
       "endTime": "2020-03-13T08:26:55Z",
       "startTime": "2020-03-13T08:26:25Z",
   }
   "message":"success",
   "ts":158408795346
}
Field Data Type Description
startTime String Timestamp of the start time in RFC3339 in UTC
endTime String Timestamp of the end time in RFC3339 in UTC

Retrieve Futures Position

Description

This endpoint is used to get positions for all contracts.

HTTP Request

GET /v2/futures/position

Request Parameters
import requests

params = {
           "symbol":"BTCUSDFP"
         }
response = requests.get('https://api.aax.com/v2/futures/position', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/position'
data="?symbol=BTCUSDFP"
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
symbol No String Specify a futures contract symbol if you would like to see your position only for that futures. Convention is 'Base Currency + Quote Currency + FP'
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":[
      {
         "autoMarginCall":false,
         "avgEntryPrice":"0",
         "bankruptPrice":null,
         "base":"BTC",
         "code":"FP",
         "commission":"0",
         "funding":"0",
         "currentQty":"0",
         "fundingStatus":0,
         "id":"114375893760200704",
         "leverage":"1",
         "liquidationPrice":null,
         "marketPrice":null,
         "openTime":null,
         "posLeverage":"1",
         "posMargin":"0",
         "quote":"USD",
         "stopLossPrice":"9211",
         "stopLossSource":1,
         "takeProfitPrice":"9400",
         "takeProfitSource":1,
         "realisedPnl":"0",
         "unrealisedPnl":"0",
         "riskLimit":"1000000",
         "riskyPrice":"0",
         "settleType":"INVERSE",
         "symbol":"BTCUSDFP",
         "userID":"216214"
      }
   ],
   "message":"success",
   "ts":1573541723519
}
Field Data Type Description
autoMarginCall Boolean Enable the function of automatically increasing margin or not, true means function on,false means function off.
avgEntryPrice String Average executed buy/sell price for your current long/short position
bankruptPrice String Bankruptcy price
base String Base Currency code, for example, 'BTC'
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received since opening the position.Positive sign means paid
currentQty String Your current position on this instrument. If positive, you are long, if negative, short
funding String Funding amount in BTC received/paid since opening the position. Positive sign means received, negative means paid
fundingStatus Integer Funding status. The enumeration values are 0(settling) and 1(settled), otherwise, it will be null.
posMargin String Position margin
leverage String Position leverage
liquidationPrice String The liquidation price after the trade was processed
marketPrice String Market price. (best bid + best ask)/2
openTime String Position creation timestamp in UTC
quote String Base Currency code, for example, 'BTC'
stopLossPrice String Stop loss price
stopLossSource Integer Trigger price type.'1: Last Price; 2: Mark Price; 3: Index; 4: Mid Price.'
takeProfitPrice String Take profit price
takeProfitSource Integer Trigger price type.'1: Last Price; 2: Mark Price; 3: Index; 4: Mid Price.'
realisedPnl String Realised profit and loss since opening this position
unrealisedPnl String Unrealised profit and loss
riskyPrice String Risky price, this is for internal processing only
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
userID String User id

Set Position Take Profit and Stop Loss

Description

This endpoint is used to set take profit and stop loss orders for an opening position

HTTP Request

POST /v2/futures/position/sltp

Request Parameters
import requests

data =
{
  "stopLossPrice": "9211",
  "stopLossStatus": 1,
  "symbol": "BTCUSDFP",
  "side":"BUY"
  "takeProfitPrice": "9400",
  "takeProfitStatus": 1
}
response = requests.post('https://api.aax.com/v2/futures/position/sltp', json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
path='/v2/futures/position/sltp'
data="{\"stopLossPrice\":\"9211\",\"stopLossStatus\":1,\"symbol\":\"BTCUSDTFP\",\"side\":\"BUY\",\"takeProfitPrice\":\"9411\",\"takeProfitStatus\":1}"
verb='POST'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d "${data}"`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
side Yes String 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
stopLossPrice No String Stop loss price
stopLossStatus No Integer Enable stop loss. '0: No, 1: Yes'
takeProfitPrice No String Take profit price
takeProfitStatus No Integer Enable take profit. '0: No, 1: Yes'

Note

Response Content

The above command returns JSON structured like this:

{
    "code":1,
    "data":{
        "side":"1",
        "stopLossExpiration":"2020-08-02T11:36:13.000Z",
        "stopLossOrderId":"WnzsF613y",
        "stopLossPrice":"9211",
        "stopLossSource":1,
        "stopLossStatus":1,
        "symbol":"BTCUSDTFP",
        "takeProfitExpiration":"2020-08-02T11:36:13.000Z",
        "takeProfitOrderId":"WnzsF8drO",
        "takeProfitPrice":"9400",
        "takeProfitSource":1,
        "takeProfitStatus":1
    },
    "message":"success",
    "timestamp":"2020-07-16 10:55:44"
}
Field Data Type Description
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
side Integer Take Profit and Stop Loss Direction.'1:Long,2:Short'
stopLossPrice String Stop loss price
stopLossSource Integer Trigger price type.'1: Last Price; 2: Mark Price; 3: Index; 4: Mid Price.'
stopLossStatus Integer Enable stop loss. '0: No, 1: Yes'
stopLossOrderID String Stop loss order ID
stopLossExpiration String Stop loss expiration
takeProfitPrice String Take profit price
takeProfitSource Integer Trigger price type.'1: Last Price; 2: Mark Price; 3: Index; 4: Mid Price.'
takeProfitStatus Integer Enable take profit. '0: No, 1: Yes'
takeProfitOrderID String Take profit order ID
takeProfitExpiration String Take profit expiration

Close Futures Position

Description

This endpoint is used to close position.

HTTP Request

POST /v2/futures/position/close

Request Parameters
import requests

data = {
           "symbol":"BTCUSDFP"
       }
response = requests.post('https://api.aax.com/v2/futures/position/close', json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/position/close'
data="{\"symbol\": \"BTCUSDFP\"}"
verb='POST'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d "${data}"`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
price No String Limit price

Note

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "avgPrice":"0",
      "base":"BTC",
      "clOrdID":null,
      "code":"FP",
      "commission":"0",
      "createTime":null,
      "cumQty":"0",
      "id":null,
      "isTriggered":null,
      "lastPrice":"0",
      "lastQty":null,
      "leavesQty":"100",
      "leverage":"1",
      "liqType":1,
      "marketPrice":"8769.7500000000",
      "orderID":"wJXURIFBT",
      "orderQty":"100",
      "orderStatus":0,
      "orderType":1,
      "price":"8769.7500000000",
      "quote":"USD",
      "rejectCode":0,
      "rejectReason":null,
      "settleType":"INVERSE",
      "side":2,
      "stopPrice":"0",
      "symbol":"BTCUSDFP",
      "transactTime":null,
      "updateTime":null,
      "timeInForce":1,
      "execInst": "",
      "userID":"216214"
   },
   "message":"success",
   "ts":1573542352735
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
clOrdID String Client order ID
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received since opening the position.Positive sign means paid
createTime String Time at which the order was submitted
cumQty String Cumulative filled quantity of the order
lastPrice String Price of the last fill
leavesQty String Outstanding quantity of the order that remains to be filled
leverage String Position leverage
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
marketPrice String Market price. (best bid + best ask)/2
orderID String AAX order ID
orderQty String Order quantity
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Base Currency code, for example, 'BTC'
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
side Integer 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
stopPrice String Trigger price for stop-limit order or stop order
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
execInst String Post-Only or ''
transactTime String Last execution time
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
updateTime String Last update time of the order
userID String User id

Retrieve Futures Closed Position

Description

This endpoint is used to retrieve closed position.

HTTP Request

GET /v2/futures/position/closed

Request Parameters
import requests

params = {
           "symbol":"BTCUSDFP"
         }
response = requests.get('https://api.aax.com/v2/futures/position/closed', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/position'
path='/v2/futures/position/closed'
data="?symbol=BTCUSDFP"
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
pageNum No Integer Pagination page number, default '1'
pageSize No Integer Pagination page size, default '10'
symbol No String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
startDate No String Search starts date, format to use: yyyy-mm-dd
endDate No String Search ends date, format to use: yyyy-mm-dd
startTime No Integer Search starts time, Unix timestamps in seconds.
endTime No Integer Search ends time, Unix timestamps in seconds.
pnlType No String The pnl type, 'profit or loss'
beforeHours No Integer Search orders before n hours, e.g '8'

Note

startTime, endTime, startDate and endDate will exist at the same for a period of time,startDate and endDate take effect by default.startDate and endDate will be gradually deprecated.

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "list":[
         {
            "base":"BTC",
            "closeTime":"2019-11-07T07:23:56.000Z",
            "code":"FP",
            "commission":"0.00000625",
            "funding":"0",
            "id":"112572754530816000",
            "openTime":"2019-11-07T07:23:35.000Z",
            "pnl":"-0.00030901",
            "quote":"USD",
            "realisedPnl":"-0.00030276",
            "symbol":"BTCUSDFP",
            "userID":"216214"
         },
         {
            "base":"BTC",
            "closeTime":"2019-11-06T09:02:37.000Z",
            "code":"FP",
            "commission":"0.00000957",
            "funding":"-0.00000128",
            "id":"112235202187776000",
            "openTime":"2019-11-06T08:50:48.000Z",
            "pnl":"-0.00001255",
            "quote":"USD",
            "realisedPnl":"-0.0000017",
            "symbol":"BTCUSDFP",
            "userID":"216214"
         }
      ],
      "pageNum":1,
      "pageSize":10,
      "total":2
   },
   "message":"success",
   "ts":1573542067453
}
Field Data Type Description
base String Base Currency code, for example, 'BTC'
closeTime String Close position time
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received since opening the position.Positive sign means paid
funding String Funding amount in BTC received/paid since opening the position. Positive sign means received, negative means paid
openTime String Position creation timestamp in UTC
pnl String The retained profit and loss
quote String Base Currency code, for example, 'BTC'
realisedPnl String Realised profit and loss since opening this position
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
userID String User id
pageNum Integer Pagination page number
pageSize Integer Pagination page size
total Integer Total number of records returned from the search

Futures Update Leverage

Description

This endpoint is used to update the leverage for a futures position.

HTTP Request

POST /v2/futures/position/leverage

Request Parameters
import requests

data = {
           "symbol":"BTCUSDFP",
           "leverage":10
       }
response = requests.post('https://api.aax.com/v2/futures/position/leverage', json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/position/leverage'
data="{\"symbol\": \"BTCUSDFP\", \"leverage\": 10}"
verb='POST'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d "${data}"`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
leverage Yes Integer 1-100x leverage, e.g. 10
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "autoMarginCall":false,
      "avgEntryPrice":"0",
      "bankruptPrice":"0",
      "base":"BTC",
      "code":"FP",
      "commission":"0",
      "currentQty":"0",
      "funding":"0",
      "fundingStatus":0,
      "id":"114375893760200704",
      "leverage":"10",
      "liquidationPrice":"0",
      "marketPrice":null,
      "openTime":null,
      "posLeverage":"0",
      "posMargin":"0",
      "quote":"USD",
      "stopLossPrice":"9211",
      "stopLossSource":1,
      "takeProfitPrice":"9400",
      "takeProfitSource":1,
      "realisedPnl":"0",
      "unrealisedPnl":"0",
      "riskLimit":"1000000",
      "riskyPrice":"0",
      "settleType":"INVERSE",
      "symbol":"BTCUSDFP",
      "userID":"216214"
   },
   "message":"success",
   "ts":1573542445411
}
Field Data Type Description
autoMarginCall Boolean Enable the function of automatically increasing margin or not, true means function on,false means function off.
avgEntryPrice String Average executed buy/sell price for your current long/short position
bankruptPrice String Bankruptcy price
base String Base Currency code, for example, 'BTC'
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received since opening the position.Positive sign means paid
currentQty String Your current position on this instrument. If positive, you are long, if negative, short
funding String Funding amount in BTC received/paid since opening the position. Positive sign means received, negative means paid
fundingStatus Integer Funding status. The enumeration values are 0(settling) and 1(settled), otherwise, it will be null.
posMargin String Position margin
leverage String Position leverage
liquidationPrice String The liquidation price after the trade was processed
marketPrice String Market price. (best bid + best ask)/2
openTime String Position creation timestamp in UTC
quote String Base Currency code, for example, 'BTC'
stopLossPrice String Stop loss price
stopLossSource Integer Trigger price type.'1: Last Price; 2: Mark Price; 3: Index; 4: Mid Price.'
takeProfitPrice String Take profit price
takeProfitSource Integer Trigger price type.'1: Last Price; 2: Mark Price; 3: Index; 4: Mid Price.'
realisedPnl String Realised profit and loss since opening this position
unrealisedPnl String Unrealised profit and loss
riskyPrice String Risky price, this is for internal processing only
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
userID String User id

Modify Isolated Position Margin

Description

The endpoint uses to modify isolated position margin.

HTTP Request

POST /v2/futures/position/margin

Request Parameters
import requests

data = {
           "symbol":"BTCUSDFP",
           "margin":0.001
       }
response = requests.post('https://api.aax.com/v2/futures/position/margin', json=data, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/position/margin'
data="{\"symbol\": \"BTCUSDFP\", \"margin\": 0.001}"
verb='POST'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"\
 -d "${data}"`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
margin Yes Integer Margin
Response Content

The above command returns JSON structured like this:

{"code": 1,
 "data": {
          "autoMarginCall":false,
          "avgEntryPrice": "9236.00000000042578",
          "bankruptPrice": "9301.8425207",
          "base": "BTC",
          "code": "FP",
          "commission": "0.00017138",
          "currentQty": "-2320",
          "funding": "0",
          "fundingStatus": 0,
          "id": "173181324568178688",
          "leverage": "10",
          "liquidationPrice": "9247.5",
          "marketPrice": None,
          "openTime": None,
          "posLeverage": "141.28",
          "posMargin": "0.001",
          "quote": "USD",
          "realisedPnl": "-0.00060578",
          "unrealisedPnl":"0",
          "riskLimit": "1000000",
          "riskyPrice": "9242.5",
          "settleType": "INVERSE",
          "stopLossPrice": "0",
          "stopLossSource": None,
          "symbol": "BTCUSDFP",
          "takeProfitPrice": "0",
          "takeProfitSource": None,
          "userID": "213409"
          },
 "message": "success",
 "ts": 1594214994104}
Field Data Type Description
autoMarginCall Boolean Enable the function of automatically increasing margin or not, true means function on,false means function off.
avgEntryPrice String Average executed buy/sell price for your current long/short position
bankruptPrice String Bankruptcy price
base String Base Currency code, for example, 'BTC'
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received since opening the position.Positive sign means paid
currentQty String Your current position on this instrument. If positive, you are long, if negative, short
funding String Funding amount in BTC received/paid since opening the position. Positive sign means received, negative means paid
fundingStatus Integer Funding status. The enumeration values are 0(settling) and 1(settled), otherwise, it will be null.
posMargin String Position margin
leverage String Position leverage
liquidationPrice String The liquidation price after the trade was processed
marketPrice String Market price. (best bid + best ask)/2
openTime String Position creation timestamp in UTC
quote String Base Currency code, for example, 'BTC'
realisedPnl String Realised profit and loss since opening this position
unrealisedPnl String Unrealised profit and loss
riskyPrice String Risky price, this is for internal processing only
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
userID String User id

Retrieve Futures Trades

Description

This endpoint is used to retrieve execution details for your futures orders.

HTTP Request

GET /v2/futures/trades

Request Parameters
import requests

params = {
           "symbol":"BTCUSDFP"
         }
response = requests.get('https://api.aax.com/v2/futures/trades', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/trades'
data="?symbol=BTCUSDFP"
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
pageNum No Integer Pagination page number, default '1'
pageSize No Integer Pagination page size, default '10'
orderID No String AAX order ID
symbol No String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
base No String Base Currency code, for example, 'BTC'
quote No String Quote Currency code, for example, 'BTC'
startDate No String Search starts date, format to use: yyyy-mm-dd
endDate No String Search ends date, format to use: yyyy-mm-dd
startTime No Integer Search starts time, Unix timestamps in seconds.
endTime No Integer Search ends time, Unix timestamps in seconds.
side No String Filter on the direction of the trade, 'BUY or SELL, Long:BUY, Short:SELL'
orderType No String The types of order to include in the search, 'MARKET, LIMIT, STOP-LIMIT, STOP, LIQ, MARKET-CLOSING, LIMIT-CLOSING'

Note

startTime, endTime, startDate and endDate will exist at the same for a period of time,startDate and endDate take effect by default.startDate and endDate will be gradually deprecated.

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "list":[
         {
            "base":"BTC",
            "commission":"0.00000913",
            "createTime":"2019-11-12T07:05:52.000Z",
            "filledPrice":"8769",
            "filledQty":"-100",
            "leavesQty":"0",
            "leverage":null,
            "liqType":1,
            "liquidationPrice":null,
            "orderID":"wJXURIFBT",
            "clOrdID":"aax_futures",
            "tradeID":"g04GsqjJT8vl",
            "orderStatus":3,
            "orderType":1,
            "quote":"USD",
            "price":"9369.75",
            "realisedPnl":"-0.00000196",
            "side":2,
            "symbol":"BTCUSDFP",
            "taker":true,
            "transactTime":"2019-11-12T07:05:52.000Z",
            "updateTime":null,
            "timeInForce":1,
            "userID":"216214"
         },
         {
            "base":"BTC",
            "commission":"0.00000913",
            "createTime":"2019-11-12T07:05:52.000Z",
            "filledPrice":"8770.5",
            "filledQty":"100",
            "id":"114380147677843457",
            "leavesQty":"0",
            "leverage":null,
            "liqType":0,
            "liquidationPrice":null,
            "orderID":"wJXUHKvFn",
            "tradeID":"E03GseMJLjfn",
            "orderStatus":3,
            "orderType":1,
            "quote":"USD",
            "realisedPnl":"0",
            "side":1,
            "symbol":"BTCUSDFP",
            "taker":true,
            "transactTime":"2019-11-12T07:05:52.000Z",
            "updateTime":null,
            "timeInForce":1,
            "userID":"216214"
         },
         ...
      ],
      "pageNum":1,
      "pageSize":10,
      "total":15
   },
   "message":"success",
   "ts":1573545435652
}
Field Data Type Description
base String Base Currency code, for example, 'BTC'
commission String Total commission paid/received since opening the position.Positive sign means paid
filledPrice String Fill price for the trade
filledQty String Filled quantity for the trade
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
leavesQty String Outstanding quantity of the order that remains to be filled
leverage String Position leverage
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
liquidationPrice String The liquidation price after the trade was processed
orderID String AAX order ID
clOrdID String Client order ID
tradeID String Trade ID
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Base Currency code, for example, 'BTC'
realisedPnl String Realised profit and loss since opening this position
side Integer 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
transactTime String Last execution time
updateTime String Last update time of the order
userID String User id
pageNum Integer Pagination page number
pageSize Integer Pagination page size
total Integer Total number of records returned from the search

Retrieve Futures Open Orders

Description

This endpoint is used to retrieve futures open orders.

HTTP Request

GET /v2/futures/openOrders

Request Parameters
import requests

params = {
           "symbol":"BTCUSDFP"
         }
response = requests.get('https://api.aax.com/v2/futures/openOrders', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/openOrders'
data="?symbol=BTCUSDFP"
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
pageNum No Integer Pagination page number, default '1'
pageSize No Integer Pagination page size, default '10'
symbol No String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
orderID No String AAX order ID
side No String Filter on the direction of the trade, 'BUY or SELL, Long:BUY, Short:SELL'
clOrdID No String Client order ID
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "list":[
         {
            "avgPrice":"0",
            "base":"BTC",
            "clOrdID":"aax_futures",
            "code":"FP",
            "commission":"0",
            "createTime":"2019-11-12T10:22:03.000Z",
            "cumQty":"0",
            "id":"114429520856076288",
            "isTriggered":false,
            "lastPrice":"0",
            "lastQty":null,
            "leavesQty":"100",
            "leverage":"1",
            "liqType":0,
            "marketPrice":"8759.25",
            "orderID":"wKQf3hpV7",
            "orderQty":"100",
            "orderStatus":1,
            "orderType":2,
            "price":"8000",
            "quote":"USD",
            "rejectCode":0,
            "rejectReason":null,
            "settleType":"INVERSE",
            "side":1,
            "stopPrice":"0",
            "symbol":"BTCUSDFP",
            "transactTime":null,
            "updateTime":"2019-11-12T10:22:03.000Z",
            "timeInForce":1,
            "execInst": "",
            "userID":"216214"
         }
      ],
      "pageNum":1,
      "pageSize":1,
      "total":1
   },
   "message":"success",
   "ts":1573554124003
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
clOrdID String Client order ID
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
cumQty String Cumulative filled quantity of the order
lastPrice String Price of the last fill
lastQty String Quantity of the last fill
leavesQty String Outstanding quantity of the order that remains to be filled
leverage String Position leverage
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
marketPrice String Market price. (best bid + best ask)/2
orderID String AAX order ID
orderQty String Order quantity
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Base Currency code, for example, 'BTC'
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
side Integer 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
stopPrice String Trigger price for stop-limit order or stop order
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
transactTime String Last execution time
updateTime String Last update time of the order
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
execInst String Post-Only or ''
userID String User id
pageNum Integer Pagination page number
pageSize Integer Pagination page size
total Integer Total number of records returned from the search

Retrieve Futures Historical Order(s)

Description

This endpoint is used to retrieve historical orders.

HTTP Request

GET /v2/futures/orders

Request Parameters
import requests

params = {
           "symbol":"BTCUSDFP",
           "orderType":"LIMIT"
         }
response = requests.get('https://api.aax.com/v2/futures/orders', params=params, auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/orders'
data="?symbol=BTCUSDFP&orderType=LIMIT"
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
pageNum No Integer Pagination page number, default '1'
pageSize No Integer Pagination page size, default '10'
symbol No String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
orderID No String AAX order ID
base No String Base Currency code, for example, 'BTC'
quote No String Quote Currency code, for example, 'BTC'
orderStatus No Integer Status of orders to include in the search, '1:new, 2:filled, 3:cancel'
startDate No String Search starts date, format to use: yyyy-mm-dd
endDate No String Search ends date, format to use: yyyy-mm-dd
startTime No Integer Search starts time, Unix timestamps in seconds.
endTime No Integer Search ends time, Unix timestamps in seconds.
side No String Filter on the direction of the trade, 'BUY or SELL, Long:BUY, Short:SELL'
orderType No String Types of order to include in the search, 'MARKET, LIMIT, STOP, STOP-LIMIT'
clOrdID No String Client order ID

Note

startTime, endTime, startDate and endDate will exist at the same for a period of time,startDate and endDate take effect by default.startDate and endDate will be gradually deprecated.

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "list":[
         {
            "avgPrice":"8768.99999999484997",
            "base":"BTC",
            "clOrdID":null,
            "code":"FP",
            "commission":"0.00000913",
            "createTime":"2019-11-12T07:05:52.000Z",
            "cumQty":"100",
            "id":"114380149603028993",
            "isTriggered":false,
            "lastPrice":"8769",
            "lastQty":"100",
            "leavesQty":"0",
            "leverage":"1",
            "liqType":1,
            "marketPrice":"8769.75",
            "orderID":"wJXURIFBT",
            "orderQty":"100",
            "orderStatus":3,
            "orderType":1,
            "price":"8769.75",
            "quote":"USD",
            "rejectCode":0,
            "rejectReason":null,
            "settleType":"INVERSE",
            "side":2,
            "stopPrice":"0",
            "symbol":"BTCUSDFP",
            "transactTime":"2019-11-12T07:05:52.000Z",
            "updateTime":"2019-11-12T07:05:52.000Z",
            "timeInForce":1,
            "execInst": "",
            "userID":"216214"
         },
         ...
      ],
      "pageNum":1,
      "pageSize":10,
      "total":21
   },
   "message":"success",
   "ts":1573546960172
}
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
clOrdID String Client order ID
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
cumQty String Cumulative filled quantity of the order
lastPrice String Price of the last fill
lastQty String Quantity of the last fill
leavesQty String Outstanding quantity of the order that remains to be filled
leverage String leverage
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
marketPrice String Market price. (best bid + best ask)/2
orderID String AAX order ID
orderQty String Order quantity
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Base Currency code, for example, 'BTC'
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
side Integer 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
stopPrice String Trigger price for stop-limit order or stop order
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
transactTime String Last execution time
updateTime String Last update time of the order
timeInForce Integer '1: GTC, 3: IOC, 4: FOK'
execInst String Post-Only or ''
userID String User id
pageNum Integer Pagination page number
pageSize Integer Pagination page size
total Integer Total number of records returned from the search

Get Predicted Funding Fee

Description

This endpoint is used to get predicted funding fee

HTTP Request

GET /v2/futures/funding/predictedFundingFee/{symbol}

Request Parameters
import requests

response = requests.get('https://api.aax.com/v2/futures/funding/predictedFundingFee/BTCUSDFP', auth=auth).json()
print(response)
#!/usr/bin/env bash

domain="https://api.aax.com"
api_key=""
api_secret=""
path='/v2/futures/funding/predictedFundingFee/'
data="BTCUSDFP"
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}"`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":{
      "predictedFundingRate": "0.001",
      "predictedFundingFee": "0.000234",
      "nextFundingTime":  "2020-02-12T08:00:00.000Z"
   },
   "message":"success",
   "ts":1573542445411
}
Field Data Type Description
predictedFundingRate String Predicted funding rate. When the funding rate is positive, longs pay shorts. When it is negative, shorts pay longs.
predictedFundingFee String Predicted funding fee
nextFundingTime String Next funding time with UTC time

Get Historical Funding Fee

Description

This endpoint is used to get historical funding fee for a specific futures symbol.

HTTP Request

GET /v2/futures/funding/fundingFee

Request Parameters
import requests
params = {"symbol": "BTCUSDFP", "limit": 1}
response = requests.get('https://api.aax.com/v2/futures/funding/fundingFee', params=params ,auth=auth).json()
print(response)
# !/usr/bin/env bash

domain="https://api.aax.com"
api_key=" "
api_secret=" "
path='/v2/futures/funding/fundingFee'
data='?symbol=BTCUSDTFP&limit=1'
verb='GET'
expires=`date +%s000`
std_sign=`echo -n "${expires}:${verb}${path}${data}" | openssl dgst -sha256 -hmac ${api_secret}`
sign=`echo ${std_sign} | tr -s ' '|cut -d' ' -f2`
output=`curl -s -H "accept: application/json;charset=UTF-8" \
 -H 'Content-Type: application/json;charset=UTF-8' \
 -H "X-ACCESS-NONCE:${expires}" \
 -H "X-ACCESS-KEY:${api_key}" \
 -H "X-ACCESS-SIGN:${sign}" \
 -X ${verb} "${domain}${path}${data}"`
echo "result: $output"
Parameter Required Data Type Description
symbol Yes String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
startTime No Integer Start time (inclusive), timestamp in milliseconds
endTime No Integer End time (exclusive), timestamp in milliseconds
limit No Integer Default 100; Max 1000

Note

Response Content

The above command returns JSON structured like this:

{
   "code":1,
   "data":[
          {
            "symbol": "BTCUSDTFP",
            "fundingRate":"0.001",
           "fundingFee":"100",
            "currency":"USDT",
            "fundingTime": "2020-08-12T08:00:00Z",
            "markPrice": "11192.5"
          }
    ],
   "message":"success",
   "ts":1573542445411
}
Field Data Type Description
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
markPrice String Mark price
fundingRate String The funding rate. When the funding rate is positive, longs pay shorts. When it is negative, shorts pay longs.
fundingFee String The funding fee
currency String The settlement currency
fundingTime String The funding time in UTC time

Websocket

Overview

Websocket

Websocket channels provides real-time market data streaming and notifications which work using a publish-subscribe communication model.

Message Encoding

Messages sent and received via the AAX websocket channels are encoded in JSON format.

Rate Limits

Websocket

One IP should not exceed 600 connection requests per minute. If this limit is reached, you will receive a HTTP 429 error.

Market Data

Websocket

General

Websocket URL

Market data websockets provide real-time data and do not require API key authentication.

base url: wss://realtime.aax.com/marketdata/v2

Public Streams

All websocket data can be accessed via wss://realtime.aax.com/marketdata/v2/{streamName}

Each connection can subscribe to a stream. There are different streams for different market data and each has specific update intervals. Below is a list of streams available:

Subscriptions

You can subscribe to multiple streams like this:

import websocket
import json


STREAM_HOST = 'wss://realtime.aax.com/marketdata/v2/'
def on_open(ws):
    ws.send(json.dumps({"e": "subscribe", "stream": "BTCUSDT@book_50"}))
    ws.send(json.dumps({"e": "subscribe", "stream": "tickers"}))
    ws.send(json.dumps({"e": "subscribe", "stream": "BTCUSDT@1m_candles"}))


def on_message(ws, message):
    print(message)


def on_error(ws, error):
    print(error)


def on_close(ws):
    print("Connection closed")

if __name__ == "__main__":
    websocket.enableTrace(True)
    ws = websocket.WebSocketApp(STREAM_HOST,
                                on_open=on_open,
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close)
    ws.run_forever(ping_interval=1)

Instead of specifying stream names in the URL, you can also subscribe to and unsubscribe from any streams on-demand, by sending:

Example

{"e":"subscribe","stream":"BTCUSDT@book_50"}

or

{"e":"unsubscribe","stream":"BTCUSDT@book_50"}

Example of response:

{"e":"system","status":[{"all":"active"}]}

or

{"e":"system","status":[{"all":"inactive"}]}

Empty Event

Server may publish empty events if there is nothing to send right after a new connection is established.

Example

{"e":"empty"}

System Event

Server may publish system events to indicate a system status change. Possible status are:

Example

{"e":"system","status":[{"all":"active"}]}

Orderbook

import websocket

ws = websocket.WebSocket()
ws.connect("wss://realtime.aax.com/marketdata/v2/")
ws.send('{"e": "subscribe", "stream": "BTCUSDT@book_50"}')
while True:
    print("Received '%s'" % ws.recv())

Snapshot of the top N bids and asks, updated every 300 milliseconds. Only pushes when there are changes in the orderbook.

Request Parameters
Parameter Required Data Type Description
symbol Yes String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
level Yes Integer Depth support 20, 50
Message Variable

The above command returns JSON structured like this:

{
   "asks":[
      [
         "10823.00000000",
         "0.004000"
      ],
      [
         "10823.10000000",
         "0.100000"
      ],
      [
         "10823.20000000",
         "0.010000"
      ]
   ],
   "bids":[
      [
         "10821.20000000",
         "0.002000"
      ],
      [
         "10821.10000000",
         "0.005000"
      ],
      [
         "10820.40000000",
         "0.013000"
      ]
   ],
   "e":"BTCUSDT@book_50",
   "t":1561543614756
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
asks Array List of bids currently in orderbook
bids Array List of asks currently in orderbook

Trades

import websocket

ws = websocket.WebSocket()
ws.connect("wss://realtime.aax.com/marketdata/v2/")
ws.send('{"e": "subscribe", "stream": "BTCUSDT@trade"}')
while True:
    print("Received '%s'" % ws.recv())

For each new connection, our server returns the last 50 trades.

Request Parameters
Parameter Required Data Type Description
symbol Yes String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
Message Variable

The above command returns JSON structured like this:

{
   "e":"BTCUSDT@trade",
   "p":"10924.30000000",
   "q":"0.002000",
   "t":1561445393223
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
p String Price (Positive for Buy, Negative for Sell, e.g. -6573.2 for Sell)
q String Quantity

Tickers

import websocket

ws = websocket.WebSocket()
ws.connect("wss://realtime.aax.com/marketdata/v2/")
ws.send('{"e": "subscribe", "stream": "tickers"}')
while True:
    print("Received '%s'" % ws.recv())

The response contains the open, high, low, close and volume for the last 24 hours. The server initially sends the data for all the tickers immediately after connection, and then only sends the tickers that have changed since the last update every N seconds.

Message Variable

The above command returns JSON structured like this:


{
"e":"tickers",
"t":1561543614756,
"tickers":[{
            "c":"0.05050010",
             "h":"0.05050010",
             "l":"0.05050010",
             "o":"0.05050010",
             "s":"BCHABCBTCFP",
             "v":"0.00000000",
             },
             {
              "c":"0.00004780",
              "h":"0.00004780",
              "l":"0.00004780",
              "o":"0.00004780",
              "s":"XRPBTCFP",
              "v":"0.00000000"}
             ]
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
s String Symbol
o String Open price
h String High price
l String Low price
c String Close price
v String Quote volume

Candlesticks

import websocket

ws = websocket.WebSocket()
ws.connect("wss://realtime.aax.com/marketdata/v2/")
ws.send('{"e": "subscribe", "stream": "BTCUSDT@1m_candles"}')
while True:
    print("Received '%s'" % ws.recv())

The last candlestick is being added to the Candlestick time series every second.

Request Parameters
Parameter Required Data Type Description
symbol Yes String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
timeframe Yes Integer Candlestick interval
Message Variable

The above command returns JSON structured like this:

{
   "c":"10821.30000000",
   "e":"BTCUSDT@1m_candles",
   "h":"10821.30000000",
   "l":"10821.30000000",
   "o":"10821.30000000",
   "s":1561543560,
   "t":1561543560,
   "v":"0.00000000"
}
Field Data Type Description
e String Event name
t Integer Event time (unit: milliseconds)
h String High price
l String Low price
o String Open price
s Integer Start time of the candlestick(seconds)
v String Trade volume
c String Close price

Mark Price

import websocket

ws = websocket.WebSocket()
ws.connect("wss://realtime.aax.com/marketdata/v2/")
ws.send('{"e": "subscribe", "stream": "BTCUSDFP@mark"}')
while True:
    print("Received '%s'" % ws.recv())
Request Parameters
Parameter Required Data Type Description
symbol Yes String The trading symbol for futures, convention is 'Base Currency + Quote Currency +FP', i.e. BTCUSDTP
Message Variable

The above command returns JSON structured like this:

{
    "T": 1607356800000,    //Next Funding time  (milliseconds)
    "e": "BTCUSDTFP@mark", //Event Name
    "i": "18152.79000000",  //Index Price
    "p": "19204.54499999",  //Mark Price
    "r": "0.0003000000",    //Predicted Funding Rate
    "t": 1607341980826      //Event Time (milliseconds)
}
Field Data Type Description
e String Event name
p String Mark price
i String Index price
r String Predicted funding rate
T Integer Next Funding time
t Integer Event time (unit: milliseconds)

System Maintenance

Message Variable

The above command returns JSON structured like this:

{
    "data": {
        "event": "MAINTENANCE",
        "data": {
                "maintenance": {
                            "announce": {
                                      "id": "5cd2970699037300c18585db",
                                      "startTime": "2021-06-14T16:00:00.923Z",
                                      "endTime": "2021-06-14T18:00:00.334Z",
                                      "title": {
                                            "en-US": "MAINTENANCE ANNOUNCEMENT: AAX will begin regular system maintenance at May 12, 2019 11:00 am (Hong Kong time). During this time, users will not be able to log in to their AAX account, and transactions and limit orders will be suspended. We will resume all trading activities at May 12, 2019 12:00 am (Hong Kong time). We apologize for any inconvenience and thank you for your patience",
                                            "zh-CN": "维护通知: AAX 将于2019年 5月12日上午11:00(香港时间)开始进⾏定期系统维护",
                                            "zh-TW": "维护通知: AAX 将于2019年 5月12日上午11:00(香港时间)开始进⾏定期系统维护。"
                                      },
                                      "content": {
                                            "en-US": "https://aax.zendesk.com/hc/en-us",
                                            "zh-CN": "https://aax.zendesk.com/hc/zh-cn",
                                            "zh-TW": "https://aax.zendesk.com/hc/zh-cn"
                              }
                            },
                            "modules": {
                                      "exchangeTrading": true,
                                      "spotTrading": true,
                                      "futuresTrading": true,
                                      "otcTrading": true,
                                      "walletOperating": true
                            },
                            "systemStatus": {
                                      "spotTrading": "enable",
                                      "futuresTrading": "enable",
                                      "walletOperating": "enable",
                                      "otcTrading": "enable"
                             }
                }
        }
      }
}
Field Data Type Description
startTime String The planned start time of system maintenance
endTime String The planned end time of system maintenance
title Object The title of maintenance notification
content Object The url of maintenance notification content
spotTrading String Spot Trading either disable, enable, readOnly or closeOnly. readOnly means you cannot place or cancel order(s). closeOnly means you can not place order(s) , but can cancel order(s).
futuresTrading String Futures Trading either disable, enable, readOnly or closeOnly. readOnly means you cannot place order(s), cancel order(s) or change leverage. closeOnly means you cannot place order(s) , but can cancel order(s),change leverage and adjust margin.
walletOperating String Withdrawal and Deposit are either enable or disable
otcTrading String OTC Trading either enable or disable

User Notification

General

AAX uses the SocketCluster protocol to implement websocket services that subscribe to user data.For more information about SocketCluster, please refer to SocketCluster Protocol and SocketCluster client driver

Event format

Basic event sending format:

{"event": "eventName", "data": "eventData",cid:"eventID"}

Note

cid: Each emitted event can have call ID (if specified, it needs to be unique for the life of the client session)

You can use UUID strings, but for efficiency, we recommend using a number starting a 1 and incrementing it with each event sent.

Websocket URL

The notification channel provides real-time alerts for changes in your orders, positions and balance. It requires API key for authentication:

Base URL: wss://stream.aax.com/notification/v2/

Websocket Authentication

Similarly to RESTful API, you need to authenticate your connection using your API Key in order to subscribe to the private channels. If you wish to subscribe to user-locked streams, you must authenticate first.

Send command format:

{"event": "login", "data": {"apiKey":${KEY},"nonce":${NONCE},"signature":${SIGNATURE}}}

Example of authentication message:

{"event":"login","data":{"apiKey":"e04019b***","nonce":1557386524650,"signature":"114422***"}}

Subscriptions

AAX allows subscribing to real-time data. This access is not rate-limited once connected and is the best way to get the most up-to-date data to your programs.

To subscribe user private information:

{"event":"#subscribe","data":{"channel":"user/' + ${USER_ID} + '"},"cid":2}

Event response

Response data format:

{ "event": “event name”, "data":responseData,"ts": responseTime}

Handshake

Before you can send custom events to the SocketCluster server, you first need to establish a websocket connection to a SocketCluster server and then perform a handshake to initiate the socket.

As soon as the websocket connection is opened, your client should emit a special #handshake event to the server.

the #handshake event message should look like this:

{

  "event": "#handshake",

    // this as an empty object.

  "data": {},

    // This can be any number/string, just make sure that it is unique for the life of the client session.

  "cid": 1 }

As soon as it receives the event, your server should send back a handshake response event message in this format:

{

  // The rid will match the cid from the #handshake event.

  "rid": 1,

  "data": {

    // This is the ID for the SC connection assigned by the server.

  "id": "Y7Uw-jHCJP-gld4QAAAA",

    // Because we did not send any auth token, this will be false.

  "isAuthenticated": false,

    // SC uses a ping/pong mechanism for checking if a connection is alive.

    // This value is the number of milliseconds of inactivity after which the SC server

    // will mark this connections as dead.

  "pingTimeout": 10000

       }

}

Heartbeat

As mentioned above, SocketCluster has a ping/pong mechanism for checking whether or not a connection is still alive.The ping interval is 20s

Ping message

#1

Pong message

#2

Notification

from websocket import create_connection
import hmac
import hashlib
import time
import json

API_KEY = 'YOUR API KEY HERE'
API_SECRET = 'YOUR API SECRET HERE'
USER_ID = 'YOUR USER ID HERE'

ws = create_connection("wss://stream.aax.com/notification/v2/")

nonce = str(int(1000 * time.time()))
message = nonce + ':' + API_KEY
signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest()

req = '{"event":"#handshake","cid":1}'
print(req)
ws.send(req)
print("Received '%s'" % ws.recv())

req = '{"event":"login","data":{"apiKey":"' + API_KEY + '","nonce":' + nonce + ',"signature":"' + signature + '"}}'
print(req)
ws.send(req)
print("Received '%s'" % ws.recv())

req = '{"event":"#subscribe","data":{"channel":"user/' + USER_ID + '"},"cid":2}'
print(req)
ws.send(req)
print("Received '%s'" % ws.recv())

while True:
  message = ws.recv()
  print("Received '%s'" % message)
  if message == '#1':
    ws.send("#2")  # Pong.

The notification channel sends user private information including updates to:

user balance spot order futures orders futures position futures leverage

Channel & Event
Type Channel Event Description
Private user/{USER ID} USER_BALANCE Broadcast user's balance change information
Private user/{USER ID} SPOT Broadcast spot order status
Private user/{USER ID} FUTURES Broadcast futures order, leverage, position information
Private user/{USER ID} BACK_EXCEPTION Broadcast futures order, leverage, position information

Event: USER_BALANCE

When the balance of any of your accounts changes, a notification will be sent.

{
    "data": {
            "unavailable": "0.00000000",
            "available": "1.62931641",
            "location": "AAXGL",
            "currency": "USDT",
            "purseType": "SPTP",
            "userID": "2000687"
            },
    "event": "USER_BALANCE"
}

When the balance of any of your accounts changes, a notification will be sent.

Message Variable
Field Data Type Description
unavailable String Locked balance
available String Available balance
location String translation missing: en.t_desc_credit
currency String Currency code (e.g. BTC)
purseType String Account type
userID String User id

Event: SPOT

The event returns JSON structured like this

{ 
   "data":{ 
      "avgPrice":"0",
      "base":"BTC",
      "clOrdID":"aax",
      "commission":"0",
      "createTime":"2019-11-13T06:35:53Z",
      "cumQty":"0",
      "id":"114734989961183232",
      "isTriggered":false,
      "lastPrice":"0",
      "lastQty":"0",
      "leavesQty":"0",
      "tradeID": "E03GseMJLjfn",
      "orderID":"wQgmCG7zr",
      "orderQty":"0.05",
      "orderStatus":1,
      "orderType":2,
      "price":"8000",
      "quote":"USDT",
      "rejectCode":0,
      "rejectReason":null,
      "side":1,
      "stopPrice":"0",
      "symbol":"BTCUSDT",
      "transactTime":"2019-11-13T06:33:34Z",
      "updateTime":"2019-11-13T06:35:53Z",
      "timeInForce":1,
      "execInst": null,
      "userID":"213409"
   },
   "event":"SPOT"
}

When your balance changes, you will receive notifications.

Message Variable
Field Data Type Description
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
clOrdID String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
lastPrice String Price of the last fill
lastQty String Quantity of the last fill
cumQty String Cumulative filled quantity of the order
tradeID String Trade ID
updateTime String Last update time of the order
isTriggered Boolean Used by STOP_LIMIT and STOP, True or False
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Quote Currency code, for example, 'BTC'
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
leavesQty String Outstanding quantity of the order that remains to be filled
orderID String AAX order ID
side Integer Buy or Sell the Base Currency, '1:Buy, 2:Sell'
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
stopPrice String Trigger price for stop-limit order or stop order
symbol String The trading symbol to trade. Convention is 'Base Currency + Quote Currency'
orderQty String Order quantity
transactTime String Last execution time
timeInForce String '1: GTC, 3: IOC, 4: FOK'
execInst String Post-Only or ''
userID String User id

Event: FUTURES

The event returns JSON structured like this

{ 
   "data":{ 
      "closed":{
         "base":"BTC",
         "commission":"0.00002711",
         "createTime":null,
         "filledPrice":"8560.5",
         "filledQty":"-290",
         "tradeID":"g04GsqjJT8vl",
         "id":"114744152334385153",
         "leavesQty":"0",
         "leverage":"1",
         "liqType":1,
         "liquidationPrice":"4392.5",
         "orderID":"wQqrE7ly9",
         "orderStatus":3,
         "orderType":1,
         "quote":"USD",
         "realisedPnl":"-0.00101840",
         "side":2,
         "symbol":"BTCUSDFP",
         "taker":true,
         "transactTime":"2019-11-13T07:12:17Z",
         "updateTime":null,
         "userID":"213409"
      },
      "opens":{ 
         "buy":0,
         "sell":0,
         "symbol":"BTCUSDFP"
      },
      "order":{ 
         "avgPrice":"8566.60442994073443",
         "base":"BTC",
         "clOrdID":null,
         "code":"FP",
         "commission":"0.00002803",
         "createTime":"2019-11-13T07:12:17Z",
         "cumQty":"300",
         "id":"114744151591993346",
         "isTriggered":false,
         "lastPrice":"8560.5",
         "lastQty":"290",
         "leavesQty":"0",
         "tradeID":"g04GsqqcT8vl",
         "leverage":"1",
         "liqType":1,
         "marketPrice":"8854.25",
         "orderID":"wQqrE7ly9",
         "orderQty":"300",
         "orderStatus":3,
         "orderType":1,
         "price":"8854.25",
         "quote":"USD",
         "rejectCode":0,
         "rejectReason":null,
         "settleType":"INVERSE",
         "side":2,
         "stopPrice":"0",
         "symbol":"BTCUSDFP",
         "transactTime":"2019-11-13T07:12:17.000Z",
         "updateTime":"2019-11-13T07:12:17.000Z",
         "timeInForce":1,
         "execInst": "",
         "userID":"213409"
      },
      "position":{
         "autoMarginCall":false,
         "avgEntryPrice":"0",
         "bankruptPrice":"0",
         "base":"BTC",
         "code":"FP",
         "commission":"0",
         "currentQty":"0",
         "funding":"0",
         "fundingStatus":0,
         "id":"114743189926166528",
         "leverage":"1",
         "liquidationPrice":"0",
         "marketPrice":null,
         "openTime":null,
         "stopLossPrice":"8200",
         "stopLossSource":1,
         "takeProfitPrice":"8780",
         "takeProfitSource":1,
         "posLeverage":"0.00",
         "posMargin":"0",
         "quote":"USD",
         "realisedPnl":"0",
         "unrealisedPnl": "0",
         "riskLimit":"1000000",
         "riskyPrice":"0",
         "settleType":"INVERSE",
         "symbol":"BTCUSDFP",
         "userID":"213409"
      }
   },
   "event":"FUTURES"
}

You will receive notifications in the below cases:

Message Variable
Field Data Type Description
autoMarginCall Boolean Enable the function of automatically increasing margin or not, true means function on,false means function off.
closed Object Close position information
base String Base Currency in a trading pair
commission String Total commission paid/received since opening the position.Positive sign means paid
filledPrice String Fill price for the trade
filledQty String Filled quantity for the trade
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
leavesQty String Outstanding quantity of the order that remains to be filled
leverage String leverage
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
liquidationPrice String The liquidation price after the trade was processed
margin String The amount of margin locked by each position
orderID String AAX order ID
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
quote String Quote Currency in a trading pair
realisedPnl String Realised profit and loss since opening this position
unrealisedPnl String Unrealised profit and loss
side Integer Filter on the direction of the trade, 'BUY or SELL, Long:BUY, Short:SELL'
taker Boolean True: taker, False: maker
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
transactTime String Last execution time
userID String user id
opens Object Open order amount information
buy Integer The total buy amount in open orders
sell Integer The total buy amount in open orders
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
order Object order information
avgPrice String Average execution price
base String Base Currency code, for example, 'BTC'
clOrdID String Client order ID
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received for this order.
createTime String Time at which the order was submitted
cumQty String Cumulative filled quantity of the order
lastPrice String Price of the last fill
leavesQty String Outstanding quantity of the order that remains to be filled
tradeID String Trade ID
leverage String leverage
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
marketPrice String Market price. (best bid + best ask)/2
orderID String AAX order ID
orderQty String Order quantity
rejectCode Integer Order rejection code
rejectReason String Reason why the order was rejected
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
price String Limit price in limit and stop-limit order
quote String Base Currency code, for example, 'BTC'
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
side Integer 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
stopPrice String Trigger price for stop-limit order or stop order
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
transactTime String Last execution time
updateTime String Last update time of the order
timeInForce String '1: GTC, 3: IOC, 4: FOK'
execInst String Post-Only or ''
userID String User id
position Object position information
avgEntryPrice String Average executed buy/sell price for your current long/short position
bankruptPrice String Bankruptcy price
base String Base Currency code, for example, 'BTC'
code String Applicable for futures only. 'FP' for futures, null for spot
commission String Total commission paid/received since opening the position.Positive sign means paid
currentQty String Your current position on this instrument. If positive, you are long, if negative, short
funding String Funding amount in BTC received/paid since opening the position. Positive sign means received, negative means paid
fundingStatus Integer Funding status. The enumeration values are 0(settling) and 1(settled), otherwise, it will be null.
posMargin String Position margin
leverage String Position leverage
liquidationPrice String The liquidation price after the trade was processed
marketPrice String Market price. (best bid + best ask)/2
openTime String Position creation timestamp in UTC
stopLossPrice String Stop loss price
stopLossSource Integer Trigger price type.'1: Last Price; 2: Mark Price; 3: Index; 4: Mid Price.'
takeProfitPrice String Take profit price
takeProfitSource Integer Trigger price type.'1: Last Price; 2: Mark Price; 3: Index; 4: Mid Price.'
quote String Base Currency code, for example, 'BTC'
realisedPnl String Realised profit and loss since opening this position
riskyPrice String Risky price, this is for internal processing only
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
userID String User id
event String Event name

Event: BACK_EXCEPTION

The event for SPOT returns JSON structured like this

{
        "data": {
                "code": 20001,
                "data": {
                    "symbol": "BTCUSDT",
                    "orderType": 2,
                    "avgPrice": "0",
                    "orderStatus": 0,
                    "userID": "363256",
                    "quote": "USDT",
                    "rejectCode": 0,
                    "price": "1",
                    "orderQty": "1",
                    "commission": "0",
                    "id": "323524598276268032",
                    "timeInForce": 1,
                    "isTriggered": false,
                    "side": 1,
                    "orderID": "1uBLuV2zuM",
                    "leavesQty": "0",
                    "cumQty": "0",
                    "lastQty": "0",
                    "clOrdID": "",
                    "stopPrice": "0",
                    "createTime": "2021-06-11T10:11:15.025Z",
                    "base": "BTC",
                    "lastPrice": "0"
                },
                "service": "S",
                "action": "S1000",
                "message": "Insufficient balance. Please deposit to trade"
            },
        "event": "BACK_EXCEPTION"
}

You will receive notifications in the below cases:

Message Variable for SPOT
Field Data Type Description
symbol String The trading symbol to trade. Convention is 'Base Currency + Quote Currency'
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
avgPrice String Average execution price
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
userID String User id
quote String Quote Currency code, for example, 'BTC'
rejectCode Integer Order rejection code
price String Limit price in limit and stop-limit order
orderQty String Order quantity
commission String Total commission paid/received for this order.
timeInForce String '1: GTC, 3: IOC, 4: FOK'
isTriggered Boolean Used by STOP_LIMIT and STOP, True or False
side Integer Buy or Sell the Base Currency, '1:Buy, 2:Sell'
orderID String AAX order ID
leavesQty String Outstanding quantity of the order that remains to be filled
cumQty String Cumulative filled quantity of the order
lastQty String Quantity of the last fill
clOrdID String Your customized Order ID. The clOrdID type should only use letters. Both uppercase and lowercase letters are supported and a maximum of 20 characters are allowed.
stopPrice String Trigger price for stop-limit order or stop order
createTime String Time at which the order was submitted
base String Base Currency code, for example, 'BTC'
lastPrice String Price of the last fill
Message Variable for FUTURES

The event for FUTURES returns JSON structured like this

{
    "data": {
            "code": 20001,
            "data": {
                    "liqType": 0,
                    "symbol": "ETHUSDTFP",
                    "orderType": 2,
                    "leverage": "24.76",
                    "marketPrice": "2383.36",
                    "code": "FP",
                    "avgPrice": "0",
                    "execInst": null,
                    "orderStatus": 6,
                    "userID": "363256",
                    "quote": "USDT",
                    "rejectReason": "Insufficient balance. Please deposit to trade",
                    "rejectCode": 0,
                    "price": "1",
                    "orderQty": "5",
                    "commission": "0",
                    "id": "335472040486490112",
                    "timeInForce": 1,
                    "tradeID": null,
                    "isTriggered": false,
                    "side": 1,
                    "orderID": "1y1NPVcReU",
                    "leavesQty": "5",
                    "cumQty": "0",
                    "updateTime": "2021-07-14T09:26:07.235Z",
                    "lastQty": "0",
                    "clOrdID": "aax_api",
                    "stopPrice": "0",
                    "createTime": "2021-07-14T09:26:07.220Z",
                    "transactTime": "2021-07-14T09:26:07.235Z",
                    "settleType": "VANILLA",
                    "base": "ETH",
                    "lastPrice": "0"
            },
            "service": "FUTURES",
            "action": "F1000",
            "message": "Insufficient balance. Please deposit to trade"
            },
    "event": "BACK_EXCEPTION"
}
Field Data Type Description
liqType Integer Liquidation type for futures,'0:General,1:USER-CLOSE-LIQ, 2:LIQ, 3:TAKE-PROFIT-LIQ, 4:STOP-LOSS-LIQ'. More details on liqType.
symbol String Trading symbol. Convention is 'Base Currency + Quote Currency + FP'
orderType Integer Order type, '1:Market Order,2:Limit Order,3:Stop Order,4:Stop-Limit Order,7:Stop Loss,8:Take Profit'
leverage String leverage
marketPrice String Market price. (best bid + best ask)/2
code String Applicable for futures only. 'FP' for futures, null for spot
avgPrice String Average execution price
execInst String Post-Only or ''
orderStatus Integer Order status,'0:Pending-New, 1:New, 2:Partially-Filled, 3:Filled, 4:Cancel-Reject, 5:Canceled, 6:Rejected, 10:Expired, 11:Business-Reject'
userID String User id
quote String Base Currency code, for example, 'BTC'
rejectReason String Reason why the order was rejected
rejectCode Integer Order rejection code
price String Limit price in limit and stop-limit order
orderQty String Order quantity
commission String Total commission paid/received since opening the position.Positive sign means paid
timeInForce String '1: GTC, 3: IOC, 4: FOK'
tradeID String Trade ID
isTriggered Boolean Used by STOP_LIMIT and STOP, True or False
side Integer 'Long' or 'Short' the contract. e.g. 'BUY, SELL'
orderID String AAX order ID
leavesQty String Outstanding quantity of the order that remains to be filled
cumQty String Cumulative filled quantity of the order
updateTime String Last update time of the order
lastQty String Quantity of the last fill
clOrdID String Client order ID
stopPrice String Trigger price for stop-limit order or stop order
createTime String Time at which the order was submitted
transactTime String Last execution time
settleType String Settlement type (INVERSE or QUANTO) More details on Settlement types.
base String Base Currency code, for example, 'BTC'
lastPrice String Price of the last fill

Errors

Error Code Description
1 Success
10003 Parameter validation error
10006 Session expired, please relogin
10007 Invalid authentication key or token
10008 System maintenance,please hold on.
11007 Invalid key format
20001 Insufficient balance. Please deposit to trade.
20009 Order amount must be positive
30000 The order does not exist
30001 The order is being submitted, please try again later
30004 Minimum quantity is {0}
30005 Quantity maximum precision is {0} decimal places
30006 Price maximum precision is {0} decimal places
30007 Minimum price is {0}
30008 Stop price maximum precision is {0} decimal places
30009 Stop Price cannot be less than {0}
30010 Market price cannot be empty
30011 The order is being cancelled, please wait.
30012 Unknown currency
30013 Unknown symbol
30014 Futures order cannot be found
30015 This is not an open order and cannot modified
30016 No position found
30017 The current close position is 0. It is recommended that you cancel the current order closing order.
30018 Order price cannot be greater than {0}
30019 Order quantity cannot be greater than {0}
30020 Order price must be a multiple of {0}
30021 Margin adjustement must be greater than 0
30022 New quantity must be greater than filled quantity
30023 Order failed, please try again
30024 TimeInForce error, only GTC or IOC are allowed
30025 TimeInForce error, only GTC is allowed
30026 Quantity is not a multiple of {0}
30027 Close position failed, it is recommended that you cancel the current order and then close the position.
30028 Symbol cannot be traded at this time
30029 Modified quantity or price cannot be empty
30030 Price cannot be specified for market orders
30031 Liquidation orders cannot be modified
30032 Leverage cannot be greater than {0}
30033 Leverage cannot be smaller than {0}
30034 The max number of open orders is {0}. To place a new order, please cancel a previous one
30035 The max number of {0} open orders is {1}. To place a new order, please cancel a previous one
30036 Liquidation is in progress, please try again later
30037 Once stop limit order triggered, stop price cannot be amended
30038 The total value of your orders has exceeded the current risk limit. Please adjust the risk limit
30039 Your risk limit has now been changed to {0}, your maximum leverage less than 1, please readjust accordingly
30041 Liquidation orders cannot be cancelled
30042 Order cannot be placed as you will be breaching you max limit value of {1} BTC for {0}
30043 The risk limit cannot be less than 0
30044 Timeout cannot be greater than 60 minutes
30045 Side is not valid, it should be BUY or SELL
30046 Order type is not valid, it should be MARKET or LIMIT or STOP-LIMIT or STOP
30047 The order is closed. Can't cancel
30048 Market orders cannot be modified
30049 The order is being modified, please wait
30050 Maximum 10 orders
30051 Amend order failed
30052 No leverage adjustment supported in positions opened with bonus
30053 No margin adjustment supported in positions opened with bonus
30054 No more position opening supported when holding positions opened with bonus
30055 Bonus cannot be used while having open positions
30056 Bonus cannot be used while holding open orders
30057 No TP or SL supported in positions opened with bonus
30058 Failed to place an order using the bonus
30059 The bonus is no longer valid
30060 Symbol {0} does not support the used bonus
30061 Bonus positions do not support price limit closing
30062 Failed to place an order, part of the position is closed
30063 The new Liq.price over risk {0}, cannot adjust leverage
30064 Service miss market/mark price, please adjust leverage later
30065 Placing a timeout
30066 translation missing: en.error_code_30066
30067 Order stop price cannot be greater than {0}
30068 The order has failed and the current contract holding limit has been exceeded
30069 The system maintenance, order cancel is not allowed
30070 The system maintenance, adjust the leverage and margin of positions is not allowed
30071 The best {0} gear price is empty, please hold on
30072 The optimal gear is invalid
30073 The system maintenance has not been completed, and only supports users to cancel orders, adjust the leverage and margin of positions
30074 Min qty can not bigger than Orders qty
30075 The order price deviates too much, and the order submission fails
30080 Margin maximum precision is {0} decimal places
30100 Once stop loss/take profit exist, liquidation cannot be created
30101 Stop loss/Take profit activating, cannot be modified
30102 Position does not exist, sltp cannot be modified
30103 The take profit price must be greater than the entry price.
30104 The take profit price must be less than the entry price.
30105 The take profit price must be greater than the market price.
30106 The take profit price must be less than the market price.
30107 The stop loss price must be greater than the entry price and less than the liquidation price
30108 The stop loss price must be less than the entry price and greater than the liquidation price.
30109 The stop loss price must be less than the market price.
30110 The stop loss price must be greater than the market price.
30111 Stop loss/Take profit order quantity can't be modified
30112 Take Profit Price cannot be less than {0}
30113 Take Profit Price cannot be greater than {0}
30114 Stop Loss Price cannot be less than {0}
30115 Stop Loss Price cannot be greater than {0}
40004 Requested ressource doesn't exist
40009 Too many requests
40101 Unauthorized(invalid token)
40102 Unauthorized(invalid key)
40103 Unauthorized(invalid sign)
40104 Unauthorized(invalid nonce)
40105 Unauthorized(reset)
40301 Forbidden(disabled)
40302 Forbidden(deny IPs)
40303 Forbidden(invalid scopes)
40501 The current function has been freezed. Please contact CS if you have any questions.
41001 Incorrect HTTP request
41002 Unsupported HTTP request method
42001 Duplicated data entry, please check and try again
50001 Server side exception, please try again later
50002 Server is busy, please try again later