NCX API

NCX provides a complete RESTful API for developers which allows full access to all the functionalities on the exchange.

These endpoints are categorized into public and private. Public endpoints allow you to access public information such as price ticker, orderbook etc while private endpoints require authentication and allow you to get your balance, active orders as well as placing orders.

Authentication

NCX uses HMAC-SHA256 authentication for private user access to the API. HMAC-SHA256 takes a string and secret key (your api-secret) and outputs an encoded signature (your api-signature). The string being encoded should follow the format ${METHOD}${PATH}${api-expires}, where METHOD is the HTTP method of the request, PATH is the path of the request, and api-expires is a unix timestamp indicating when the request expires. If the request includes a body, the JSON body object should be appended to the string being encoded e.g. ${METHOD}${PATH}${api-expires}${JSON_BODY}. You can use an online HMAC generator to generate the signature.
Examples of strings being encoded:
  • GET request to https://ncx.mn/api/v2/user/balance that expires at 1575516146
    GET/v2/user/balance1575516146
  • POST request to https://ncx.mn/api/v2/order that expires at 1575516146 with body {"symbol":"btc-usdt","side":"buy","size":0.001,"type":"market"}
    POST/v2/order1583284849{"symbol":"btc-usdt","side":"buy","size":0.001,"type":"market"}
You can register for a new NCX api-key and api-secret in the security section of ncx.mn.
NCX expects api-key, api-signature, and api-expires to be included in all Private API requests to the server in the request header with the following format:


You must replace API_KEY, API_SIGNATURE, and API_EXPIRES with your own values

To authorize, use this code:


# With shell, you can just pass the correct header with each request curl -X POST
-H "api-key: $API_KEY"
-H "api-signature: $API_SIGNATURE"
-H "api-expires: $API_EXPIRES"
"api_endpoint_here"

Make sure to replace $API_KEY, $API_SIGNATURE, and $API_EXPIRES with your own key, signature, and expires values.

 

api-key: <API_KEY>
api-signature: <API_SIGNATURE>
api-expires: <API_EXPIRES>

 

PUBLIC

Ticker

GET

This endpoint retrieves ticker information for a pair.

PATH PARAMS
string required

The currency pair symbol (ntc-mnt)

RESPONSE
200

Tickers

GET This endpoint retrieves ticker information for all pairs.

RESPONSES

200; 400

Orderbook

This endpoint retrieves 10 level bids and 10 level asks of the orderbook for a symbol

PATH PARAMS

string required

The currency pair symbol (btc-usdt)

RESPONSES
200; 400

Orderbooks

This endpoint retrieves 10 level bids and 10 level asks of the orderbook for all symbols.

RESPONSES
200; 400

Trades

This endpoint retrieves the last 30 trades.

PATH PARAMS

string required

The currency pair symbol (ntc-mnt)


RESPONSES
200; 400

Chart

This endpoint retrieves a trading pair's trade history HOLCV.

PATH PARAMS

string required

Symbol to get

Time interval resolution (15, 60, 240, 1D, 1W)

Beginning UNIX timestamp

Ending UNIX timestamp

RESPONSES
200; 400

Charts

This endpoint retrieves trade history HOLCV for all pairs.

Time interval resolution (15, 60, 240, 1D, 1W)

Beginning UNIX timestamp

Ending UNIX timestamp

RESPONSES
200; 400

PRIVATE

Get User

GET
string

Get Balance

GET
string

Get Deposits

GET
string required
The currency pair symbol


Number of elements to return. Default: 50. Maximun: 100


Page of data to retrieve


Field to order data

asc or desc

Get deposits with this transaction ID

Get deposits made to this address

boolean required

Completed status of deposits to get

Dismissed status of deposits to get

Rejected status of deposits to get

Processing status of deposits to get

Waiting status of deposits to get

Starting date of queried data in ISO 8601 format

Ending date of queried data in ISO 8601 format


Pass value csv to download csv file

 

string

Get Withdrawals

GET
string required
The currency pair symbol


Number of elements to return. Default: 50. Maximun: 100


Page of data to retrieve


Field to order data

asc or desc

Get deposits with this transaction ID

Get deposits made to this address

boolean required

Completed status of deposits to get

Dismissed status of deposits to get

Rejected status of deposits to get

Processing status of deposits to get

Waiting status of deposits to get

Starting date of queried data in ISO 8601 format

Ending date of queried data in ISO 8601 format


Pass value csv to download csv file

 

string

Get Withdrawal Fee

GET
string

Create Withdrawal Request

GET

The desired currency e.g. btc

The amount to withdrawal e.g. 5

The recipient wallet's address

Network of currency being withdrawn if there are multiple networks for currency

OTP for user if user has OTP enabled

string

Get Trades

GET
string required
The currency pair symbol


Number of elements to return. Default: 50. Maximun: 100


Page of data to retrieve


