× #message#
×

Warning

Exchange API Documentation

Our REST API can be used to fetch market data from Limitlex Exchange platform, as well as to manage trading activities: check balance, open/cancel orders, get trading and funding history.

Please note: Exchange API accepts GET and POST requests for public and POST requests for private calls.

You have to send HTTP parameters using application/x-www-form-urlencoded format.

More about POST requests here.

API endpoints are divided into two groups: public and private.

Public API functions are prefixed with /public/{method}, for example:
https://limitlex.com/api/public/currencies

Private API functions use path prefixed with /private/{method}, for example:
https://limitlex.com/api/private/cancel_order

Public API methods

Public methods are not related to a particular user, so you don’t need to pass any API keys.

This is the list of public API calls:

  • /currencies
  • /pairs
  • /ticker
  • /ohlc
  • /order_book
  • /recent_trades

Private API methods

Private calls are intended to manage trading activities and they require you to send additional data to execute operations.

Keys can be generated in the user profile:

My Account > Profile > Exchange API Key.

To perform a private API request, you need to have following:

  1. API user public identifier attached to ’API-Key’ header.
  2. Nonce in the body of the request.
  3. Signature of the request stored in ’API-Sign’ header.

Nonce is a Unix timestamp, that must be appended to the body of each request, and must not be older than 30 seconds.

You also need to provide the signature, so we can make sure that your request has not been malformed.

The signature must follow ASN.1 format.

The method we are using is ECDSA (Elliptic Curve Digital Signature Algorithm) combined with SHA-512 hash algorithm.

Below are the steps you need to follow to create the signature for your request:

  1. Concatenate two strings:
  • String of API Function (for example: "/private/balance")
  • URL encoded parameters from the body of the request.
  1. Sign it with your private key using ECDSA algorithm with SHA512 digest.

A HTTP request should be structured as follows:

HTTP HEADERS:

API-Key: (PUBLIC KEY YOU GENERATED IN PROFILE)

API-Sign: ECDSA_SHA512_SIGN( API_FUNCTION + BODY_PARAMS_URL_ENCODED ) as BASE64

REQUEST BODY:

nonce=NONCE¶m1=PARAM1¶m2=PARAM2

At the bottom of this document you can find example of querying private endpoints in Node.js

List of private calls:

  • /balance
  • /open_orders
  • /trades
  • /add_order
  • /cancel_order
  • /cancel_all_orders
  • /order_status
  • /withdrawal
  • /deposit_addresses
  • /ledger
  • /blockchain_transactions
  • /websocket_token

API request limitations

Every user has limited amount of allowed API calls per 10 seconds, 1 minute and 1 day.

These are limits by each interval in points:

Interval Cost
10 seconds 500 points
1 minute 1500 points
1 day 1000000 points

Also pay attention that each API endpoint request spends different amount of points:

Public Endpoint Cost
pairs 2
currencies 2
ticker 2
ohlc 5
order_book 5
recent_trades 10

 

Private Endpoint Cost
balance 2
open_orders 2
trades 10
add_order 10
cancel_order 10
cancel_all_orders 20
order_status 2
withdrawal 100
websocket_token 2
deposit_addresses 2
ledger 10
blockchain_transactions 10

 

If you spend more points that you are allowed to spend you will get this message:

{
  "error": {
    "code": 5,
    "message": "rate limit exceeded"
  },
  "req_id": "9fd99389-2445-11eb-ba6f-0242ac120007"
}

Open orders limit

Also there is limit on open orders.

Make sure you are not holding more than 50 orders on all pairs at once, otherwise you will not able to open new orders.

This error is shown in this case:

{
  "error": {
    "code": 242,
    "message": "open orders limit exceeded"
  },
  "req_id": "a2e24a5e-240f-11eb-ba6f-0242ac120007"
}

Public methods reference

Get list of currencies: /currencies

This method does not accept any parameters.

