NAV
shell python javascript

Introduction

Welcome to the ANDX API! Using the API you can read market info, ticker info, create orders, view the status of existing orders, cancel orders, get balances etc. This documentation includes examples using cURL and python. The python examples use requests for https.

All request paths must include the trailing slash (e.g. /api/v1/ticker/ instead of /api/v1/ticker).

Client Libraries

You can use our client library below to integrate with our API quickly or implement your own client library according to API documentation.

Official Libraries

Rate Limits

Do not make more than 60 requests per 1 minute or you will get a rate limit error(HTTP 429). We expect you won't encounter rate limits in normal usage.

Public Endpoints

Public endpoints are used for retrieving informations about market. Since they are unauthenticated, no need to add authentication headers for requests(ACCESS-USER, ACCESS-PASSPHRASE, ACCESS-TIMESTAMP, ACCESS-SIGN, ACCESS-KEY).

List All Markets Info

import requests

requests.get('https://platform.andx.one/api/v1/market_info/')
curl "https://platform.andx.one/api/v1/market_info/"

The above command returns JSON structured like this:

{
  "status": "success",
  "data": {
    "markets": [
      {
        "market_code": "BTCTRY",
        "url_symbol": "btctry",
        "base_currency": "BTC",
        "counter_currency": "TRY",
        "minimum_order_amount": "0.00010000",
        "base_currency_decimal": 8,
        "counter_currency_decimal": 2
      },
      {
        "market_code": "XRPTRY",
        "url_symbol": "xrptry",
        "base_currency": "XRP",
        "counter_currency": "TRY",
        "minimum_order_amount": "0.50000000",
        "base_currency_decimal": 8,
        "counter_currency_decimal": 4
      }
    ]
  }
}

This endpoint retrieves all available markets.

HTTP Request

GET https://platform.andx.one/api/v1/market_info/

Get a Specific Market Info

import requests

requests.get('https://platform.andx.one/api/v1/market_info/BTCTRY/')
curl "https://platform.andx.one/api/v1/market_info/BTCTRY/"

The above command returns JSON structured like this:

{
  "status": "success",
  "data": {
    "markets": {
      "market_code": "BTCTRY",
      "url_symbol": "btctry",
      "base_currency": "BTC",
      "counter_currency": "TRY",
      "minimum_order_amount": "0.00010000",
      "base_currency_decimal": 8,
      "counter_currency_decimal": 2
    }
  }
}

This endpoint retrieves a specific market data.

HTTP Request

GET https://platform.andx.one/api/v1/market_info/<MARKET_CODE>/

URL Parameters

Parameter Description
MARKET_CODE Market code of the market to retrieve

List All Tickers Info

import requests

requests.get('https://platform.andx.one/api/v1/ticker/')
curl "https://platform.andx.one/api/v1/ticker/"

The above command returns JSON structured like this:

{
  "status": "success",
  "data": {
    "ticker": {
      "BTCTRY": {
        "market": {
          "market_code": "BTCTRY",
          "base_currency_code": "BTC",
          "counter_currency_code": "TRY"
        },
        "bid": "40492.19",
        "ask": "40497.25",
        "last_price": "40497.25",
        "last_size": "0.00898989",
        "volume_24h": "1.38221647",
        "change_24h": "2.02",
        "low_24h": "39690.37",
        "high_24h": "41000.00",
        "avg_24h": "39969.91",
        "timestamp": "1525884262.8114073"
      },
      "XRPTRY": {
        "market": {
          "market_code": "XRPTRY",
          "base_currency_code": "XRP",
          "counter_currency_code": "TRY"
        },
        "bid": "4.0000",
        "ask": "0.0000",
        "last_price": "3.5000",
        "last_size": "10.00000000",
        "volume_24h": "10.00000000",
        "change_24h": "0.00",
        "low_24h": "3.5000",
        "high_24h": "3.5000",
        "avg_24h": "3.5000",
        "timestamp": "1525871669.8528357"
      }
    }
  }
}

This endpoint retrieves ticker data for all markets

HTTP Request

GET https://platform.andx.one/api/v1/ticker/

Get a Specific Ticker Info

import requests

requests.get('https://platform.andx.one/api/v1/ticker/BTCTRY/')
curl "https://platform.andx.one/api/v1/ticker/BTCTRY/"

The above command returns JSON structured like this:

{
  "status": "success",
  "data": {
    "ticker": {
      "market": {
        "market_code": "BTCTRY",
        "base_currency_code": "BTC",
        "counter_currency_code": "TRY"
      },
      "bid": "40683.54",
      "ask": "40700.00",
      "last_price": "40683.54",
      "last_size": "0.05630107",
      "volume_24h": "1.48920663",
      "change_24h": "1.47",
      "low_24h": "39690.37",
      "high_24h": "41000.00",
      "avg_24h": "40062.85",
      "timestamp": "1525908532.9022408"
    }
  }
}

This endpoint retrieves a specific ticker data for given market.

HTTP Request

GET https://platform.andx.one/api/v1/ticker/<MARKET_CODE>/

URL Parameters

Parameter Description
MARKET_CODE Market code of the market to retrieve

Get Order Book

import requests

requests.get('https://platform.andx.one/api/v1/order_book/BTCTRY/')
curl "https://platform.andx.one/api/v1/order_book/BTCTRY/"

The above command returns JSON structured like this:

{
  "status": "success",
  "data": {
    "market_code": "BTCTRY",
    "ticker": {
      "market": {
        "market_code": "BTCTRY",
        "base_currency_code": "BTC",
        "counter_currency_code": "TRY"
      },
      "bid": "40683.54",
      "ask": "40700.00",
      "last_price": "40683.54",
      "last_size": "0.05630107",
      "volume_24h": "1.48920663",
      "change_24h": "1.47",
      "low_24h": "39690.37",
      "high_24h": "41000.00",
      "avg_24h": "40062.85",
      "timestamp": "1525937572.5231805"
    },
    "buyers": [
      {
        "orders_total_amount": "0.89599893",
        "orders_price": "40683.54"
      },
      ...
    ],
    "sellers": [
      {
        "orders_total_amount": "0.00200000",
        "orders_price": "40700.00"
      },
      ...
    ],
    "last_transactions": [
      {
        "amount": "0.05630107",
        "price": "40683.54",
        "time": "1525897633.968654",
        "type": "B"
      },
      ...
    ],
    "timestamp": "1525937572.5233314"
  }
}

This endpoint retrieves order book for given market. Last transactions and ticker data also included in response.

HTTP Request

GET https://platform.andx.one/api/v1/order_book/<MARKET_CODE>/

URL Parameters

Parameter Description
MARKET_CODE Market code of the market to retrieve

Authentication

ANDX uses API keys to allow access to the private API calls. You can generate a new API key in your ANDX Dashboard.

ANDX expects the API key to be included in all private API requests to the server in header.

Generating an API Key

For private API calls you need to sign your request with parameters below:

Creating a Request

All private API calls must contain the following headers:

Content-Type should be set as application/json.

Signing a Message

import hmac
import hashlib
import time

timestamp = str(time.time())

def sign_request(apikey, secretkey, username, pass_phrase, timestamp, body):
    if body:
        data = body.decode('utf-8')
        message = apikey + username + pass_phrase + timestamp + data
    else:
        message = apikey + username + pass_phrase + timestamp + "{}"

    signature = hmac.new(str.encode(secretkey),
                        msg=str.encode(message),
                        digestmod=hashlib.sha256).hexdigest().upper()
    return signature
import * as jsSHA from 'jssha';

const timestamp = new Date().getTime();

function sign_request (apikey, secretkey, username, pass_phrase, timestamp, body) {
  const message = apikey + username + pass_phrase + timestamp + JSON.stringify(body);
  const shaObj = new jsSHA("SHA-256", "TEXT");
  shaObj.setHMACKey(secretkey, "TEXT");
  shaObj.update(message);

  return shaObj.getHMAC("HEX").toUpperCase();
};

The ACCESS-SIGN header should be generated by using HMAC-SHA256 of api_key + username + pass_phrase + timestamp + body (where + represents string concatenation)

The timestamp value should be the same in the ACCESS-TIMESTAMP header.

The body is the request body string as JSON or "{}" if there is no request body.

Private Endpoints

Private endpoints are used for order and account management. Every private request must be signed as described in authentication section.

Get Balance

import requests

url = "https://platform.andx.one/api/v1/balance/Main/"

headers = {
    'ACCESS-USER': "your.username",
    'ACCESS-PASSPHRASE': "your.passphrase",
    'ACCESS-TIMESTAMP': "timestamp",
    'ACCESS-SIGN': "signature",
    'ACCESS-KEY': "your.apikey",
    'content-type': "application/json"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)