Field to order data

asc or desc

Starting date of queried data in ISO 8601 format

Ending date of queried data in ISO 8601 format


Pass value csv to download csv file


string

Get All Orders

GET
string required
The currency pair symbol

string required
Side of orders to query (buy, sell)

string required
Status of order (filled, pfilled, canceled, new)

string required
Open status of order


Number of elements to return. Default: 50. Maximun: 100


Page of data to retrieve


Field to order data

asc or desc

Starting date of queried data in ISO 8601 format

Ending date of queried data in ISO 8601 format

string

Get Order

GET
 

Order unique Id

 

string

Create Order

GET
string required
The currency pair symbol

string required
Side of orders to query (buy, sell)

string required
The amount of the order

string required
limit or market order type


Only should be used when type is limit.


Stop price of order


Object with other options such as post_only

string

Cancel All Orders

GET
 

The currency pair symbol

 

string

Cancel Order

GET
 

Specific order unique Id

 

string

ERRORS

Errors

List of http request errors you might get from ncx.mn

The NCX API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
403 Unauthorized/Forbidden -- Your api token is not valid.
404 Not Found -- The specified request could not be found.
405 Method Not Allowed -- You tried to access a request with an invalid method.
410 Gone -- The request has been removed from our servers.
429 Too Many Requests -- You're requesting too many requests! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

Using Nodejs Library

Connect with ncx.mn using Hollaex kit Nodejs Library

Requirements

  • Knowledge of basic usage of nodejs and npm
  • Nodejs version >= 12

Request structure

// Initialize Client using above example...

client
	.getTicker('xht-usdt')
	.then((res) => {
		console.log('The volume is: ', res.volume);
	})
	.catch((err) => {
		console.log(err);
	});

client
	.getTrade({ symbol: 'xht-usdt' })
	.then((res) => {
		console.log('Public trades: ', res);
	})
	.catch((err) => {
		console.log(err);
	});

 

Example

// Initialize Client using above example...
const socket1 = client.connect('trades:xht-usdt');

socket1.on('trades', (data) => {
	console.log(data);
});

const socket2 = client.connect('all');

socket2.on('orderbook', (data) => {
	console.log(data);
});

// You have to use a token to use these  otherwise the socket disconnects
socket2.on('userInfo', (data) => {
	console.log(data);
});


setTimeout(() => {
	socket2.disconnect();
}, 5);

Available methods

Command

Parameters

Description

getKit

Get exchange information e.g. name, valid languages, description, etc.

getConstants

Tick size, min price, max price, min size and max size of each symbol pair and coin

getTicker

symbol

Last, high, low, open and close price and volume within the last 24 hours

getTickers

Last, high, low, open and close price and volume within the last 24 hours for all symbols

getOrderbook

symbol

Orderbook containing list of bids and asks

getOrderbooks

Orderbook containing list of bids and asks for all symbols

getTrade

symbol (optional)

List of last trades

getUser

User’s personal information

getBalance

User’s wallet balance

getDeposits

currency (optional), limit (optionaldefault=50, max=100), page (optionaldefault=1), orderBy (optionaldefault=id), order (optionaldefault=asc, asc or desc), startDate (optionaldefault=0, format=ISO8601), endDate (optionaldefault=NOW, format=ISO8601)

User’s list of all deposits

getWithdrawals

currency (optional), limit (optionaldefault=50, max=100), page (optionaldefault=1), orderBy (optionaldefault=id), order (optionaldefault=asc, asc or desc), startDate (optionaldefault=0, format=ISO8601), endDate (optionaldefault=NOW, format=ISO8601)

User’s list of all withdrawals

requestWithdrawal

currencyamountaddress (receipient’s)

Create a new withdrawal request. Disable Two-Factor Authentication to be able to use this function. Must confirm within 5 minutes via email to complete withdrawal

getUserTrades

symbol (optional), limit (optionaldefault=50, max=100), page (optionaldefault=1), orderBy (optionaldefault=id), order (optionaldefault=desc, asc or desc), startDate (optionaldefault=0, format=ISO8601), endDate (optionaldefault=NOW, format=ISO8601)

User’s list of all trades

getOrder

orderId

Get specific information about a certain order

getOrders

symbol (optional), limit (optionaldefault=50, max=100), page (optionaldefault=1), orderBy (optionaldefault=id), order (optionaldefault=desc, enum=asc, desc), startDate (optionaldefault=0, format=ISO8601), endDate (optionaldefault=NOW, format=ISO8601)

Get the list of all user orders. It can be filter by passing the symbol

createOrder

symbolside (buy or sell), sizetype (market or limit), pricestop (optional), meta (optional, object with optional properties e.g. post_only)

Create a new order

cancelOrder

orderId

Cancel a specific order with its ID

cancelAllOrders

symbol (optional)

Cancel all open order. It can be filter by passing the symbol