{
  "result": {
    "data": [
      {
        "id": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
        "deposit_locked": false,
        "withdrawal_locked": false,
        "decimals": 8,
        "fiat": false,
        "name": "Bitcoin",
        "code": "BTC",
        "withdrawal_fee": "0.0005",
        "withdrawal_minimum": "0.002",
        "unified_cryptoasset_id": 1
      },
      {
        "id": "76d845ac-1e6a-4a1b-995b-762370e8c1cd",
        "deposit_locked": false,
        "withdrawal_locked": false,
        "decimals": 6,
        "fiat": false,
        "name": "Tether",
        "code": "USDT",
        "withdrawal_fee": "1.2",
        "withdrawal_minimum": "2",
        "unified_cryptoasset_id": 825
      }
    ]
  },
  "req_id": "9b1eca38-240e-11eb-a7ff-0242ac120007"
}

Get list of exchange pairs: /pairs

Parameter Required Description
pair_id No Specify exact pair
{
  "result": {
    "data": [
      {
        "id": "44567e46-d10c-4b99-bc82-4e2faca15234:76d845ac-1e6a-4a1b-995b-762370e8c1cd",
        "currency_id_1": "44567e46-d10c-4b99-bc82-4e2faca15234",
        "currency_id_2": "76d845ac-1e6a-4a1b-995b-762370e8c1cd",
        "locked": false,
        "decimals": 2,
        "min_amount_1": "0.00001",
        "min_amount_2": "10"
      },
      {
        "id": "ab651a43-1fc9-4163-a31b-74e5f537e82f:bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "currency_id_1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
        "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "locked": false,
        "decimals": 2,
        "min_amount_1": "0.000001",
        "min_amount_2": "2"
      }
    ]
  },
  "req_id": "07141172-240f-11eb-a7ff-0242ac120007"
}

Get tick data of the specified exchange pair: /ticker

Parameter Required Description
pair_id No Exchange pair
{
  "result": {
    "currency_id_1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
    "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
    "last_price": "8096.46",
    "volume_1": "4.58732267",
    "volume_2": "39044.90205",
    "high": "9041.70",
    "low": "7977.22",
    "open": "8002.50",
    "close": "8096.46",
    "change": "93.96",
    "percentage": "1.17",
    "bid": "7621.50",
    "ask": "8900.20"
  },
  "req_id": "a2e24a5e-240f-11eb-a7ff-0242ac120007"
}

OHLC (open-high-low-close) data for specific timeframe: /ohlc

Parameter Required Description
pair_id Yes Exchange pair
interval No Timeframe, default = M1
since No Timestamp from which ticks are returned
limit No Select amount of last ticks

Allowed timeframes/intervals are:

Value Timeframe
“1” M1
“3” M3
“5” M5
“15” M15
“30” M30
“60” H1
“120” H2
“240” H4
“480” H8
“720” H12
“900” H15
“1440” Daily
“10080” Weekly
“43200” Monthly
{
  "result": {
    "data": [
      {
        "time": "1605115140000000",
        "open": "8900.20",
        "high": "8900.20",
        "low": "8900.20",
        "close": "8900.20",
        "change": "0.00",
        "volume": "0.00000000"
      },
      {
        "time": "1605115200000000",
        "open": "8900.20",
        "high": "8900.20",
        "low": "8900.20",
        "close": "8900.20",
        "change": "0.00",
        "volume": "0.00000000"
      }
    ],
    "last": "1605115200000000"
  },
  "req_id": "31896df7-2442-11eb-ba6f-0242ac120007"
}

Order book: /order_book

Parameter Required Description
pair_id Yes Exchange pair
limit No Amount of nearest bids/asks (market depth)
{
  "result": {
    "date_created": "1605093768225498",
    "asks": [
      {
        "price": "8900.20",
        "amount_1": "0.00463156"
      },
      {
        "price": "9397.30",
        "amount_1": "0.01065689"
      }
    ],
    "bids": [
      {
        "price": "7621.50",
        "amount_1": "0.00447229"
      },
      {
        "price": "7621.20",
        "amount_1": "0.04686994"
      }
    ]
  },
  "req_id": "3a5de95d-2410-11eb-a7ff-0242ac120007"
}

Get recent trades: /recent_trades

Parameter Required Description
pair_id Yes Exchange pair
since No Unix timestamp in microseconds to list trades from
limit No Amount of last trades to return

Timestamp is an Unix timestamp in microseconds represented as an integer (The number of microseconds elapsed since January 1, 1970 UTC).