curl -H "cache-control: no-cache" \
     -H "ACCESS-USER: your.username" \
     -H "ACCESS-PASSPHRASE: your.passphrase" \
     -H "ACCESS-TIMESTAMP: timestamp" \
     -H "ACCESS-SIGN: signature" \
     -H "ACCESS-KEY: your.apikey" \
     -H "content-type: application/json" \
     https://platform.andx.one/api/v1/balance/Main/

The above command returns JSON structured like this:

{
  "status": "success",
  "data": {
    "balances": {
      "ETH": {
        "currency_code": "ETH",
        "balance": "0",
        "available_balance": "0"
      },
      "LTC": {
        "currency_code": "LTC",
        "balance": "0",
        "available_balance": "0"
      },
      "USD": {
        "currency_code": "USD",
        "balance": "0",
        "available_balance": "0"
      },
      "TRY": {
        "currency_code": "TRY",
        "balance": "0",
        "available_balance": "0"
      },
      "BTC": {
        "currency_code": "BTC",
        "balance": "0",
        "available_balance": "0"
      },
      "XRP": {
        "currency_code": "XRP",
        "balance": "0",
        "available_balance": "0"
      }
    }
  }
}

This endpoint retrieves the balance of given account. If account name is not provided, then main account's balance information will be retrieved.

HTTP Request

GET https://platform.andx.one/api/v1/balance/<ACCOUNT_NAME>/

for default account:

GET https://platform.andx.one/api/v1/balance/

URL Parameters

Parameter Description Default
ACCOUNT_NAME Name of the account to retrieve Main

Get Orders

import requests

url = "https://platform.andx.one/api/v1/orders/Main/A/BTCTRY/"

headers = {
    'ACCESS-USER': "your.username",
    'ACCESS-PASSPHRASE': "your.passphrase",
    'ACCESS-TIMESTAMP': "timestamp",
    'ACCESS-SIGN': "signature",
    'ACCESS-KEY': "your.apikey",
    'content-type': "application/json"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)
curl -H "cache-control: no-cache" \
     -H "ACCESS-USER: your.username" \
     -H "ACCESS-PASSPHRASE: your.passphrase" \
     -H "ACCESS-TIMESTAMP: timestamp" \
     -H "ACCESS-SIGN: signature" \
     -H "ACCESS-KEY: your.apikey" \
     -H "content-type: application/json" \
     https://platform.andx.one/api/v1/orders/Main/A/BTCTRY/

The above command returns JSON structured like this:

{
  "status": "success",
  "data": {
    "orders": [
      {
        "order_number": 54259,
        "account_number": 109,
        "order_type": "limit",
        "market_code": "BTCTRY",
        "base_currency": "BTC",
        "counter_currency": "TRY",
        "channel_code": "W",
        "price": "40683.54",
        "volume": "0.01000000",
        "volume_executed": "0.01000000",
        "volume_remaining": "0.00000000",
        "buy_sell": "S",
        "status": "F",
        "add_date": "2018-05-10 11:23:22.710724+00:00",
        "total": "406.83",
        "avg_price": "40683.54",
        "client_id": 0,
        "post_only": false
      }
    ],
    "page_number": 1,
    "total_page_count": 1,
    "has_next": false
  }
}

This endpoint retrieves the orders of given account and market. If you need to retrieve orders from all available markets on the system use second url below, otherwise use first url to retrieve orders from a spesific market.

Pagination

This API request will return paginated results. The page_number parameters can be used to control pagination. Default page number will be 1 if it is not provided. Page size is 20 for every request.

HTTP Request

GET https://platform.andx.one/api/v1/orders/<ACCOUNT_NAME>/<STATUS>/<MARKET_CODE>/<PAGE_NUMBER>/

URL Parameters

Parameter Description Required Default
ACCOUNT_NAME Name of the account to retrieve Yes -
STATUS Order status(OPEN = "O", CLOSED = "C", ALL = "A") Yes -
MARKET_CODE Market Code('BTCTRY' e.g) Yes -
PAGE_NUMBER Page Number No 1

or to get orders from all available markets:

GET https://platform.andx.one/api/v1/orders/<ACCOUNT_NAME>/<STATUS>/<PAGE_NUMBER>/

