× #message#
×

Warning

Exchange API Documentation

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

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

You have to send HTTP POST parameters using application/x-www-form-urlencoded format.
More about POST requests here.

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

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

Private API calls 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, and you don't even need to use any API keys.

This is the list of public API calls:

  • /currencies
  • /pairs
  • /ticker
  • /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 call, you need the following:

  1. API key identifier in the 'API-Key' header.
  2. Nonce in the body of the request.
  3. Signature of the request stored in 'API-Sign' header.

Nonce is a constantly increasing unsigned number, that must be appended to the body of each request.
It is impossible to reset the nonce to a lower value, therefore make sure to use a nonce generation method that generates ever-increasing numbers.

You also need to provide the signature, so we can trust that your request has not been modified without your authorization.

The signature must follow ASN.1 format. The algorithm we use is ECDSA (Elliptic Curve Digital Signature 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.

A HTTP request should be structured as follows:

HTTP HEADERS:
API-Key: (PUBLIC KEY YOU GENERATED IN PROFILE)
API-Sign: ECDSA_SIGN(API_FUNCTION + BODY_PARAMS_URL_ENCODED)

REQUEST BODY:
nonce=NONCE¶m1=PARAM1¶m2=PARAM2

List of private calls:

  • /balance
  • /open_orders
  • /trades
  • /add_order
  • /cancel_order
  • /cancel_all_orders
  • /order_status
  • /withdrawal

Public methods reference

Get list of currencies: /currencies

This method does not accept any parameters.

{
  "result": {
    "38feff21-c28e-49ff-8616-e112e21f609f": {
      "id": "38feff21-c28e-49ff-8616-e112e21f609f",
      "deposit_locked": false,
      "withdrawal_locked": false,
      "decimals": 8,
      "fiat": false,
      "name": "Bitcoin SV",
      "symbol": "BSV",
      "withdrawal_fee": "0.001",
      "withdrawal_minimum": "0.002",
      "unified_cryptoasset_id": 3602
    },
    "44567e46-d10c-4b99-bc82-4e2faca15234": {
      "id": "44567e46-d10c-4b99-bc82-4e2faca15234",
      "deposit_locked": false,
      "withdrawal_locked": false,
      "decimals": 8,
      "fiat": false,
      "name": "Etherium",
      "symbol": "ETH",
      "withdrawal_fee": "0.003",
      "withdrawal_minimum": "0.02",
      "unified_cryptoasset_id": 1027
    }
  }
}

Get list of exchange pairs: /pairs

Parameter Required Description
pair No Specify exact pair
{
  "result": {
    "6ce9d80a-f5db-4efb-9075-990cd431555d:76d845ac-1e6a-4a1b-995b-762370e8c1cd": {
      "currency_id_1": "6ce9d80a-f5db-4efb-9075-990cd431555d",
      "currency_id_2": "76d845ac-1e6a-4a1b-995b-762370e8c1cd",
      "locked": false,
      "decimals": 4,
      "min_amount_1": "0.01",
      "min_amount_2": "10"
    },
    "87aa796d-7a7b-447b-8eb9-297daa793ff2:bfd04d06-b97c-4287-8bb0-c18f2eb19157": {
      "currency_id_1": "87aa796d-7a7b-447b-8eb9-297daa793ff2",
      "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
      "locked": false,
      "decimals": 4,
      "min_amount_1": "0.01",
      "min_amount_2": "0.01"
    }
  }
}

Get tick data of the specified exchange pair: /ticker

Parameter Required Description
pair Yes Exchange pair
{
  "result": {
    "currency_id_1": "6ce9d80a-f5db-4efb-9075-990cd431555d",
    "currency_id_2": "76d845ac-1e6a-4a1b-995b-762370e8c1cd",
    "last_price": "0.3877",
    "volume_1": null,
    "volume_2": null
  }
}

Order book: /order_book

Parameter Required Description
pair Yes Exchange pair
count No Amount of orders to list
{
  "result": {
    "ab651a43-1fc9-4163-a31b-74e5f537e82f:bfd04d06-b97c-4287-8bb0-c18f2eb19157": {
      "date_created": "2020-08-31T09:18:14Z",
      "asks": [
        { "price": "9112.00", "amount_1": "0.10000000" },
        { "price": "9411.50", "amount_1": "0.04037137" },
        { "price": "9412.20", "amount_1": "0.02514524" },
        { "price": "9416.00", "amount_1": "0.05175131" }
      ],
      "bids": [
        { "price": "8054.00", "amount_1": "0.01950082" },
        { "price": "7888.00", "amount_1": "0.05698814" },
        { "price": "7883.70", "amount_1": "0.09986180" },
        { "price": "7872.10", "amount_1": "0.02974101" }
      ]
    }
  }
}

Get recent trades: /recent_trades

Parameter Required Description
pair Yes Exchange pair
since No Date (timestamp) to list trades from

Timestamp must follow UNIX specification:
The number of seconds elapsed since January 1, 1970 UTC.

{
  "result": {
    "ab651a43-1fc9-4163-a31b-74e5f537e82f:bfd04d06-b97c-4287-8bb0-c18f2eb19157": [
      {
        "trade_id": "9c10758a-8017-40fe-abb9-7cb591074806:16719913-ee08-43a1-9cfc-6ee01f1ffd37",
        "amount_1": "0.00010000",
        "amount_2": "0.94115",
        "price": "9411.50",
        "order_direction": "buy",
        "date_created": "2020-08-31T08:49:07.170847Z"
      },
      {
        "trade_id": "8412b908-66d5-4ba8-9dd2-65724ffe1639:16719913-ee08-43a1-9cfc-6ee01f1ffd37",
        "amount_1": "0.00003000",
        "amount_2": "0.28233",
        "price": "9411.50",
        "order_direction": "sell",
        "date_created": "2020-08-31T08:48:42.103097Z"
      }
    ]
  }
}

Private methods reference

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

Check balance: /balance

This method does not accept any parameters.

{
  "result": {
    "ab651a43-1fc9-4163-a31b-74e5f537e82f": {
      "amount_available": "0.20009990",
      "amount_reserved": "0.100099"
    },
    "bfd04d06-b97c-4287-8bb0-c18f2eb19157": {
      "amount_available": "7518.82483",
      "amount_reserved": "0.00000"
    }
  }
}

List user's open orders: /open_orders

Parameter Required Description
pair Yes Pair on which orders are opened
{
  "result": {
    "ab651a43-1fc9-4163-a31b-74e5f537e82f:bfd04d06-b97c-4287-8bb0-c18f2eb19157": {
      "buy": [
        {
          "price": "8200.00",
          "id": "0b127fc3-ef1f-4c56-b227-0d8dd62fa287",
          "amount_initial": "0.00010000",
          "amount_open": "0.00010000",
          "date_created": "2020-08-25T15:18:19.917917Z"
        }
      ],
      "sell": []
    }
  }
}

List user's trades: /trades

Parameter Required Description
pair Yes Pair on which trades were made
type No Filter trades by type (buy or sell)
start No Filter trades starting from this date (timestamp)
end No Filter trades that were made before this date (timestamp)

Timestamp must follow UNIX specification:
The number of seconds elapsed since January 1, 1970 UTC.

{
  "result": [
    {
      "currency_id_1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
      "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
      "order_id": "4cc0089e-3c91-46b7-8932-98d2d32fa3a3",
      "order_id_taker": "4cc0089e-3c91-46b7-8932-98d2d32fa3a3",
      "order_id_maker": "2e14b7cf-3921-4c9c-a37f-88fa53babda1",
      "amount_1": "0.01173364",
      "price": "8165.60",
      "order_direction": "sell",
      "date_created": "2020-08-25T08:51:23.764114Z"
    },
    {
      "currency_id_1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
      "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
      "order_id": "4cc0089e-3c91-46b7-8932-98d2d32fa3a3",
      "order_id_taker": "4cc0089e-3c91-46b7-8932-98d2d32fa3a3",
      "order_id_maker": "8cd1a0a3-319c-400f-a1ce-9b813c49fa3d",
      "amount_1": "0.03988794",
      "price": "8166.50",
      "order_direction": "buy",
      "date_created": "2020-08-25T08:51:23.763862Z"
    }
  ]
}

Add new order: /add_order

Parameter Required Description
pair Yes Pair on which trade will be opened
order_direction Yes Trade direction: buy / sell
order_type Yes Order type: market / limit
amount_1 Yes Volume of the position
price Yes Level at which order will be triggered
{
  "result": {
    "order_id": "09a77b6a-e084-4b90-a94e-1f6205ec7199"
  }
}

Cancel pending order: /cancel_order

Parameter Required Description
pair Yes Pair on which order was created
order_id Yes ID of the order to close
{
  "result": {
    "success": true
  }
}

Cancel all pending orders: /cancel_all_orders

Parameter Required Description
pair Yes Pair on which orders were created
direction No Filter orders to cancel by direction buy / sell / both (default)
{
  "result": {
    "success": true
  }
}

Check order: /order_status

Parameter Required Description
pair Yes Pair on which order was created
order_id Yes ID of the order to check
{
  "result": {
    "currency_id_1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
    "currency_id_2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
    "order_id": "c434a9cc-bf6e-48b4-b596-ee87c84efca4",
    "price": "7997.00",
    "order_direction": "buy",
    "amount_completed": "0.10000000",
    "amount_initial": "0.10000000",
    "amount_2_completed": "814.32360",
    "date_cancelled": null,
    "date_completed": "2020-08-25T11:24:00.135836Z",
    "date_created": "2020-08-25T11:24:00.129493Z"
  }
}

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"
  }
}

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.eyJleHAiOjE1OTkyMDE2NzUsInN1YiI6IjE4ZGFhYjRlLTUxZWEtNDZiMS1iYWMwLWNjZmE1ODNhMDM2NCJ9.oLFtkOGAvbcettI7v_0lYLw-fX8wek81v_mEpaJ5jnM"
  }
}

Exchange Websocket Documentation

The Websocket interface can be used to track trading activities that take place on Limitlex Exchange platform (price movements, changes in the order book, new executed trades, etc.).

Note: Only wss:// protocol is available; we do not support unsecured Websocket connections.
The wss:// protocol is not only encrypted, but also more reliable.

Connection

You need to connect to the Websocket service using URL:

wss://limitlex.com/websocket/?c1=CURRENCY_1&c2=CURRENCY_2

Query parameters 'c1' and 'c2' are used to specify the exact pair you want to track.
For example, BTC/EUR URL:

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

Messages

When the connection is established, you will start receiving messages.
Each message is structured in JSON format.

The structure of a message is as follows:

  • "t" parameter tells you the type of the event
  • the rest of the parameters in the message is the data associated with this type of message.

Tick data of the exchange pair: "change_ohlc" message:

{
  "t": "change_ohlc",
  "currencyId1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
  "currencyId2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
  "durationInDays": 1,
  "priceLow": "7014.80",
  "priceHigh": "8300.00",
  "priceOpen": "8300.00",
  "priceClose": "7997.40",
  "priceChange": "-302.60",
  "priceChangeP": "-3.64",
  "volume": "92.25116900"
}

Best Bid/Ask prices: "best_bid_ask" message:

{
  "t": "best_bid_ask",
  "currencyId1": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
  "currencyId2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
  "bid": "7014.80",
  "ask": "7997.40"
}

Order book volume has changed: "order_book" message:

{
  "t": "order_book",
  "orderDirection": "Sell",
  "amount": "0.05341906",
  "price": "7997.40"
}

A new trade took place: "last_trade" message:

{
  "t": "last_trade",
  "orderDirection": "Buy",
  "amount": "0.00010000",
  "price": "7997.40",
  "createdAt": 1598516157
}

Initial order book data: "whole_order_book" message:

{
  "t": "whole_order_book",
  "currencyId1": "87aa796d-7a7b-447b-8eb9-297daa793ff2",
  "currencyId2": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
  "bids": [
    { "price": "228.0960", "amount": "1.04426203", "total": "238.19199" }
  ],
  "asks": [
    { "price": "333.0000", "amount": "0.83783784", "total": "279.00000" }
  ]
}

User-specific messages

In order to also track user-specific messages you have to provide an additional query parameter 't' to the URL.
This parameter must contain your access token that can be generated on our REST API using /websocket_token call.

If the t parameter is provided, you will receive additional messages that are specific to your user account.

The required URL structure:
wss://limitlex.com/websocket/?c1=CURRENCY_1&c2=CURRENCY_2&t=YOUR_TOKEN

Example:
wss://limitlex.com/websocket/?c1=ab651a43-1fc9-4163-a31b-74e5f537e82f&c2=bfd04d06-b97c-4287-8bb0-c18a2eb19157&t=eyJ0aXAiOiJcV1QiLCJhbGciOiJIUzI1NgJ9.eyJzdWIaOiIxOGRaYWI0ZS01MWV3LTQ2YjEtYm1jMC1jY2ZhNTgzYTbzNjQiLCJleHAiOjE2MDEhOTIyOT09.vUHXI4la9z2vTdwpcQ2Oh_49refvT0gzRS95KlRbC7o

Your order is placed: "open_order" message:

{
  "t": "open_order",
  "orderId": "0959f899-f4b4-422b-88c0-ec3fa38f8079",
  "orderTradeType": "Limit",
  "orderDirection": "Buy",
  "amountInitial": "0.00010000",
  "amountCompleted": "0",
  "price": "7997.00",
  "createdAt": 1598530122,
  "completed": false,
  "deleted": false
}

Your trade is executed: "trade" message:

{
  "t": "trade",
  "orderDirection": "Buy",
  "amount": "0.00010000",
  "price": "7997.00",
  "createdAt": 1598530122,
}

Your wallet balance has changed: "wallets" message:

{
  "t": "wallets",
  "wallets": [
    {
      "currencyId": "ab651a43-1fc9-4163-a31b-74e5f537e82f",
      "amountAvailable": "1006.80071837",
      "amountReserved": "0.00000000"
    },
    {
      "currencyId": "bfd04d06-b97c-4287-8bb0-c18f2eb19157",
      "amountAvailable": "1001670.93017",
      "amountReserved": "0.00000"
    }
  ]
}