LCX Exchange API Documentation (1.1.0)

LCX Customer Support: [email protected] Terms of Service

Introduction

LCX, the Liechtenstein Cryptoassets Exchange, is a financial technology company that is pioneering blockchain infrastructure with a regulated approach. LCX API documentation consists of three parts: table of contents for easy browsing (left), explanation of each API interface (middle), and example code (right).

The structure of LCX API is:

  • Unauthenticated API: return public information about markets and trades on LCX. Make calls to these endpoints without your API key and secret.

  • Authenticated API: these private API enable account-specific interactions, such as placing and managing orders, viewing your account history or withdrawing assets. For these calls to succeed you must create your API key and secret and make Authenticated calls.

  • Unauthenticated Websocket: subscribe to these channels and retrieve the latest information about market data in your Websocket callback.

  • Authenticated Websocket: private websocket subscription to retrieve the latest information about your trades and your account in your Websocket callback.

Access LCX API using REST or Websocket.

The Base URLs are:

API Base URL: https://exchange-api.lcx.com/

Websocket Base URL: wss://exchange-api.lcx.com/

LCX is hosted in the EU central (Frankfurt - Germany) and Liechtenstein region.

API Version

The current API version is 1.1.0 . Please include the following header in the request to get the correct API behaviors.

Header Value
API-VERSION 1.1.0

For those who are familiar with or prefer to reference the earlier version of our API, you can still access the previous documentation. This earlier version might be useful if you’re maintaining legacy systems or need information that was specific to that version. Please note that while we strive to keep the previous documentation updated, the most current features, updates, and support will be found in the latest version.

Access Previous Version Documentation: LCX Exchange API v1 Documentation

Rate Limiting

Rate limiting restricts the number of requests made per IP address within a specific timeframe.

  • Market API, the maximum allowable rate is 25 requests per second per IP..
  • Trading API & Account API have a limit of 5 requests per second per IP and a maximum of 90 requests per minute per IP.

Warning: Requests that exceed these limits will return with a 429 status code.

Authentication

Snippet for generating signature(x-access-sign)

const CryptoJS = require('crypto-js')
const axios = require('axios')
let base_url = 'https://exchange-api.lcx.com'
let end_point = '/api/create'
let method = 'POST'
let api = 'ADD YOUR LCX EXCHANGE API KEY'
let secret = 'ADD YOUR LCX EXCHANGE SECRET KEY'
const EXAMPLE_PAYLOAD = {
  OrderType: 'LIMIT',
  Pair: 'LCX/ETH',
  Side: 'BUY',
  Price: 0.03033486,
  Amount: 500,
}
// If No Payload, then it is important to pass empty object in EXAMPLE_PAYLOAD, ie. {}

let requestString = method + end_point + JSON.stringify(EXAMPLE_PAYLOAD)
let hash = CryptoJS.HmacSHA256(requestString, secret)
let signature = CryptoJS.enc.Base64.stringify(hash)
let headers = {
  'x-access-key': api,
  'x-access-sign': signature,
  'x-access-timestamp': Date.now(),
}
let url = base_url + end_point
axios
  .post(url, JSON.stringify(EXAMPLE_PAYLOAD), { headers: headers })
  .then((result) => {
    console.log(result)
    // ... result
  })
  .catch((error) => {
    console.log(error)
    // ... error
  })

To use LCX Trading APIs, users are required to first gain authentication. LCX uses API keys to allow access to the API. You can register a new LCX API key at LCX Exchange.

LCX Exchange expects the API Secret key, signature and timestamp in milliseconds to be included as headers in all API requests to the server, which looks like the following:

  • x-access-timestamp - Current timestamp in milliseconds
  • x-access-key - Your LCX Exchange API Key
  • x-access-sign - Signature signed by your LCX Exchange Secret Key

Market API

Order book

This endpoint returns the complete order book for a specified market.

query Parameters
pair
required
string

Name of the pair

Responses

Request samples

var axios = require("axios");
var params = { pair: "LCX/ETH" };

var config = {
  method: "get",
  url: "https://exchange-api.lcx.com/api/book",
  headers: {
    "Content-Type": "application/json",
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Successfully API response",
  • "status": "success"
}

Kline (Candles)

This endpoint provides OHLV (Open, High, Low, Close, and Volume) data for the specified market. It displays candles for the given market within a specified timeframe, from a starting timestamp to an ending timestamp (both in seconds)

query Parameters
pair
required
string

Name of the pair

resolution
required
string
Enum: "1" "3" "5" "15" "30" "45" "60" "120" "180" "240" "1D" "1W" "1M"

Timeframe

from
required
integer <int64>

From time in UTC timestamp in seconds

to
required
integer <int64>

To time in UTC timestamp in seconds

Responses

Request samples

var axios = require("axios");
var params = {
  pair: "ETH/BTC",
  resolution: "60",
  from: 1608129416,
  to: 1608229416,
};

var config = {
  method: "get",
  url: "https://api-kline.lcx.com/v1/market/kline",
  headers: {
    "Content-Type": "application/json",
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "count": 3,
  • "data": [
    ],
  • "message": "Successfully Api response",
  • "status": "success"
}

Trades

This endpoint enables retrieval of past public trades, providing details such as price, size, and time for each trade.

query Parameters
pair
required
string
Example: pair=LCX/USDC

Name of the pair

offset
required
integer
Example: offset=1

Page index, first page = 1, fixed page size = 100

Responses

Request samples

var axios = require("axios");
var params = { offset: 1, pair: "ETH/BTC" };

var config = {
  method: "get",
  url: "https://exchange-api.lcx.com/api/trades",
  headers: {
    "Content-Type": "application/json",
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "message": "Successfully Api response",
  • "status": "success"
}

Pairs

This endpoint provides access to details of all trading pairs available on the exchange platform.

Responses

Request samples

var axios = require('axios')

var config = {
  method: 'get',
  url: 'https://exchange-api.lcx.com/api/pairs',
  headers: {
    'Content-Type': 'application/json',
  },
}

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "message": "Successfully API Response",
  • "status": "success"
}

Pair

This endpoint allows retrieval of details for a given trading pair available on the exchange platform.

query Parameters
pair
required
string
Example: pair=LCX/USDC

Name of the pair

Responses

Request samples

var axios = require("axios");
var params = { pair: "ETH/BTC" };

var config = {
  method: "get",
  url: "https://exchange-api.lcx.com/api/pair",
  params,
  headers: {
    "Content-Type": "application/json",
  },
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Successfully API Response",
  • "status": "success"
}

Tickers

This endpoint enables access to a comprehensive market overview, displaying current best bid and ask prices, the latest traded price, daily volume information, and details on the previous day’s price movement. It efficiently retrieves multiple tickers with a single query, providing a holistic view of market data.

Responses

Request samples

var axios = require('axios')

var config = {
  method: 'get',
  url: 'https://exchange-api.lcx.com/api/tickers',
  headers: {
    'Content-Type': 'application/json',
  },
}

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Tickers fetched successfully",
  • "status": "success"
}

Ticker

This endpoint enables a comprehensive market overview for a specified pair, showcasing current best bid and ask prices, the latest traded price, daily volume details, and the previous day’s price movement.

query Parameters
pair
required
string
Example: pair=LCX/USDC

Name of the pair

Responses

Request samples

var axios = require("axios");
var params = { pair: "ETH/BTC" };

var config = {
  method: "post",
  url: "https://exchange-api.lcx.com/api/ticker",
  headers: {
    "Content-Type": "application/json",
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Tickers fetched successfully",
  • "status": "success"
}

Trading API

New order

The Create an Order endpoint enables you to create buy/sell orders on limit/market on LCX Exchange.

Authorizations:
(API KeySignatureTimestamp)
Request Body schema: application/json
required
Pair
string

Name of the Pair

Amount
required
float

Specifies the amount of the base asset that will be bought/sold.

Price
float

Only for limit orders: Specifies the amount in quote currency that is paid/received for each unit of base currency.

OrderType
required
string
Enum: "LIMIT" "MARKET"

For limit orders, amount and price are required. For market orders, either amount is required.

Side
required
string
Enum: "SELL" "BUY"

When placing a buy order the base currency will be bought for the quote currency. When placing a sell order the base currency will be sold for the quote currency

Responses

Request samples

Content type
application/json
{
  • "Pair": "LCX/ETH",
  • "Amount": 100,
  • "Price": 0.004,
  • "OrderType": "MARKET",
  • "Side": "SELL"
}

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Order created successfully",
  • "status": "success"
}

Update order

This endpoint facilitates updates for any limit buy/sell orders.

Authorizations:
(API KeySignatureTimestamp)
Request Body schema: application/json
required
OrderId
required
string

Specify only open order ID for updates. Partial orders cannot be modified.

Amount
float

Updates amount to this value.

Price
float

Specifies the amount in quote currency that is paid/received for each unit of base currency.

Responses

Request samples

Content type
application/json
{
  • "OrderId": "9f898d18-0980-4fb3-b18c-eeb39fc20324",
  • "Amount": 100,
  • "Price": 0.004
}

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Order updated successfully",
  • "status": "success"
}

Cancel order

This endpoint enables the cancellation of exchange orders using their corresponding Order Id.

Authorizations:
(API KeySignatureTimestamp)
query Parameters
orderId
required
string

String specifying which order should be updated

Responses

Request samples

var axios = require("axios");
var params = { orderId: "e8737c4a-3804-461c-9e67-4fe0af5aeb06" };

var config = {
  method: "delete",
  url: "https://exchange-api.lcx.com/api/cancel",
  headers: {
    // auth headers
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Order removed successfully",
  • "status": "success"
}

Cancel All orders

Cancel a list of orders by order Ids

Authorizations:
(API KeySignatureTimestamp)
query Parameters
orderIds
required
Array of strings
Example: orderIds=70aba300-0990-481d-ad76-7bd499f473ab&orderIds=ecaf000a-8f4c-459a-b105-784c0e0436df

List of order ids. Maximum of 25 orders can be deleted at once.

Responses

Request samples

var axios = require("axios");
var params = {
  orderIds: [
    "70aba300-0990-481d-ad76-7bd499f473ab",
    "ecaf000a-8f4c-459a-b105-784c0e0436df",
  ],
};

const transformRequestOptions = (params) => {
  let options = "";
  for (const key in params) {
    if (typeof params[key] !== "object" && params[key]) {
      options += `${key}=${params[key]}&`;
    } else if (
      typeof params[key] === "object" &&
      params[key] &&
      params[key].length
    ) {
      params[key].forEach((el) => {
        options += `${key}=${el}&`;
      });
    }
  }
  return options ? options.slice(0, -1) : options;
};

var config = {
  method: "delete",
  url: "https://exchange-api.lcx.com/order/cancel-all",
  headers: {
    // auth headers
  },
  params,
  paramsSerializer: (params) => transformRequestOptions(params),
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "message": "2 orders cancelled successfully",
  • "status": "success"
}

Open orders

This endpoint grants access to all pending orders that are ready for execution.

Authorizations:
(API KeySignatureTimestamp)
query Parameters
pair
required
string
Example: pair=LCX/USDC

Name of the pair

offset
integer
Example: offset=1

Page index, first page = 1, fixed page size = 100

fromDate
integer
Example: fromDate=1689193800

Integer specifying from (i.e. showing those later in time) which time all orders should be returned. Should be a timestamp in milliseconds since 1 Jan 1970.

toDate
integer
Example: toDate=1689193800

Integer specifying up to (i.e. showing those earlier in time) which time all orders should be returned. Should be a timestamp in milliseconds since 1 Jan 1970.

Responses

Request samples

var axios = require("axios");
var params = { pair: "ETH/BTC", offset: 1 };

var config = {
  method: "get",
  url: "https://exchange-api.lcx.com/api/open",
  headers: {
    // auth headers
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "message": "Orders fetched successfully",
  • "status": "success",
  • "totalCount": 7
}

Order

This endpoint empowers users to retrieve detailed information for a specific order.

Authorizations:
(API KeySignatureTimestamp)
query Parameters
orderId
required
string

String specifying which order should be fetched.

Responses

Request samples

var axios = require("axios");
var params = { orderId: "e8737c4a-3804-461c-9e67-4fe0af5aeb06" };

var config = {
  method: "get",
  url: "https://exchange-api.lcx.com/api/order",
  headers: {
    // auth headers
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Order fetched successfully",
  • "status": "success"
}

Orders

This endpoint allows users to review previously closed or cancelled orders.

Authorizations:
(API KeySignatureTimestamp)
query Parameters
pair
string
Example: pair=LCX/USDC

Name of the pair

offset
integer
Example: offset=1

Page index, first page = 1, fixed page size = 100

fromDate
integer
Example: fromDate=1689193800

Integer specifying from (i.e. showing those later in time) which time all orders should be returned. Should be a timestamp in milliseconds since 1 Jan 1970.

toDate
integer
Example: toDate=1689193800

Integer specifying up to (i.e. showing those earlier in time) which time all orders should be returned. Should be a timestamp in milliseconds since 1 Jan 1970.

side
string
Enum: "BUY" "SELL"

When placing a buy order the base currency will be bought for the quote currency. The base currency will be sold for the quote currency when placing a sell order.

orderStatus
string
Enum: "CANCEL" "CLOSED"
orderType
string
Enum: "LIMIT" "MARKET"

Responses

Request samples

var axios = require("axios");
var params = { pair: "ETH/BTC", offset: 1 };

var config = {
  method: "get",
  url: "https://exchange-api.lcx.com/api/orderHistory",
  headers: {
    // auth headers
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "message": "Orders fetched successfully",
  • "status": "success",
  • "totalCount": 2307049
}

Trades

This endpoint provides a comprehensive view of all executed orders.

Authorizations:
(API KeySignatureTimestamp)
query Parameters
pair
string
Example: pair=LCX/USDC

Name of the pair

offset
integer
Example: offset=1

Page index, first page = 1, fixed page size = 100

fromDate
integer
Example: fromDate=1689193800

Integer specifying from (i.e. showing those later in time) which time all orders should be returned. Should be a timestamp in milliseconds since 1 Jan 1970.

toDate
integer
Example: toDate=1689193800

Integer specifying up to (i.e. showing those earlier in time) which time all orders should be returned. Should be a timestamp in milliseconds since 1 Jan 1970.

Responses

Request samples

var axios = require("axios");
var params = { pair: "ETH/BTC", offset: 1 };

var config = {
  method: "get",
  url: "https://exchange-api.lcx.com/api/uHistory",
  headers: {
    // auth headers
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "message": "Successfully Api response",
  • "status": "success",
  • "totalCount": 1
}

Account API

Balances

This endpoint retrieves balances for all listed coins.

Authorizations:
(API KeySignatureTimestamp)

Responses

Request samples

var axios = require('axios')

var config = {
  method: 'get',
  url: 'https://exchange-api.lcx.com/api/balances',
  headers: {
    // auth headers
  },
}

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "message": "Wallets fetched successfully",
  • "status": "success",
  • "totalBalance": {
    }
}

Balance

This endpoint retrieves the balance specifically for a listed coin.

Authorizations:
(API KeySignatureTimestamp)
query Parameters
Coin
required
string
Example: Coin=LCX

Returns the balance of specific asset in exchange balance.

Responses

Request samples

var axios = require("axios");
var params = { coin: "ETH" };

var config = {
  method: "get",
  url: "https://exchange-api.lcx.com/api/balance",
  headers: {
    // auth headers
  },
  params,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Response samples

Content type
application/json
{
  • "data": {
    },
  • "message": "Successfully Api response",
  • "status": "success"
}

Market Websocket

Subscribe ticker

The ticker websocket makes available a high level overview of the current market status of a specified pair. It exhibits the current best bid and ask, the last traded price, along with information on the daily volume and price movement over the last day. Also give realtime updates of ticker data.

Request Body schema: application/json
required
Topic
string
Enum: "subscribe" "unsubscribe"
Type
string
Value: "ticker"

ticker

Responses

Request samples

Content type
application/json
{
  • "Topic": "subscribe",
  • "Type": "ticker"
}

Response samples

Content type
application/json
{
  • "type": "object",
  • "properties": {
    }
}

Subscribe orderbook

The Orderbook websocket gives you all the bids and asks of the given pair at LCX Exchange. Also gives realtime updates of orderbook.

Request Body schema: application/json
required
Topic
string
Enum: "subscribe" "unsubscribe"
Type
string
Value: "orderbook"

orderbook

Responses

Request samples

Content type
application/json
{
  • "Topic": "subscribe",
  • "Type": "orderbook"
}

Response samples

Content type
application/json
{
  • "type": "orderbook",
  • "topic": "snapshot",
  • "pair": "LCX/USDC",
  • "data": {
    }
}

Subscribe trade

The trade websocket is used whenever a trade occurs at LCX Exchange. It is inclusive of all the crucial details of the trade, like the price, size and the time of execution. Also gives realtime updates of trades.

Request Body schema: application/json
required
Topic
string
Enum: "subscribe" "unsubscribe"
Type
string
Value: "trade"

Responses

Request samples

Content type
application/json
{
  • "Topic": "subscribe",
  • "Type": "trade"
}

Response samples

Content type
application/json
{
  • "type": "trade",
  • "topic": "snapshot",
  • "pair": "ETH/BTC",
  • "data": [
    ]
}

Trading Websocket

Subscribe wallets

Wallet websocket enables you to receive wallet updates and snapshots regarding any activity on your account.

query Parameters
x-access-key
string

Your LCX Exchange API Key

x-access-sign
string

Signature signed by your LCX Exchange Secret Key

x-access-timestamp
string

Current timestamp in milliseconds

Request Body schema: application/json
required
Topic
string
Enum: "subscribe" "unsubscribe"
Type
string
Value: "user_wallets"

Responses

Request samples

Content type
application/json
{
  • "Topic": "subscribe",
  • "Type": "user_wallets"
}

Response samples

Content type
application/json
{
  • "userid": "3321eb49-6228-4574-912f-af5aecd3e2f7",
  • "type": "user_wallets",
  • "topic": "update",
  • "data": {
    }
}

Subscribe orders

Order websocket enables you to receive order updates regarding any order related activity in your account.

query Parameters
x-access-key
string

Your LCX Exchange API Key

x-access-sign
string

Signature signed by your LCX Exchange Secret Key

x-access-timestamp
string

Current timestamp in milliseconds

Request Body schema: application/json
required
Topic
string
Enum: "subscribe" "unsubscribe"
Type
string
Value: "user_orders"

Responses

Request samples

Content type
application/json
{
  • "Topic": "subscribe",
  • "Type": "user_orders"
}

Response samples

Content type
application/json
{
  • "userid": "3321eb49-6228-4574-912f-af5aecd3e2f7",
  • "type": "user_orders",
  • "topic": "update",
  • "data": {
    }
}

Subscribe trades

Trades websocket enables you to receive trade updates regarding any trade related activity in your account.

query Parameters
x-access-key
string

Your LCX Exchange API Key

x-access-sign
string

Signature signed by your LCX Exchange Secret Key

x-access-timestamp
string

Current timestamp in milliseconds

Request Body schema: application/json
required
Topic
string
Enum: "subscribe" "unsubscribe"
Type
string
Value: "user_trades"

Responses

Request samples

Content type
application/json
{
  • "Topic": "subscribe",
  • "Type": "user_trades"
}

Response samples

Content type
application/json
{
  • "topic": "update",
  • "type": "user_trades",
  • "data": {
    }
}

Errors

Message Errors

These appear when there is an error in the code used. When this happens, an error message will be sent including the error code indicating the exact error to the user.

Release Notes

  • Version 1.1.0
    We are excited to announce the release of version 1.1.0 of the LCX API. This new version includes a range of new endpoints that enhance functionality and provide our users with more detailed and robust data access. Below is a summary of the newly added APIs:

    Get Tickers: Retrieve a list of tickers.
    Method: GET
    URL: {baseUrl}/api/tickers

    Get Ticker: Obtain information about a specific ticker.
    Method: GET
    URL: {baseUrl}/api/ticker

    Get OrderBook: Access the order book for a specific trading pair.
    Method: GET
    URL: {baseUrl}/api/book

    Get Pairs: List all available trading pairs.
    Method: GET
    URL: {baseUrl}/api/pairs

    Get Pair: Get information about a specific trading pair.
    Method: GET
    URL: {baseUrl}/api/pair

    Cancel Order: Cancel an existing order.
    Method: DELETE
    URL: {baseUrl}/api/cancel

    Modify Order: Modify an existing order.
    Method: PUT
    URL: {baseUrl}/api/modify

    Get Order: Retrieve information about a specific order.
    Method: GET
    URL: {baseUrl}/api/order

    Get User Trade History: Access the trade history of a user.
    Method: GET
    URL: {baseUrl}/api/uHistory

    Get Recent Trade: Obtain recent trade information.
    Method: GET
    URL: {baseUrl}/api/trades

    Get Order History: Retrieve a user's order history.
    Method: GET
    URL: {baseUrl}/api/orderHistory

    Get Open Order: List all open orders for a user.
    Method: GET
    URL: {baseUrl}/api/Open

    Get Balance: Check the balance of a user.
    Method: GET
    URL: {baseUrl}/api/balance