URL Parameters

Parameter Description Required Default
ACCOUNT_NAME Name of the account to retrieve Yes -
STATUS Order status(OPEN = "O", CLOSED = "C", ALL = "A") Yes -
PAGE_NUMBER Page Number No 1

Enum in Response Properties

Parameter Description
channel_code W: Web, M: Mobile
buy_sell B: Buy, S: Sell
status O: OPEN, C: CLOSED, A: ALL

Get Order Status

import requests

url = "https://platform.andx.one/api/v1/order_status/122/"

headers = {
    'ACCESS-USER': "your.username",
    'ACCESS-PASSPHRASE': "your.passphrase",
    'ACCESS-TIMESTAMP': "timestamp",
    'ACCESS-SIGN': "signature",
    'ACCESS-KEY': "your.apikey",
    'content-type': "application/json"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)
curl -H "cache-control: no-cache" \
     -H "ACCESS-USER: your.username" \
     -H "ACCESS-PASSPHRASE: your.passphrase" \
     -H "ACCESS-TIMESTAMP: timestamp" \
     -H "ACCESS-SIGN: signature" \
     -H "ACCESS-KEY: your.apikey" \
     -H "content-type: application/json" \
     https://platform.andx.one/api/v1/order_status/122/

The above command returns JSON structured like this:

{
  "status": "success",
  "data": {
    "order": {
      "order_number": 54259,
      "account_number": 109,
      "order_type": "limit",
      "market_code": "BTCTRY",
      "base_currency": "BTC",
      "counter_currency": "TRY",
      "channel_code": "W",
      "price": "40683.54",
      "volume": "0.01000000",
      "volume_executed": "0.01000000",
      "volume_remaining": "0.00000000",
      "buy_sell": "S",
      "status": "F",
      "add_date": "2018-05-10 11:23:22.710724+00:00",
      "total": "406.83",
      "avg_price": "40683.54",
      "client_id": 0,
      "post_only": false
    }
  }
}

This endpoint retrieves the status of a given order.

HTTP Request

GET https://platform.andx.one/api/v1/order_status/<ORDER_NUMBER>/

URL Parameters

Parameter Description Required
ORDER_NUMBER Order number Yes

Enum in Response Properties

Parameter Description
channel_code W: Web, M: Mobile
buy_sell B: Buy, S: Sell
status NEW: N, PARTIALLY FILLED: P, FILLED: F, CANCELED: C, REJECTED: R

Create Order

import requests

url = "https://platform.andx.one/api/v1/orders/"

headers = {
    'ACCESS-USER': "your.username",
    'ACCESS-PASSPHRASE': "your.passphrase",
    'ACCESS-TIMESTAMP': "timestamp",
    'ACCESS-SIGN': "signature",
    'ACCESS-KEY': "your.apikey",
    'content-type': "application/json"
    }