{
  "result": {
    "data": [
      {
        "trade_id": "8c080678-283d-4f60-a36a-aee99de2a4fd:52563e9b-1ae0-44ff-8d00-52c3ffa0dd72",
        "amount_1": "0.00001318",
        "amount_2": "0.11727",
        "price": "8898.10",
        "order_direction": "buy",
        "date_created": "1605084159321746"
      },
      {
        "trade_id": "3be66742-24d1-4c7c-aa32-e32e5b5814f5:0f29b35a-698c-4f02-b7e3-bae1347ae387",
        "amount_1": "0.00028770",
        "amount_2": "2.58638",
        "price": "8989.88",
        "order_direction": "buy",
        "date_created": "1605084165872574"
      }
    ],
    "last": "1605091626459102"
  },
  "req_id": "7d92c676-2415-11eb-a7ff-0242ac120007"
}

Private methods reference

Use HTTP POST nonce parameter and the parameters listed in the table at each private method below.

Balance on all wallets: /balance

This method does not accept any parameters.

{
  "result": {
    "data": [
      {
        "currency_id": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "amount_available": "560.49093",
        "amount_reserved": "83.96741"
      },
      {
        "currency_id": "76d845ac-1e6a-4a1b-995b-762370e8c1cd",
        "amount_available": "1173.84055900",
        "amount_reserved": "0.000000"
      }
    ]
  },
  "req_id": "76396a8c-241a-11eb-a7ff-0242ac120007"
}

List user’s open orders: /open_orders

Parameter Required Description
pair_id Yes Pair on which orders are opened
{
  "result": {
    "data": [
      {
        "order_id": "f55bc6ee-b414-496c-8d88-514083529dc6",
        "order_direction": "buy",
        "amount_initial": "0.00031898",
        "amount_open": "0.00031898",
        "price": "8500.00",
        "date_created": "1605099779360546"
      },
      {
        "order_id": "64a72823-2728-4f13-a7b5-6fbb195e4e13",
        "order_direction": "sell",
        "amount_initial": "0.00500000",
        "amount_open": "0.00500000",
        "price": "9500.00",
        "date_created": "1605099828393383"
      }
    ]
  },
  "req_id": "587c9715-241e-11eb-a7ff-0242ac120007"
}

List user’s trades: /trades

Parameter Required Description
pair_id Yes Pair on which trades were made
start No Unix timestamp in microseconds, return trades that are newer
end No Unix timestamp in microseconds, return trades that are older
{
  "result": {
    "data": [
      {
        "currency_id_1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
        "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "trade_id": "9bc82228-221b-48e9-bf35-5eaf865c31c6:2c2e368b-ff55-48c8-adc2-e0e75b009b89",
        "order_id": "9bc82228-221b-48e9-bf35-5eaf865c31c6",
        "amount_1": "0.00031898",
        "amount_2": "2.83898",
        "price": "8900.20",
        "order_side": "taker",
        "order_direction": "buy",
        "order_trade_type": "limit",
        "date_created": "1605099315273435"
      },
      {
        "currency_id_1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
        "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "trade_id": "48ac68a1-df4e-43ac-b8fd-9f976bdccf7a:596194bf-b6c5-4ddc-b16f-b3f77778c0b2",
        "order_id": "48ac68a1-df4e-43ac-b8fd-9f976bdccf7a",
        "amount_1": "0.00092131",
        "amount_2": "7.54650",
        "price": "8191.06",
        "order_side": "taker",
        "order_direction": "sell",
        "order_trade_type": "limit",
        "date_created": "1605091620894955"
      }
    ],
    "last": "1605084165872574"
  },
  "req_id": "7b081afd-241e-11eb-a7ff-0242ac120007"
}

Add new order: /add_order

Parameter Required Description
pair_id Yes Pair on which trade will be opened
order_direction Yes Trade direction: buy / sell
order_type Yes Order type: market / limit or stoplimit
price Yes Level at which order will be triggered
amount_1 Yes Volume of the position in currency_1
trigger_price No Price at which stoplimit order is triggerred
trigger_condition No "LTE" lower/equal OR "GTE" greater/equal

Stop limit and trigger condition explained

As of Limitlex API v.2 you have ability to open "stoplimit" order.

This type of order will be pending until condition becomes true.

When opening stoplimit order two additional parameters must be provided: trigger_price and trigger_condition.

Example:

{
  "pair_id": "ab651a43-1fc9-4163-a31b-74e5f537e82f:bfd04d06-b97c-4287-8bb0-c18f2eb19157",
  "order_direction": "sell",
  "order_type": "stoplimit", // notice order type
  "amount_1": "0.0003",
  "price": "9500",
  "trigger_condition": "GTE", // condition: when price is greater
  "trigger_price": "9490" // than this value
}
{
  "result": {
    "order_id": "5a18dda1-a469-46ce-83a3-7ee591e38992"
  },
  "req_id": "0a0fb9a2-241d-11eb-a7ff-0242ac120007"
}

Cancel limit order: /cancel_order

Parameter Required Description
pair_id Yes Pair on which order was created
order_id Yes ID of the order to close
{
  "result": {
    "success": true
  },
  "req_id": "ab135c32-241f-11eb-a7ff-0242ac120007"
}

Cancel all limit orders: /cancel_all_orders

Parameter Required Description
pair_id Yes ID of pair on which orders were created
direction No Filter orders to cancel by direction buy / sell / both (default)
{
  "result": {
    "success": true
  },
  "req_id": "fa3c7402-241f-11eb-a7ff-0242ac120007"
}

Check status of pending limit order: /order_status

Parameter Required Description
pair_id Yes Pair on which order was created
order_id Yes UUID of the order to check
{
  "result": {
    "currency_id_1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
    "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
    "order_id": "cdb244ae-9a8a-4bd5-aa5a-3004916b3163",
    "order_type": "limit",
    "price": "9500.00",
    "order_direction": "sell",
    "amount_1_completed": "0.00000000",
    "amount_1_initial": "0.00500000",
    "amount_2_completed": "0",
    "date_cancelled": null,
    "date_completed": null,
    "date_created": "1605100800197223"
  },
  "req_id": "9dd69e73-2420-11eb-a7ff-0242ac120007"
}

Withdrawal: /withdrawal

Parameter Required Description
currency_id Yes Currency being withdrawn
amount Yes Amount of money in selected currency
key Yes Withdrawal key, that can be set up in Account > Deposit / Withdrawal
{
  "result": {
    "transaction_id": "f1bc955de1b8cb7f33c62e44dfcf0c0e"
  },
  "req_id": "9dd69e73-2420-11eb-a7ff-0242ac120007"
}

Fetch deposit addresses of specific wallet: /deposit_addresses

Parameter Required Description
currency_id Yes Currency being withdrawn
{
  "result": {
    "data": [
      {
        "address": "bitcoincash:qqvsh3073uep5k8a9tqwa779w9lj6gw5eu7v37qy4h"
      }
    ]
  },
  "req_id": "d037c926-24bc-11eb-ba6f-0242ac120007"
}

Ledger - track changes of wallet balance: /ledger

Parameter Required Description
currency_id Yes Currency being withdrawn
start No Unix timestamp in microseconds, select entries that are newer
end No Unix timestamp in microseconds, select entries that are older
limit No Currency being withdrawn
{
  "result": {
    "data": [
      {
        "type": "trade",
        "order_direction": "buy",
        "date_created": "1605091626394705",
        "amount": "-17.32723",
        "amount_currency_id": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "value": "0.00214010",
        "value_currency_id": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
        "price": "8096.46",
        "price_currency_id": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "fee": "0.00000214",
        "fee_currency_id": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
        "balance_before": "590.04413",
        "balance_after": "572.71690",
        "balance_currency_id": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "order_id": "c8ea785f-08fa-4e55-a914-19103edada45",
        "referee_user_id": null
      }
    ],
    "last": "1605084165872574"
  },
  "req_id": "da606514-2427-11eb-ba6f-0242ac120007"
}

List wallet blockchain operations (deposits|withdrawals): /blockchain_transactions

Parameter Required Description
currency_id Yes Currency being withdrawn
start No Unix timestamp in microseconds, select entries that are newer
end No Unix timestamp in microseconds, select entries that are older
limit No Currency being withdrawn
{
  "result": {
    "data": [
      {
        "id": "6b4d5121-970d-46c0-9062-06b9e08418dd",
        "type": "withdrawal",
        "address": "LT67 3910 0200 0000 0297",
        "amount": "195.00000",
        "currency_id": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "status": "waiting for your email confirmation...",
        "transaction_id": null,
        "fee_amount": "5",
        "fee_currency_id": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
        "date_created": "1605179763000000",
        "date_confirmed": null,
        "date_canceled": null,
        "date_scheduled": null
      }
    ],
    "last": "1605179757000000"
  },
  "req_id": "b090e42a-24f5-11eb-a375-0242ac130017"
}

