NAV
javascript

Introduction

Welcome to the LCX Exchange API Documentation!

We offer language bindings in JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

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

API Version

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

Header Value
API-VERSION 1.0

Rate Limiting

Rate limiting is enforced to limit the number of requests made per IP per unit of time.

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 Authenticated 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:

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.

Public API

Orderbook

The Orderbook endpoint gives you all the bids and asks of the given pair at LCX Exchange.

Example Request

var axios = require('axios')
var data = JSON.stringify({ pair: 'LCX/ETH' })

var config = {
  method: 'post',
  url: 'https://exchange-api.lcx.com/order/book',
  headers: {
    'Content-Type': 'application/json',
  },
  data: data,
}

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

The api returns JSON structured like this:

{
  "data": {
    "buy": [
      [0.022, 3],
      [0.02, 0],
      [0.018, 2.1]
    ],
    "sell": []
  },
  "message": "Successfully Api response",
  "status": "success"
}

type: POST
endpoint: https://exchange-api.lcx.com/order/book

Body Parameters

Parameter Required Description
pair true The pair for which you want to get order book

Pair Candles

The Pair Candles endpoint makes available OHLV (Open, High, Close, Low and volume) data for the mentioned funding currency or trading pair. The endpoint shows the candles of a given pair between from and to timestamp (in seconds).

Example Request

var axios = require('axios')
var data =
  '{"pair":"ETH/BTC","resolution":"60","limit":100,"to":1608229416}'

var config = {
  method: 'post',
  url: 'https://api-kline.lcx.com/v2/market/kline',
  headers: {
    'Content-Type': 'application/json',
  },
  data: data,
}

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

The api returns JSON structured like this:

{
  "data": [
    {
      "close": 0.022,
      "high": 0.022,
      "low": 0.021,
      "open": 0.021,
      "pair": "ETH/BTC",
      "timeframe": "60",
      "timestamp": 1605722400000,
      "volume": 10
    },
    {
      "close": 0.022,
      "high": 0.022,
      "low": 0.02,
      "open": 0.021,
      "pair": "ETH/BTC",
      "timeframe": "60",
      "timestamp": 1605700800000,
      "volume": 20.8
    },
    {
      "close": 0.021,
      "high": 0.021,
      "low": 0.02,
      "open": 0.02,
      "pair": "ETH/BTC",
      "timeframe": "60",
      "timestamp": 1605697200000,
      "volume": 10.5
    }
  ],
  "message": "Successfully Api response",
  "status": "success"
}

type: POST
endpoint: https://api-kline.lcx.com/v2/market/kline

Body Parameters

Parameter Required Description
pair true The pair for which you want to get Candles
resolution true resolution
limit true Return number of candles. Max: 500
to true date in timestamp (seconds)

Recent Trade History

The Recent Trade History endpoint enables you to retrieve past public trades. The history provides details such as price, size, and time.

Example Request

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

var config = {
  method: 'post',
  url: 'https://exchange-api.lcx.com/trade/recent',
  headers: {
    'Content-Type': 'application/json',
  },
  data: data,
}

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

The api returns JSON structured like this:

{
  "data": [
    [0.022, 0.01, "SELL", 1605725835],
    [0.021, 0, "BUY", 1605722975],
    [0.022, 0.1, "BUY", 1605703939],
    [0.02, 1, "SELL", 1605703035],
    [0.02, 0.7, "SELL", 1605703035],
    [0.021, 1, "BUY", 1605702910],
    [0.021, 0.2, "BUY", 1605697822],
    [0.02, 0.3, "SELL", 1605697754]
  ],
  "message": "Successfully Api response",
  "status": "success"
}

type: POST
endpoint: https://exchange-api.lcx.com/trade/recent

Body Parameters

Parameter Required Description
pair true The pair for which you need trade history
offset true Page number

Get All Pair

The Get All Pair endpoint allows you to retrieve details of all the trading pairs available on the exchange platform.

Example Request

var axios = require('axios')

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

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

The api returns JSON structured like this:

{
  "data": [
    {
      "amountPrecision": 3,
      "base": "ETH",
      "maxBaseOrder": 1000,
      "maxQuoteOrder": 1000,
      "minBaseOrder": 0.001,
      "minQuoteOrder": 0.00001,
      "pricePrecision": 8,
      "quote": "BTC",
      "status": true,
      "symbol": "ETH/BTC"
    },
    {
      "amountPrecision": 4,
      "base": "LCX",
      "maxBaseOrder": 5000000,
      "maxQuoteOrder": 1000,
      "minBaseOrder": 100,
      "minQuoteOrder": 0.01,
      "pricePrecision": 8,
      "quote": "ETH",
      "status": true,
      "symbol": "LCX/ETH"
    },
    {
      "amountPrecision": 2,
      "base": "ETH",
      "maxBaseOrder": 1000,
      "maxQuoteOrder": 1000000,
      "minBaseOrder": 0.01,
      "minQuoteOrder": 0.05,
      "pricePrecision": 8,
      "quote": "USDC",
      "status": true,
      "symbol": "ETH/USDC"
    },
    {
      "amountPrecision": 4,
      "base": "BTC",
      "maxBaseOrder": 1000,
      "maxQuoteOrder": 1000000,
      "minBaseOrder": 0.0001,
      "minQuoteOrder": 0.05,
      "pricePrecision": 8,
      "quote": "USDC",
      "status": true,
      "symbol": "BTC/USDC"
    },
    {
      "amountPrecision": 3,
      "base": "LCX",
      "maxBaseOrder": 5000000,
      "maxQuoteOrder": 1000000,
      "minBaseOrder": 100,
      "minQuoteOrder": 0.05,
      "pricePrecision": 8,
      "quote": "USDC",
      "status": true,
      "symbol": "LCX/USDC"
    },
    {
      "amountPrecision": 3,
      "base": "LCX",
      "maxBaseOrder": 5000000,
      "maxQuoteOrder": 1000,
      "minBaseOrder": 10,
      "minQuoteOrder": 0.00001,
      "pricePrecision": 8,
      "quote": "BTC",
      "status": true,
      "symbol": "LCX/BTC"
    }
  ],
  "message": "Successfully Api response",
  "status": "success"
}

type: GET
endpoint: https://exchange-api.lcx.com/market/pairs

Get pair with symbol

The Get Pair with symbol endpoint allows you to retrieve the details of given trading pair available on the exchange platform.

Example Request

var axios = require('axios')
var data = '{"pair": "ETH/BTC"}'

var config = {
  method: 'post',
  url: 'https://exchange-api.lcx.com/market/pair',
  data: data,
  headers: {
    'Content-Type': 'application/json',
  },
}

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

The api returns JSON structured like this:

{
  "data": {
    "amountPrecision": 8,
    "base": "ETH",
    "maxBaseOrder": 1000,
    "maxQuoteOrder": 1000,
    "minBaseOrder": 0.01,
    "minQuoteOrder": 0.0001,
    "pricePrecision": 8,
    "quote": "BTC",
    "status": true,
    "symbol": "ETH/BTC"
  },
  "message": "Successfully Api response",
  "status": "success"
}

type: POST
endpoint: https://exchange-api.lcx.com/market/pair

Body Parameters

Parameter Required Description
pair true The pair for which you need details

Get All Tickers

The Get All Tickers endpoint allows you to view a high level overview of the market status. It exhibits the ongoing best bid and ask, the last traded price, along with the information on the daily volume and price movement that happened the previous day. The endpoint can recover multiple tickers with a single query.

Example Request

var axios = require('axios')

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

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

The api returns JSON structured like this:

{
  "data": {
    "BTC/USDC": {
      "bestAsk": 134.04686334,
      "bestBid": 128.53269266,
      "change": -1.28,
      "equivalent": 130.31363850057002,
      "high": 155.04275531,
      "last24Price": 132.99479189,
      "lastPrice": 131.289778,
      "lastUpdated": 1614004248,
      "low": 34.57453449,
      "symbol": "BTC/USDC",
      "volume": 23.8512
    },
    "ETH/BTC": {
      "bestAsk": 0.0788813,
      "bestBid": 0.07860338,
      "change": 71.61,
      "equivalent": 4437.3876901578,
      "high": 0.08216563,
      "last24Price": 0.04515737,
      "lastPrice": 0.07749301,
      "lastUpdated": 1614004641,
      "low": 0.04610567,
      "symbol": "ETH/BTC",
      "volume": 2.96
    },
    "ETH/USDC": {
      "bestAsk": 99.43198317,
      "bestBid": 95.99729073,
      "change": 43.32,
      "equivalent": 96.06772484669115,
      "high": 111.05505156,
      "last24Price": 67.53368859,
      "lastPrice": 96.78733871,
      "lastUpdated": 1614005533,
      "low": 69.44123466,
      "symbol": "ETH/USDC",
      "volume": 8.53
    },
    "LCX/BTC": {
      "bestAsk": 0.00000974,
      "bestBid": 0.00000964,
      "change": 4.56,
      "equivalent": 0.5646011508000001,
      "high": 0.00001279,
      "last24Price": 0.00000943,
      "lastPrice": 0.00000986,
      "lastUpdated": 1614005830,
      "low": 0.00000717,
      "symbol": "LCX/BTC",
      "volume": 112044.556
    },
    "LCX/ETH": {
      "bestAsk": 0.00043858,
      "bestBid": 0.000418,
      "change": 20.68,
      "equivalent": 0.7375162887000001,
      "high": 0.00062006,
      "last24Price": 0.00036216,
      "lastPrice": 0.00043707,
      "lastUpdated": 1614014252,
      "low": 0.00009879,
      "symbol": "LCX/ETH",
      "volume": 208434.9442
    },
    "LCX/USDC": {
      "bestAsk": 0.03725158,
      "bestBid": 0.03639322,
      "change": 37.72,
      "equivalent": 0.0364453589934,
      "high": 0.0382367,
      "last24Price": 0.02666073,
      "lastPrice": 0.03671836,
      "lastUpdated": 1614022352,
      "low": 0.01872644,
      "symbol": "LCX/USDC",
      "volume": 26362.534
    }
  },
  "message": "Successfully Api response",
  "status": "success"
}

type: GET
endpoint: https://exchange-api.lcx.com/market/tickers

Get Ticker with symbol

The Get Ticker with symbol endpoint allows you to view a high level overview of the market status of given pair. It exhibits the ongoing best bid and ask, the last traded price, along with the information on the daily volume and price movement that happened the previous day.

Example Request

var axios = require('axios')
var data = '{"pair":"ETH/BTC"}'

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

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

The api returns JSON structured like this:

{
  "data": {
    "bestAsk": 0.0788813,
    "bestBid": 0.078759,
    "change": 71.61,
    "equivalent": 4437.3876901578,
    "high": 0.08216563,
    "last24Price": 0.04515737,
    "lastPrice": 0.07749301,
    "lastUpdated": 1614004641,
    "low": 0.04610567,
    "symbol": "ETH/BTC",
    "volume": 2.96
  },
  "message": "Successfully Api response",
  "status": "success"
}

type: POST
endpoint: https://exchange-api.lcx.com/market/ticker

Body Parameters

Parameter Required Description
pair true The pair for which you need ticker

Authenticated API

Create an Order

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

Example Request

var axios = require('axios')
var data = JSON.stringify({
  Pair: 'LCX/ETH',
  Amount: 100,
  Price: 0.004,
  OrderType: 'MARKET',
  Side: 'SELL',
})

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

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

The api returns JSON structured like this:

{
  "data": {
    "Id": "e8737c4a-3804-461c-9e67-4fe0af5aeb06",
    "Pair": "ETH/BTC",
    "Price": 0.029,
    "Amount": 0.1,
    "Side": "SELL",
    "OrderType": "LIMIT",
    "Status": "OPEN",
    "Filled": 0,
    "Average": 0.029,
    "Total": 0,
    "CreatedAt": 1605870261,
    "UpdatedAt": 1605870261,
    "UserId": "3321eb49-6228-4574-912f-af5aecd3e2f7",
    "User": null
  },
  "message": "Successfully Api response",
  "status": "success"
}

type: POST
endpoint: https://exchange-api.lcx.com/api/create

Body Parameters

Parameter Required Description
Pair true The pair for which you want to create an order
Amount true Amount of base pair
Price true Price of quote pair
OrderType true Order type Limit or Market
Side true SELL or BUY

Modify an Order

The modify an order endpoint enables you to update buy/sell order on limit on LCX Exchange.

Example Request

var axios = require('axios')
var data = JSON.stringify({
  OrderId: '9f898d18-0980-4fb3-b18c-eeb39fc20324',
  Amount: 100,
  Price: 0.004
})

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

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

The api returns JSON structured like this:

{
    "data": {
        "Id": "9f898d18-0980-4fb3-b18c-eeb39fc20324",
        "Pair": "LCX/EUR",
        "Price": 0.0381,
        "Amount": 30,
        "Side": "SELL",
        "OrderType": "LIMIT",
        "Status": "OPEN",
        "Filled": 0,
        "Average": 0.0381,
        "Total": 0,
        "CreatedAt": 1698764794,
        "UpdatedAt": 1698764807,
        "UserId": "3321eb49-6228-4574-912f-af5aecd3e2f7",
        "Fee": 0,
        "IsFeeInLCX": false,
        "FeeLevel": 9,
        "FilledPer": 0,
        "Referral_UserId": "00000000-0000-0000-0000-000000000000"
    },
    "message": "Order updated successfully",
    "status": "success"
}

type: POST
endpoint: https://exchange-api.lcx.com/api/modify

Body Parameters

Parameter Required Description
OrderId true Order ID of your order
Amount true Amount of base pair
Price true Price of quote pair

Cancel Order

The endpoint Cancel Order, allows you to cancel exchange orders. You can cancel the order by the Order Id.

Example Request

var axios = require('axios')
var data = JSON.stringify({ OrderId: 'e8737c4a-3804-461c-9e67-4fe0af5aeb06' })

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

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

The api returns JSON structured like this:

{
  "data": [
    {
      "Id": "e8737c4a-3804-461c-9e67-4fe0af5aeb06",
      "Pair": "ETH/BTC",
      "Price": 0.029,
      "Amount": 0.1,
      "Side": "SELL",
      "OrderType": "LIMIT",
      "Status": "CANCEL",
      "Filled": 0,
      "Average": 0,
      "Total": 0,
      "CreatedAt": 1605870261,
      "UpdatedAt": 1605870261,
      "UserId": "3321eb49-6228-4574-912f-af5aecd3e2f7"
    }
  ],
  "message": "Successfully Api response",
  "status": "success",
  "totalCount": 1
}

type: POST
endpoint: https://exchange-api.lcx.com/api/cancel

Body Parameters

Parameter Required Description
OrderId true Order ID of your order

Open Orders

The Open Order endpoint enables you to view all the orders that are open and ready to be executed.

Example Request

var axios = require('axios')
var data = JSON.stringify({ Pair: 'ETH/BTC', Offset: 1 })

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

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

The api returns JSON structured like this:

{
  "data": [
    {
      "Id": "e8737c4a-3804-461c-9e67-4fe0af5aeb06",
      "Pair": "ETH/BTC",
      "Price": 0.029,
      "Amount": 0.1,
      "Side": "SELL",
      "OrderType": "LIMIT",
      "Status": "OPEN",
      "Filled": 0,
      "Average": 0,
      "Total": 0,
      "CreatedAt": 1605870261,
      "UpdatedAt": 1605870261,
      "UserId": "3321eb49-6228-4574-912f-af5aecd3e2f7"
    }
  ],
  "message": "Successfully Api response",
  "status": "success",
  "totalCount": 1
}

type: POST
endpoint: https://exchange-api.lcx.com/api/open

Body Parameters

Parameter Required Description
Pair true The pair for which you want to create an order
Offset true Page number

Get Single Order

The Single order endpoint enables you to view details of the order.

Example Request

var axios = require('axios')
var data = '{"OrderId":"e8737c4a-3804-461c-9e67-4fe0af5aeb06"}'

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

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

The api returns JSON structured like this:

{
  "data": {
      "Id": "e8737c4a-3804-461c-9e67-4fe0af5aeb06",
      "Pair": "ETH/BTC",
      "Price": 0.029,
      "Amount": 0.1,
      "Side": "SELL",
      "OrderType": "LIMIT",
      "Status": "CLOSED",
      "Filled": 0.1,
      "Average": 0.029,
      "Total": 0.0029,
      "CreatedAt": 1605870261,
      "UpdatedAt": 1605870261,
      "UserId": "3321eb49-6228-4574-912f-af5aecd3e2f7"
  },
  "message": "Successfully Api response",
  "status": "success"
}

type: POST
endpoint: https://exchange-api.lcx.com/api/order

Body Parameters

Parameter Required Description
OrderId true Unique ID of your order.

Order History

The Order History endpoints enables you to view all the previously closed or cancelled orders.

Example Request

var axios = require('axios')
var data = '{"Pair":"ETH/BTC","Offset": 1}'

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

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

The api returns JSON structured like this:

{
  "data": [
    {
      "Id": "e8737c4a-3804-461c-9e67-4fe0af5aeb06",
      "Pair": "ETH/BTC",
      "Price": 0.029,
      "Amount": 0.1,
      "Side": "SELL",
      "OrderType": "LIMIT",
      "Status": "CLOSED",
      "Filled": 0.1,
      "Average": 0.029,
      "Total": 0.0029,
      "CreatedAt": 1605870261,
      "UpdatedAt": 1605870261,
      "UserId": "3321eb49-6228-4574-912f-af5aecd3e2f7"
    }
  ],
  "message": "Successfully Api response",
  "status": "success",
  "totalCount": 1
}

type: POST
endpoint: https://exchange-api.lcx.com/api/orderHistory

Body Parameters

Parameter Required Description
Pair true The pair for which you want order history
Offset true Page number
OrderStatus false CLOSED or CANCEL, to get either all closed or cancelled orders

Trade History

The Trade History endpoints enables you to view all the executed orders.

Example Request

var axios = require('axios')
var data = '{"Pair":"ETH/BTC","Offset": 1}'

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

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

The api returns JSON structured like this:

{
  "data": [
    {
      "Amount": 100,
      "CreatedAt": 1697171480,
      "Fee": 0.1,
      "FeeCoin": "LCX",
      "Id": "2d9d0338-ae79-4f3d-962d-2d658750328c",
      "OrderType": "LIMIT",
      "Pair": "LCX/EUR",
      "Price": 0.0386,
      "Side": "BUY",
      "Status": "CLOSED",
      "UserId": "3321eb49-6228-4574-912f-af5aecd3e2f7"
    },
  ],
  "message": "Successfully Api response",
  "status": "success",
  "totalCount": 1
}

type: POST
endpoint: https://exchange-api.lcx.com/api/uHistory

Body Parameters

Parameter Required Description
Pair true The pair for which you want order history
Offset true Page number

Fetch All Balance

The Fetch All Balances endpoint gives you the balance of all the coins listed on LCX Exchange.

Example Request

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

The api returns JSON structured like this:

{
  "data": [
    {
      "balance": {
        "freeBalance": 989.49078186,
        "occupiedBalance": 0,
        "totalBalance": 989.49078186
      },
      "coin": "USDC"
    },
    {
      "balance": {
        "freeBalance": 71966.33711239,
        "occupiedBalance": 0,
        "totalBalance": 71966.33711239
      },
      "coin": "LCX"
    },
    {
      "balance": {
        "freeBalance": 0.51701447,
        "occupiedBalance": 0,
        "totalBalance": 0.51701447
      },
      "coin": "BTC"
    },
    {
      "balance": {
        "freeBalance": 4.40218598,
        "occupiedBalance": 0,
        "totalBalance": 4.40218598
      },
      "coin": "ETH"
    }
  ],
  "message": "Successfully Api response",
  "status": "success"
}

type: GET
endpoint: https://exchange-api.lcx.com/api/balances

Fetch Coin Balance

The Fetch All Balances endpoint gives you the balance of one coin listed on LCX Exchange.

Example Request

var axios = require('axios')
var data = '{"coin" : "ETH"}'

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

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

The api returns JSON structured like this:

{
  "data": {
    "balance": {
      "freeBalance": 5,
      "occupiedBalance": 0,
      "totalBalance": 5
    },
    "coin": "ETH"
  },
  "message": "Successfully Api response",
  "status": "success"
}

type: POST
endpoint: https://exchange-api.lcx.com/api/balance

Body Parameters

Parameter Required Description
Coin true The coin symbol

Public WS

For Public Websocket, you can retrieve three types of data. These are mentioned below:

Example Request

const ws = require('ws')
const w = new ws('wss://exchange-api.lcx.com/ws')

w.on('message', (msg) => console.log(msg))

let msg = JSON.stringify({
  Topic: 'ping',
})

w.on('open', () => w.send(msg))

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.

Example Request

const ws = require('ws')
const w = new ws('wss://exchange-api.lcx.com/ws')

w.on('message', (msg) => console.log(msg))

let msg = JSON.stringify({
  Topic: 'subscribe',
  Type: 'ticker',
})

w.on('open', () => w.send(msg))

Snapshot

{
  "type": "ticker",
  "topic": "snapshot",
  "pair": "",
  "data": {
    "BTC/USDC": {
      "bestAsk": 49900,
      "bestBid": 43500,
      "change": 0,
      "equivalent": 44175.6781072649,
      "high": 44309.0039,
      "last24Price": 44309.0039,
      "lastPrice": 44309.0039,
      "lastUpdated": 1613545721,
      "low": 44309.0039,
      "symbol": "BTC/USDC",
      "volume": 0
    },
    "ETH/BTC": {
      "bestAsk": 0.037347,
      "bestBid": 0.03551,
      "change": 0,
      "equivalent": 1974.8271966,
      "high": 0.037347,
      "last24Price": 0.037347,
      "lastPrice": 0.037347,
      "lastUpdated": 1613414932,
      "low": 0.037347,
      "symbol": "ETH/BTC",
      "volume": 0
    },
    "ETH/USDC": {
      "bestAsk": 1699.27,
      "bestBid": 1500,
      "change": 0,
      "equivalent": 1594.45779657,
      "high": 1599.27,
      "last24Price": 1599.27,
      "lastPrice": 1599.27,
      "lastUpdated": 1613463023,
      "low": 1599.27,
      "symbol": "ETH/USDC",
      "volume": 0
    },
    "LCX/BTC": {
      "bestAsk": 1.7e-7,
      "bestBid": 1.6e-7,
      "change": 0,
      "equivalent": 0.008989226,
      "high": 1.7e-7,
      "last24Price": 1.7e-7,
      "lastPrice": 1.7e-7,
      "lastUpdated": 1613491806,
      "low": 1.7e-7,
      "symbol": "LCX/BTC",
      "volume": 0
    },
    "LCX/ETH": {
      "bestAsk": 0.00001265,
      "bestBid": 0.000009,
      "change": 42.65,
      "equivalent": 0.019223,
      "high": 0.00001,
      "last24Price": 0.00000701,
      "lastPrice": 0.00001,
      "lastUpdated": 1613774328,
      "low": 0.00000851,
      "symbol": "LCX/ETH",
      "volume": 30000
    },
    "LCX/USDC": {
      "bestAsk": 0.0193,
      "bestBid": 0.01475,
      "change": -30.72,
      "equivalent": 0.018,
      "high": 0.018,
      "last24Price": 0.02598,
      "lastPrice": 0.018,
      "lastUpdated": 1613771976,
      "low": 0.00012615,
      "symbol": "LCX/USDC",
      "volume": 58732.197
    }
  }
}

Updates

{
  "type": "ticker",
  "topic": "update",
  "pair": "ETH/BTC",
  "data": {
    "bestAsk": 0.04326133,
    "bestBid": 0.04054008,
    "change": 0,
    "equivalent": 2287.56395547,
    "high": 0.04326133,
    "last24Price": 0.04326133,
    "lastPrice": 0.04326133,
    "lastUpdated": 1613796138,
    "low": 0.03766265,
    "symbol": "ETH/BTC",
    "volume": 0.523
  }
}

endpoint: wss://exchange-api.lcx.com/ws

Subscription Parameters

Parameter Required Description
Topic true subscribe OR unsubscribe
Type true ticker

Orderbook

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

Example Request

const ws = require('ws')
const w = new ws('wss://exchange-api.lcx.com/ws')

w.on('message', (msg) => console.log(msg))

let msg = JSON.stringify({
  Topic: 'subscribe',
  Type: 'orderbook',
  Pair: 'LCX/USDC',
})

w.on('open', () => w.send(msg))

Snapshot

{
  "type": "orderbook",
  "topic": "snapshot",
  "pair": "LCX/USDC",
  "data": {
    "buy": [
      [0.01475, 3512.339],
      [0.01201, 0],
      [0.01175, 2136.596],
      [0.00618615, 8116.68],
      [0.00179615, 0],
      [0.0011961, 42638.575],
      [0.00118615, 0],
      [0.00117615, 0],
      [0.00019615, 381351.007],
      [0.00018635, 123836.866],
      [0.00018615, 91050.228],
      [0.00018, 0],
      [0.00017775, 0],
      [0.00017715, 0],
      [0.00017615, 642038.602],
      [0.0001725, 0],
      [0.0001386, 0],
      [0.00012615, 134356.718],
      [0.00012605, 79333.598],
      [0.000125, 20000],
      [0.00000646, 996904.0247678]
    ],
    "lastPrice": 0.018,
    "sell": [
      [0.0193, 600],
      [0.02471, 0],
      [0.0255, 250],
      [0.0257, 2500],
      [0.0258, 10000],
      [0.04, 2918],
      [0.0445, 2400],
      [0.0446, 100000],
      [0.04859999, 2162.365],
      [0.0486, 500],
      [0.049, 4000],
      [0.0491, 1000],
      [0.0499, 1000],
      [0.04999999, 5452.342],
      [0.05, 150],
      [0.0599, 3000],
      [0.06784, 3500],
      [0.06984, 5000],
      [0.079, 1000],
      [0.07984, 5000],
      [0.08, 100],
      [0.0804, 2000],
      [0.0805, 0],
      [0.08984, 5000],
      [0.0899, 13000],
      [0.09, 6750],
      [0.0951324, 1000],
      [0.09699999, 3000],
      [0.0979, 113.658],
      [0.09799999, 1000],
      [0.098, 92426.49527781],
      [0.09984, 5000],
      [0.099866, 101],
      [0.0999, 5800],
      [0.1, 4100],
      [0.15, 500],
      [0.2, 500],
      [0.5, 778.457],
      [0.5899, 1000],
      [0.59, 500],
      [0.616, 500],
      [0.8978, 1000],
      [0.8979, 2831.75],
      [0.98, 500],
      [0.99, 1000],
      [1, 84333.26501299],
      [1.99, 400],
      [6.99, 500],
      [7.99, 500],
      [9.99, 1500]
    ]
  }
}

Updates

{
  "type": "orderbook",
  "topic": "update",
  "pair": "ETH/BTC",
  "data": [0.04125722, 0.036, "BUY"]
}

endpoint: wss://exchange-api.lcx.com/ws

Subscription Parameters

Parameter Required Description
Topic true subscribe OR unsubscribe
Type true orderbook

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.

Example Request

const ws = require('ws')
const w = new ws('wss://exchange-api.lcx.com/ws')

w.on('message', (msg) => console.log(msg))

let msg = JSON.stringify({
  Topic: 'subscribe',
  Type: 'trade',
  Pair: 'ETH/BTC',
})

w.on('open', () => w.send(msg))

Snapshot

{
  "type": "trade",
  "topic": "snapshot",
  "pair": "ETH/BTC",
  "data": [
    [0.04326133, 0.039, "BUY", 1613796138],
    [0.04322488, 0.055, "BUY", 1613796137],
    [0.04314891, 0.005, "BUY", 1613796137],
    [0.0422793, 0.001, "BUY", 1613796137],
    [0.04140969, 0.022, "SELL", 1613728909],
    [0.04079948, 0.001, "BUY", 1613725383],
    [0.04014255, 0.067, "BUY", 1613725383],
    [0.04124575, 0.076, "BUY", 1613725383],
    [0.04140438, 0.008, "BUY", 1613725383],
    [0.0415904, 0.005, "BUY", 1613725383],
    [0.04186627, 0.005, "BUY", 1613725383],
    [0.04219354, 0.038, "BUY", 1613725383],
    [0.03947762, 0.043, "BUY", 1613724435],
    [0.03924449, 0.005, "BUY", 1613724435],
    [0.03924244, 0.084, "BUY", 1613724435],
    [0.04000856, 0.016, "BUY", 1613724435],
    [0.04003541, 0.01, "BUY", 1613724435],
    [0.04017875, 0.003, "BUY", 1613724435],
    [0.03845357, 0.001, "BUY", 1613724435],
    [0.03930356, 0.038, "BUY", 1613724435],
    [0.03766265, 0.001, "BUY", 1613723256]
  ]
}

Updates

{
  "type": "trade",
  "topic": "update",
  "pair": "ETH/BTC",
  "data": [0.0193, 100, "BUY", 1613801229]
}

endpoint: wss://exchange-api.lcx.com/ws

Subscription Parameters

Parameter Required Description
Topic true subscribe OR unsubscribe
Type true trade

Authenticated WS

const CryptoJS = require('crypto-js')
const axios = require('axios')
let base_url = 'wss://exchange-api.lcx.com'
let end_point = '/api/auth/ws'
let method = 'GET'
let api = 'YOUR LCX EXCHANGE API KEY'
let secret = 'YOUR LCX EXCHANGE SECRET KEY'
const EXAMPLE_PAYLOAD = {}
let requestString = method + end_point + JSON.stringify(EXAMPLE_PAYLOAD)
let hash = CryptoJS.HmacSHA256(requestString, secret)
let signature = CryptoJS.enc.Base64.stringify(hash)
let query_parameters = {
  'x-access-key': api,
  'x-access-sign': signature,
  'x-access-timestamp': Date.now(),
}

For Authenticated Websocket, you will be able to retrieve two types of data. These are mentioned below:

Authenticated Websocket expects the API key, signature and timestamp in milliseconds to be included as a query parameter in websocket URL, keys are mentioned below

Query Parameters

Parameter Required Description
x-access-key true Your LCX Exchange API Key
x-access-sign true Signature signed by your LCX Exchange Secret Key
x-access-timestamp true Current timestamp in milliseconds

Wallets

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

Example Request

const ws = require('ws')
const w = new ws(
  'wss://exchange-api.lcx.com/api/auth/ws?x-access-key={value}&x-access-sign={value}&x-access-timestamp={value}',
)

w.on('message', (msg) => console.log(msg))

let msg = JSON.stringify({
  Topic: 'subscribe',
  Type: 'user_wallets',
})

w.on('open', () => w.send(msg))

Updates

{
  "userid": "3321eb49-6228-4574-912f-af5aecd3e2f7",
  "type": "user_wallets",
  "topic": "update",
  "data": {
    "data": [
      {
        "balance": {
          "freeBalance": 19.47944315,
          "occupiedBalance": 0,
          "totalBalance": 19.47944315
        },
        "coin": "BTC",
        "equivalentUSDBalance": {
          "freeBalance": 1113696.83,
          "occupiedBalance": 0,
          "totalBalance": 1113696.83
        }
      },
      {
        "balance": {
          "freeBalance": 1920.64812163,
          "occupiedBalance": 0,
          "totalBalance": 1920.64812163
        },
        "coin": "USDC",
        "equivalentUSDBalance": {
          "freeBalance": 1920.64,
          "occupiedBalance": 0,
          "totalBalance": 1920.64
        }
      },
      {
        "balance": {
          "freeBalance": 396785.98523184,
          "occupiedBalance": 0,
          "totalBalance": 396785.98523184
        },
        "coin": "LCX",
        "equivalentUSDBalance": {
          "freeBalance": 9638.78,
          "occupiedBalance": 0,
          "totalBalance": 9638.78
        }
      },
      {
        "balance": {
          "freeBalance": 266.00853689,
          "occupiedBalance": 0.2,
          "totalBalance": 266.20853689
        },
        "coin": "ETH",
        "equivalentUSDBalance": {
          "freeBalance": 536858.42,
          "occupiedBalance": 403.64,
          "totalBalance": 537262.06
        }
      }
    ],
    "totalBalance": { "inBTC": 29.078767, "inUSD": 1662518.31 }
  }
}

endpoint: wss://exchange-api.lcx.com/api/auth/ws

Subscription Parameters

Parameter Required Description
Topic true subscribe OR unsubscribe
Type true user_wallets

Orders

Order wensocket enables you to receive snapshots and order updates regarding any order related activity in your account.

Example Request

const ws = require('ws')
const w = new ws(
  'wss://exchange-api.lcx.com/api/auth/ws?x-access-key={value}&x-access-sign={value}&x-access-timestamp={value}',
)

w.on('message', (msg) => console.log(msg))

let msg = JSON.stringify({
  Topic: 'subscribe',
  Type: 'user_orders',
})

w.on('open', () => w.send(msg))

Updates

{
  "userid": "3321eb49-6228-4574-912f-af5aecd3e2f7",
  "type": "user_orders",
  "topic": "update",
  "data": {
    "Id": "55003349-18f4-4f1a-a284-656ba19886ce",
    "Pair": "ETH/BTC",
    "Price": 0.05218048,
    "Amount": 0.2,
    "Side": "SELL",
    "OrderType": "LIMIT",
    "Status": "OPEN",
    "Filled": 0,
    "Average": 0.05218048,
    "Total": 0,
    "CreatedAt": 1613877978,
    "UpdatedAt": 1613877978,
    "UserId": "3321eb49-6228-4574-912f-af5aecd3e2f7",
    "Fee": 0,
    "IsFeeInLCX": true
  }
}

endpoint: wss://exchange-api.lcx.com/api/auth/ws

Subscription Parameters

Parameter Required Description
Topic true subscribe OR unsubscribe
Type true user_orders