× #message#
×

Warning

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/?p=PAIR_ID

Query parameter p is used to specify the exact pair you want to track. For example, BTC/EUR URL:

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

You can specify multiple pairs separated by comma:

wss://limitlex.com/websocket/?p=44567e46-d10c-4b99-bc82-4e2faca15234: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 describes the type of the event
  • the rest of the fields 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/?p=PAIR_ID&t=YOUR_TOKEN

Example:

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

Subaccounts

See Exchange API documentation for detailed explanation of sub accounts.

The main account can track notifications for sub accounts by specifying the query parameter subaccounts=true when connecting.

Each private message intended for the sub account will then contain the subaccountId field:

{
  "t": "trade",
  "subaccountId": "dff446dc-1aad-4d69-a90f-20f403220470",
  "orderDirection": "Buy",
  "amount": "0.00010000",
  "price": "7997.00",
  "createdAt": 1598530122
}

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