payload = {
    'order_type': "limit",
    'market_code': "BTCTRY",
    'volume': "10000",
    'buy_sell': "B",
    'price': "9300",
    'client_id': 0,
    'post_only': False,
    'account_name': "Main"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
curl -H "cache-control: no-cache" \
     -H "ACCESS-USER: your.username" \
     -H "ACCESS-PASSPHRASE: your.passphrase" \
     -H "ACCESS-TIMESTAMP: timestamp" \
     -H "ACCESS-SIGN: signature" \
     -H "ACCESS-KEY: your.apikey" \
     -H "content-type: application/json" \
     -X POST \
     --data '{"order_type": "limit", "market_code": "BTCTRY", "volume": "10000", "buy_sell": "B", "price": "9300", "client_id": 0, "post_only": false, "account_name": "Main"}' \
     https://platform.andx.one/api/v1/orders/

The above command returns JSON structured like this(When order created successfully):

{
  "status": "success",
  "data": {
    "order_number": 54264
  }
}

The above command returns JSON structured like this(When an error occurred):

{
  "status": "error",
  "reason": "account_owner_different",
  "status_code": 1101,
  "data": {}
}

This endpoint allows you to create an order.

HTTP Request

POST https://platform.andx.one/api/v1/orders/

Order Properties

Parameter Type Required Description
order_type String Yes "limit" or "market"
market_code String Yes Market Code("BTCTRY" e.g)
volume String Yes Volume ("0.01" e.g)
buy_sell String Yes "B" or "S"
price String Yes Price ("40775.44" e.g, "0" for market orders)
client_id Integer No Client Id(Default = 0)
post_only Boolean No Post Only(Default = false)
account_name String Yes Account Name

Cancel Order

import requests

url = "https://platform.andx.one/api/v1/cancel_order/122/"

headers = {
    'ACCESS-USER': "your.username",
    'ACCESS-PASSPHRASE': "your.passphrase",
    'ACCESS-TIMESTAMP': "timestamp",
    'ACCESS-SIGN': "signature",
    'ACCESS-KEY': "your.apikey",
    'content-type': "application/json"
    }

response = requests.request("POST", url, data={}, headers=headers)

print(response.text)
curl -H "cache-control: no-cache" \
     -H "ACCESS-USER: your.username" \
     -H "ACCESS-PASSPHRASE: your.passphrase" \
     -H "ACCESS-TIMESTAMP: timestamp" \
     -H "ACCESS-SIGN: signature" \
     -H "ACCESS-KEY: your.apikey" \
     -H "content-type: application/json" \
     -X POST \
     --data '{}' \
     https://platform.andx.one/api/v1/cancel_order/122/

The above command returns JSON structured like this(When order cancelled successfully):

{
  "status": "success",
  "data": {
    "message": "order_cancel_request_submitted"
  }
}

The above command returns JSON structured like this(When an error occurred):

{
  "status": "error",
  "reason": "order_not_found",
  "status_code": 1201,
  "data": {}
}

This endpoint allows you to cancel an order.

HTTP Request

POST https://platform.andx.one/api/v1/cancel_order/<ORDER_NUMBER>/

URL Parameters

Parameter Description Required
ORDER_NUMBER Order number Yes

Create Withdraw Request

import requests

url = "https://platform.andx.one/api/v1/withdrawal/request/"

headers = {
    'ACCESS-USER': "your.username",
    'ACCESS-PASSPHRASE': "your.passphrase",
    'ACCESS-TIMESTAMP': "timestamp",
    'ACCESS-SIGN': "signature",
    'ACCESS-KEY': "your.apikey",
    'content-type': "application/json"
    }

payload = {
    'currency_code': "XRP",
    'amount': "100.25",
    'alias': "alias_name"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
curl -H "cache-control: no-cache" \
     -H "ACCESS-USER: your.username" \
     -H "ACCESS-PASSPHRASE: your.passphrase" \
     -H "ACCESS-TIMESTAMP: timestamp" \
     -H "ACCESS-SIGN: signature" \
     -H "ACCESS-KEY: your.apikey" \
     -H "content-type: application/json" \
     -X POST \
     --data '{"currency_code": "XRP", "amount": "100.25", "alias": "alias_name"}' \
     https://platform.andx.one/api/v1/withdrawal/request/

The above command returns JSON structured like this(When withdraw request created successfully):

{
  "status": "success",
  "data": {
    "message": "Your withdraw request is processing."
  }
}

The above command returns JSON structured like this(When an error occurred):

{
  "status": "error",
  "reason": "Withdraw address not found",
  "status_code": 1319,
  "data": {}
}

This endpoint allows you to create a withdraw request to your saved addresses. Make sure you have a withdraw address with the given alias.

HTTP Request

POST https://platform.andx.one/api/v1/withdrawal/request/

Order Properties

Parameter Type Required Description
currency_code String Yes Currency Code("XRP" e.g)
amount String Yes Amount ("100.25" e.g)
alias String Yes Alias

Response

Bitexen API returns every response as described below with HTTP status code 200

{ "status": "success", "data": { ... } }

{ "status": "error", "reason": "account_owner_different", "status_code": 1101, "data": {} }

Other Errors will be return with HTTP codes below:

HTTP Code Meaning
400 Bad Request -- This response means that server could not understand the request due to invalid syntax
401 Unauthorized -- Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.
403 Forbidden -- Client does not have access rights to the content so server is refusing to give proper response.
404 Not Found -- Server cannot find the requested resource.
405 Method Not Allowed -- The request method is known by the server but has been disabled and cannot be used. Double check your method type (i.e. GET, POST, PUT, DELETE)
429 Too Many Requests -- The user has sent too many requests in a given amount of time ("rate limiting").
500 Internal Server Error -- The server has encountered a situation it doesn't know how to handle.
503 Service Unavailable -- The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded.