shell

Introduction

Welcome to Nami.Exchange, we provides a simple and powerful API consisting of REST endpoints for market updates.

We have code example in Shell! You can view code examples in the dark area to the right.

If you have any API questions, feedback, or recommendations please post a question via our Github page Github page

API Access

Access URLs

Endpoint Rate Limit

The Nami.Exchange API employs call limits on all endpoints to ensure the efficiency and availability of the platform for all customers. In general, API users are permitted to make a maximum of 60 API calls per minute. Calls after the limit will fail, with the limit resetting at the start of the next minute. If your IP reachs rate limit too much, your IP will be banned within 1 hour. So, always pay attention to the frequency of requests

Request Format

All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format.

Response Format

All response will be returned in JSON format. The top level JSON is a wrapper object which has metadata "status". The actual per API response data is in "data" field. Response JSON Wrapper Content

Response wrapper content example:

{
  "status": "ok",
  "data":  "API response data in nested JSON object"
}
Field Data Type Description
status string The overall API call result status
data object The actual response content per API

Changelog

Time (UTC+7) Change Detail
2019.08.26 08:00 Public Market Data API at endpoint https://nami.exchange/api/v1.0/market.
2019.12.26 08:00 Public Spot Trade API at endpoint https://nami.exchange/api/v1.0/spot.
2019.12.27 08:00 Public User Data API at endpoint https://nami.exchange/api/v1.0/user.

Authentication

Public API

The Market Data API (https://nami.exchange/api/v1.0/market) does not require authentication.

Authentication using API key

Authentication is done by sending the following HTTP headers:

Example using API key

Use these calculations as test cases in your code.

apiKey = 'zukHJtjyIKUN22WhrkNSzf54CzsMtR4m'
apiSecret = 'bXKoe2Gr3nes99nMmpu44h7hCNQlZf6GAPJ3oAueRcRYWpdnhWKgVu64roeOO7Gh'


Simple GET 
Get user wallet from /api/v1.0/user/wallet

verb = 'GET'
url = /api/v1.0/user/wallet
params = {
    currency: 'ETH'
}
=> path = '/api/v1.0/user/wallet?currency=ETH'
expires = 1518064236 # Friday, December 27, 2019 4:39:51 AM
data = ''

signagure = HEX(HMAC_SHA256(apiSecret, verb + path + str(expires) + data))
signagure = HEX(HMAC_SHA256(apiSecret, 'GET/api/v1.0/user/wallet?currency=ETH1577421591'))
signagure = 'e24d08880b9d9b6c1f77fecc5977ed1a9ee1102ab0f34757e792057f1c78a3a5'



Simple POST 
Create new Order from /api/v1.0/spot/order

verb = 'POST'
url = /api/v1.0/spot/order
params = {}
=> path = '/api/v1.0/spot/order'
expires = 1577421880 # Friday, December 27, 2019 4:44:40 AM
data = { 
    symbol: 'NACUSDT',
    side: 'BUY',
    type: 'LIMIT',
    quantity: 1,
    price: 1,
    stop_price: 0 
}

signagure = HEX(HMAC_SHA256(apiSecret, verb + path + str(expires) + data))
signagure = HEX(HMAC_SHA256(apiSecret, 'POST/api/v1.0/spot/order1577421880{"symbol":"NACUSDT","side":"BUY","type":"LIMIT","quantity":1,"price":1,"stop_price":0}'))
signagure = '986ac8fa1d263cd047aa7791be3f185fe892ce4dbfc9c8d09fc3a2f39715cddb'

Troubleshooting

If you are receiving "Invalid API Key" messages, check the following:

If you are receiving "Invalid API Permission" messages, check the following:

If you are receiving "Signature Not Valid" messages, check the following:

Market Data

Get Exchange Info

curl "https://nami.exchange/api/v1.0/market/symbols"

The above command returns JSON structured like this:

{
    "status": "ok",
    "data": [
        {
            "symbol": "ETHUSDT",
            "exchange_currency": "ETH",
            "base_currency": "USDT",
            "status": "TRADING",
            "min_price": 0.0001,
            "max_price": 1000000,
            "tick_size": 0.01,
            "step_size": 0.00001,
            "min_qty": 0.00001,
            "max_qty": 9000,
            "min_notional": 10
        }
    ]
}

Current exchange trading rules and symbol information

HTTP Request

GET /market/symbols

Response Content

Field Data Type Description
symbol string The trading symbol of this object, e.g. btcusdt, bccbtc
base_currency string Base currency, for example: with symbol BTCUSDT, base currency is USDT
exchange_currency string Exchange currency, for example: with symbol BTCUSDT, base currency is BTC
min_price float Min exchange rate
max_price float Max exchange rate
tick_size float Min exchange rate movement
step_size float Min exchange amount movement
min_qty float Min exchange amount
max_qty float Max exchange amount
min_notional float Min value of exchange_rate*exchange_amount

Get 24hr ticker price

curl "https://nami.exchange/api/v1.0/market/summaries"

The above command returns JSON structured like this:

{
    "status": "ok",
    "data": [
         {
            "symbol": "BTCUSDT",
            "last_price": 10090.8,
            "change_24h": 10,
            "last_price_24h": 10080.8,
            "high_24h": 10099.8,
            "low_24h": 10079.8,
            "high_1h": 10099.8,
            "low_1h": 10079.8,
            "total_exchange_volume": 20.459,
            "total_base_volume": 206232.93,
            "base_currency": "USDT",
            "exchange_currency": "BTC"
        }
    ]
}

Get 24h ticker data of all available symbols or specific symbol.

HTTP Request

GET /market/summaries

Query Parameters

Parameter Data Type Required Default Value Description Value Range
symbol string false NA The trading symbol to query All supported trading symbols, e.g. btcusdt, ethusdt

Response Content

Field Data Type Description
symbol string The trading symbol of this object, e.g. btcusdt, bccbtc
last_price float The last price
change_24h float Change compare to last 24 hours price
last_price_24h float Last price 24 hours
high_24h float The high price of last 24 hours
low_24h float The low price of last 24 hours
high_1h float The high price of last 1 hours
low_1h float The low price of last 1 hours
total_exchange_volume float The trading volume in exchange currency of last 24 hours
total_base_volume float The trading volume in base currency of last 24 hours
base_currency string Base currency, for example: with symbol BTCUSDT, base currency is USDT
exchange_currency string Exchange currency, for example: with symbol BTCUSDT, base currency is BTC

Get Market Depth

curl "https://nami.exchange/api/v1.0/market/depth?symbol=ETHUSDT"

The above command returns JSON structured like this:

{
    "status": "ok",
    "data": {
        "bids": [
            {
                "amount": 0.521268,
                "exchange_rate": 186.01,
                "action": "BUY"
            }
        ],
        "asks": [
            {
                "amount": 0.9578,
                "exchange_rate": 192.99,
                "action": "SELL"
            }
        ]
    }
}

This endpoint retrieves the current order book of a specific symbol.

HTTP Request

GET /market/depth

Query Parameters

Parameter Data Type Required Default Value Description Value Range
symbol string true NA The trading symbol to query All supported trading symbols, e.g. btcusdt, ethusdt
limit int false 20 Limit depth of order book [1-20]

Response Content

Field Data Type Description
bids object The current all bids in format [amount, exchange_rate, action]
asks ojbject The current all asks in format [amount, exchange_rate, action]

Get the Most Recent Trades

curl "https://nami.exchange/api/v1.0/market/history/trade?symbol=ETHUSDT"

The above command returns JSON structured like this:

{
    "status": "ok",
    "data": [
        {
            "direction": "SELL",
            "exchange_rate": 0.00652,
            "exchange_amount": 3354,
            "base_amount": 21.86808,
            "created_at": 1567006044486
        }
    ]
}

This endpoint retrieves the most recent trades with their exchange rate, base amount, exchange amount, and direction.

HTTP Request

GET /market/history/trade

Query Parameters

Parameter Data Type Required Default Value Description Value Range
symbol string true NA The trading symbol to query All supported trading symbols, e.g. btcusdt, ethusdt
limit int false 20 Limit depth of order book [1-100]

Response Content

Field Data Type Description
base_amount float The trading volume in base currency
exchange_amount float The trading volume in exchange currency
exchange_rate float The trading price in quote currency
created_at integer The UNIX timestamp in milliseconds
direction string The direction of the taker trade: 'BUY' or 'SELL'

Get Tickers Data

curl "https://data.nami.exchange/nami/prices/history?symbol=BTCUSDT&resolution=60&from=1606017873&to=1606104273"

The above command returns JSON structured like this:

{
    "t": [1606093200, 1606096800, 1606100400, 1606104000],
    "o": [741, 779, 765, 760],
    "h": [782, 779, 774, 763],
    "l": [736, 760, 760, 757],
    "c": [779, 765, 760, 759],
    "v": [0, 0, 0, 0],
    "s": "ok"
}

This endpoint retrieves the ticker data with open, close, high, low and time of ticker.

HTTP Request

GET https://data.nami.exchange/nami/prices/history

Query Parameters

Parameter Data Type Required Default Value Description Value Range
symbol string true NA The trading symbol to query All supported trading symbols, e.g. btcusdt, ethusdt
resolution string true 20 Timeframe of ticker [1, 60, D]
from int true 20 From in timestamp [1-100]
to int true 20 To in timestamp [1-100]

Response Content

Field Data Type Description
t float Time of tickers in array
o float Open Data of tickers in array
h float High Data of tickers in array
l integer Low Data of tickers in array
v string Volume of tickers in array
s string Status

Account

Access URLs

Endpoint Rate Limit

The Nami.Exchange API employs call limits on all endpoints to ensure the efficiency and availability of the platform for all customers. In general, API users are permitted to make a maximum of 60 API calls per minute. Calls after the limit will fail, with the limit resetting at the start of the next minute. If your IP reachs rate limit too much, your IP will be banned within 1 hour. So, always pay attention to the frequency of requests

Request Format

All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format.

Response Format

All response will be returned in JSON format. The top level JSON is a wrapper object which has metadata "status". The actual per API response data is in "data" field. Response JSON Wrapper Content

Response wrapper content example:

{
  "status": "ok",
  "data":  "API response data in nested JSON object"
}
Field Data Type Description
status string The overall API call result status
data object The actual response content per API

User

Get User Wallet

curl "https://nami.exchange/api/v1.0/user/wallet"

The above command returns JSON structured like this:

{
    "status": "ok",
    "data": [
    {
        "currency": "NAC",
        "value": 2465,
        "locked_value": 0
    },
    {
        "currency": "ETH",
        "value": 1009.8500524310101,
        "locked_value": 0.10001
    },
    {
        "currency": "DAI",
        "value": 10000,
        "locked_value": 0
    },
    {
        "currency": "SPIN",
        "value": 26058.942333333325,
        "locked_value": 11271
    }]
}

API Key Permission:Read This endpoint submit a request to create an order.

HTTP Request

POST https://nami.exchange/api/v1.0/spot/order

Query Parameters

Parameter Data Type Required Default Value Description Value Range
currency String false NA Filter Currency Supported Currency

Response Content

Field Data Type Description
currency String Currency
value Double Balance of user
locked_value Double Lock value in spot, futures,...

Trading

Get Opening Order

curl "https://nami.exchange/api/v1.0/spot/order"

The above command returns JSON structured like this:

{
    "status": "ok",
    "data": [
    {
        "id": null,
        "user_id": 18,
        "action": "BUY",
        "type": "STOP_LIMIT",
        "status": "PENDING",
        "quantity": 1,
        "price": 1,
        "stopPrice": 0.5,
        "base_currency": "USDT",
        "exchange_currency": "NAC",
        "created_at": "2019-12-26T11:29:23.721Z"
    }]
}

API Key Permission:Read This endpoint submit a request to create an order.

HTTP Request

POST https://nami.exchange/api/v1.0/spot/order

Query Parameters

Parameter Data Type Required Default Value Description Value Range

Response Content

Field Data Type Description
id Integer Order ID
symbol String Order Symbol
status String Order Side (BUY, SELL)
side String Order Side (BUY, SELL)
type String Order Type (MARKET, LIMIT, STOP_LIMIT)
quantity String Order Amount
price String Order Price
stop_price String Order Stop Price for STOP_LIMIT
created_at Date The timestamp when the order was created

Get History Order

curl "https://nami.exchange/api/v1.0/spot/order_history"

The above command returns JSON structured like this:

{
    "status": "ok",
    "data": [
    {
        "id": 21,
        "symbol": "NACUSDT",
        "action": "BUY",
        "type": "LIMIT",
        "status": "SUCCESS",
        "quantity": 10000,
        "price": 1,
        "created_at": "2019-12-27T03:03:56.497Z"
    }]
}

API Key Permission:Read This endpoint submit a request to create an order.

HTTP Request

POST https://nami.exchange/api/v1.0/spot/order_history

Query Parameters

Parameter Data Type Required Default Value Description Value Range
page Integer false 0 Page index 0, 1, 2,...
page_size Integer false 20 Size of page Max: 100

Response Content

Field Data Type Description
id Integer Order ID
symbol String Order Symbol
status String History Status (MATCH_ORDER, CLOSE_ORDER)
side String Order Side (BUY, SELL)
type String Order Type (MARKET, LIMIT, STOP_LIMIT)
quantity String Order Amount
price String Order Price
stop_price String Order Stop Price for STOP_LIMIT
created_at Date The timestamp when the order was created

Place a New Order

curl -X POST -H "Content-Type: application/json" "https://nami.exchange/api/v1.0/spot/order" -d
'{
    "symbol": "NACUSDT",
    "side": "SELL",
    "type": "MARKET",
    "quantity": 1000,
    "price": 1,
    "stop_price": 0
}'

The above command returns JSON structured like this:

{  
   "status":"ok",
   "data":{  
      "symbol":"NACUSDT",
      "side":"SELL",
      "type":"MARKET",
      "exchange_amount":1,
      "avg_price":1
   }
}

API Key Permission:Exchange This endpoint submit a request to create an order.

HTTP Request

POST https://nami.exchange/api/v1.0/spot/order

Body Parameters

Parameter Data Type Required Default Value Description Value Range
symbol string true NA The trading symbol to query All supported trading symbols, e.g. btcusdt, ethusdt
side string true NA The trading side BUY, SELL
type string true NA The trading type MARKET, LIMIT, STOP_LIMIT
quantity double true NA The trading quantity
price string true NA Limit price of limit or stop-limit order
stop_price string true NA Stop price of stop-limit order

Response Content

Field Data Type Description
id Integer Order ID
symbol String Order Symbol
side String Order Side (BUY, SELL)
type String Order Type (MARKET, LIMIT, STOP_LIMIT)
quantity String Order Amount
price String Order Price
stop_price String Order Stop Price for STOP_LIMIT
avg_price String Order Avg Price for MARKET

Delete Order

curl --location --request DELETE 'https://nami.exchange/api/v1.0/spot/order' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": 1238912
}'

The above command returns JSON structured like this:

{  
   "status":"ok",
   "data":{  
      "id":1238912
   }
}

API Key Permission:Exchange This endpoint submit a request to create an order.

HTTP Request

POST https://nami.exchange/api/v1.0/spot/order

Body Parameters

Parameter Data Type Required Default Value Description Value Range
id Integer true NA Order ID

Response Content

Field Data Type Description
id Integer Order ID

Errors

Each error will have a status and message which explain the details of the error.

Error Code Meaning
400 Bad Request, your request is invalid.
401 Unauthorized
418 IP Banned
429 Too Many Requests
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.