Get websocket token for Websocket API: /websocket_token

This method does not accept any parameters.

Generated JWT token can be used on Websocket Exchange API if you want to track your trading activities: get notified when you open an order or execute a trade.

Use it as a ’t’ querystring parameter when connecting to the Websocket Exchange API. Example:

wss://limitlex.com/websocket/?c1=ab651a43-1fc9-4163-a31b-74e5f537e82f&c2=bfd04d06-b97c-4287-8bb0-c18f2eb19157&t=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxOGRhYWI0ZS01MWVhLTQ2YjEtYmFjMC1jY2ZhNTgzYTAzNjQiLCJleHAiOjE2MDE3OTIyOTR9.vUHXI4lK9z2vTdwpyQ2Oh_49reovT0pzRS95KlRbC7o

{
  "result": {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDUxNjk4NDksInN1YiI6ImM0YTYxNjExLTcwZWQtNDkzYS04MzRjLTM5NDBhNzAzZmE3ZSJ9.8D3qmPaKOdTrgnEY2-DiTX1doRry5roh-CiwWBZ7dfk"
  },
  "req_id": "2d2bc93f-24bd-11eb-ba6f-0242ac120007"
}

Signing requests example in Node.js

This simple example shows how you can make private API queries in Node.js

// Store your credentials in environment variables
const { API_KEY, API_SECRET } = process.env;

async function test() {
  const endpoint = '/private/trades';

  // Parameters we are going to send
  const params = {
    nonce: Date.now().toString(),
    pair_id: 'ab651a43-1fc9-4163-a31b-74e5f537e82f:bfd04d06-b97c-4287-8bb0-c18f2eb19157',
  };

  // Here we are encoding params to application/x-www-form-urlencoded format
  // Using built-in URLSearchParams class
  const urlEncodedParams = new URLSearchParams(params).toString();

  // We concatenate api function with params string in order to create signature
  const messageToSign = endpoint + urlEncodedParams;

  // Use built-in module 'crypto' to create ECDSA signature with SHA512
  const signature = crypto.sign('sha512', Buffer.from(messageToSign), API_SECRET);

  // Node-fetch http client is used to send HTTP request
  const response = await fetch('https://limitlex.com/api' + endpoint, {
    method: 'POST',
    headers: {
      'API-Key': API_KEY, // Your public api-key
      'API-Sign': signature.toString('base64'), // Signature in base-64 format
    },
    body: urlEncodedParams, // Parameters in body of the request
  });

  // Done!
  const json = await response.json();
  console.log(json.result);
}

BIDS

The bid price is the highest price that a particular buyer is willing to pay for a specific product or service. In the context of financial/crypto markets, it is the value buyers offer for an asset, such as a commodity, security or cryptocurrency.

Read more

ASKS

The asking price is the minimum price that an individual would be willing to sell their asset, or the minimum amount that they want to receive in return for the unit(s) they are parting with.

Read more

MY OPEN ORDERS

Here you can see all of your open orders. To cancel an open order, just click the ‘X’ symbol next to it.

Read more

LIMIT ORDER

Limit order gives you the power to set a specific price at which you would like to buy or sell the desired amount of cryptocurrency.

Read more

MARKET ORDER

A market order is an order type that enables you to buy or sell at the best available market price.

Read more

STOP LOSS LIMIT

A Stop Loss Limit order is designed to limit your loss on a cryptocurrency position. A Stop Loss Limit order can be placed to buy or sell a specific cryptocurrency at your entered price (a limit order) once that cryptocurrency reaches a certain price.

Read more

TAKE PROFIT LIMIT

A take profit limit order is an order put in place by traders to maximize their profits and protect their profits on positions. A take profit limit order allows you (a trader) to set your custom made Buy or Sell order. You have to set two prices - the Trigger Price and the buy/sell Price.

Read more