NAV Navbar
python

Introduction

██╗     ██╗  ██╗██████╗ ██╗  ██╗
██║     ╚██╗██╔╝██╔══██╗╚██╗██╔╝
██║      ╚███╔╝ ██║  ██║ ╚███╔╝ 
██║      ██╔██╗ ██║  ██║ ██╔██╗ 
███████╗██╔╝ ██╗██████╔╝██╔╝ ██╗
╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝  ╚═╝

Welcome to our trader and developer documentation. Included within are details on the exchange's functionality and APIs.

Exchange Overview

Matching

LXDX operates centralized limit order book matching engines for each listed pair on the exchange.

Matching, unless otherwise specified, is based on the “first come first serve” principle, FIFO.

FIFO

Under FIFO, price and time are the only criteria for filling an order; all orders at the same price level are filled according to time priority such that the first order at a given price level is the first order matched.

In the following example, if orders on the offer side came in at or below 8012, the 9-lot and then the 2-lot would match (in that order).

Time Bid Price Bid Quantity
19:01 8012 9
19:09 8012 2

Self-Trade Prevention

Self-trading is prohibited on LXDX. Two orders from the same user will not fill one another. When an order would cross with a user's pre-existing resting order, the resting order is canceled in full and the new order continues to execute.

Redundancy

In the very unlikely event of a matching engine failure, the product transitions to an auto-halt and recovery phase. More details are found in our reliability documents.

Data Center

LXDX operates its primary data center out of FR5 in Frankfurt. The test environment is run out of SG1 in Singapore.

Trading Fees

LXDX operates under a maker-taker model; orders that take liquidity are charged a fee while orders which provide liquidity are credited a rebate. The size of the fee or credit is a percentage of the notional matched amount (price * size). Fees are set on a per-instrument basis. To view the fees for an instrument, check the maker_fee and taker_fee fields available on the products or warrants endpoints.

As an example, given the following fees:

If Alice purchases 2 BTCTUSD from Bob at the price of 6500:

Rate Limits

To ensure fair and efficient market operations, allow for broad market participation and foster high quality liquid markets, LXDX provides transparent messaging thresholds.

In summary:

Message Reject Threshold Fee Threshold Ban Threshold Interval
Cancel or IOC 500 1000 2000 10 second window
New 500 2000 5000 10 second window

Using the API

LXDX operates a websocket driven web API. Trading applications are expected to listen on websocket connections for all responses, while requests can be made via either the websocket or HTTP requests.

LXDX offers a certification environment, which can be used to test integrations before going live with an application. This is an isolated environment, so users must sign up on the certification web portal before use.

URL Environment Use
trade.lxdx.co Production Web Portal
cert.lxdx.co Certification Web Portal
api.lxdx-svcs.net/v1/ Production HTTP API Root
api-cert.lxdx-svcs.net/v1/ Certification HTTP API Root
iris.lxdx-svcs.net/v1/ Production WS Connection Root
iris-cert.lxdx-svcs.net/v1/ Certification WS Connection Root

Changelog

2019-02-25

2018-12-10

2018-12-02

2018-12-01

2018-11-25

2018-11-19

2018-11-08

2018-11-07

2018-11-06

2018-11-01

Authentication

HTTP endpoints providing static data and the orderbook websocket do not require authentication. Prior to making authenticated requests, users must obtain access keys through the web portal.

Signing Requests

Python Authentication Example using AWS4Auth

import requests
from requests_aws4auth import AWS4Auth

# Variables needed by the AWS standard:
region = 'ap-southeast-1'
service = 'execute-api'

# Access keys created via the LXDX UI:
key = 'my-access-key'
secret = 'my-access-secret'

auth = AWS4Auth(key, secret, region, service)

url = 'https://api.lxdx-svcs.net/v1/messages/token'

response = requests.request('GET', url, auth=auth)

The fastest way to get up and running once keys have been created is to leverage an AWS SigV4 authentication library, such as AWS4Auth in the case of Python.

To implement custom authorization, please follow the AWS's Sigv4 documentation.

HTTP Authentication

HTTP Requests are authenticated with the x-amz-date and Authorization headers, as described by AWS's Sigv4.

Websocket Authentication

import requests, aiohttp

date = get_date()
auth = generate_auth(date) # As documented above.

headers = { 'x-amz-date': date, 'Authorization': auth }

response = requests.get("https://api.lxdx-svcs.net/v1/messages/token", headers=headers)
token = response.body['token']

ws_session = aiohttp.ClientSession()
ws = await session.ws_connect(f"wss://iris.lxdx-svcs.net/v1/account?token={token}")

Establishing an authenticated websocket connection is a two step process. An authenticated HTTP request must be made to https://api.lxdx-svcs.net/v1/messages/token, which will provide an authorization token. This token can then be used to establish the websocket connection as a query parameter: wss://iris.lxdx-svcs.net/v1/account?token=abcdef1234. These tokens are one time use and expire after 30 seconds.

Markets

Assets

HTTP Request

This endpoint lists the set of underlying assets (coins) available for trade on LXDX. Click here to view the currently available data.

$ curl https://api.lxdx-svcs.net/v1/data/assets

Products

HTTP Request

This endpoint lists the set of products (pairs) available for trade on LXDX. Click here to view the currently available data.

$ curl https://api.lxdx-svcs.net/v1/data/products

Indices

This endpoint lists the set of indices tracked by LXDX. Click here to view the currently available data. More information can be found here.

$ curl https://api.lxdx-svcs.net/v1/data/indices

Warrants

This endpoint lists the currently active warrants on LXDX. Click here to view the current warrants. More information can be found here.

Account Websocket

Connect

The account websocket is used for any account-scoped requests into the exchange. This connection is authenticated. The URL for the account websocket is wss://iris.lxdx-svcs.net/v1/account.

Requests

Base Account Websocket Request

{
  "action": "action_type",
  "payload": {...}
}

All account requests have an action key that denotes the action being taken, and a payload key that contains the data object for the action.

Field Description
action The action being taken.
payload The object containing data.

Responses

Base Account Websocket Response

{
  "m": "message_type",
  "payload": {...}
}

All account responses have an m key that denotes the message type, and a payload key that contains the data object for the message.

Field Description
m The type of the payload.
payload The object containing data.

Errors

General Error Message

{
  "m": "e"
  "message":  "invalid message"
}

Error messages are denoted by a message type of e. Specific requests may provide more granular error messages.

Submit Order

Orders can only be placed if your account has the necessary funds. Upon order placement, your account funds will be put on lock for the duration of the order. The amount of the lock depends on the price and quantity of the order. See Locks.

Submit Order Message

{
  "action": "submit_order",
  "payload": {
    "price": "3500",
    "qty": "0.1",
    "symbol": "btc-tusd",
    "side": "buy",
    "time_in_force": "IOC",
    "customer_order_ref": "42069",
    "type": "limit",
    "post_only": "true"
  }
}

PARAMETERS

Field Description
price Price of the order.
qty Quantity of the order.
symbol Symbol of the order.
side Side of the order: buy or sell.
time_in_force [optional] Time-in-Force of the order. Default is DAY.
customer_order_ref [optional] Client-provided ID of the order.
type [optional] Message type limit or market. Default is limit.
post_only [optional] Whether the order should only provide liquidity. Default is false.

PRICE

Prices are specified as string escaped and must be in accordance to the product's tick increment. Prices are additionally subject to minimum and maximum prices.

Note that all products have tick increments denoted in TUSD (True USD) except the product tusd-usdt which has a tick increment denoted in USDT (Tether).

Product Tick Increment Minimum Price Maximum Price
btc-tusd 1 -20% +20%
eth-tusd 0.1 -30% +30%
xrp-tusd 0.01 -30% +30%
tusd-usdt 0.01 -20% +20%

PRICE BANDS

Price bands are set as the maximum movement for a product during the day's session. All price bands are computed relative to the previous session's Close.

QTY

Specifies the quantity of the order. Order quantities are subject to minimum and maximum values as detailed below:

Product Minimum Order Size Maximum Order Size
btc-tusd 0.001 999
eth-tusd 0.01 9,999
xrp-tusd 1 99,999
tusd-usdt 0.01 999,999

All order quantities must be a multiple of the product's minimum order size.

SYMBOL

The symbol must match a valid exchange product. See Products.

SIDE

The side value must match "buy" for buy orders or "sell" for orders.

Value Description
buy Bids, Buys
sell Asks, Sells

TIME IN FORCE

Time-in-Force describes the life of an order. The Day session begins 16:00 UTC and ends the following day at 15:00 UTC. Orders with the a time-in-force of GTD are cancelled upon close at the end of the session.

Value Description
GTC Good Until Canceled
DAY Good For Day
IOC Immediate or Cancel

CUSTOMER_ORDER_REF

The customer order reference should be generated by your trading application.

This ID should be a unique unsigned integer.

TYPE

The type of the order must match "limit" for limit orders and "market" for markets orders.

Value Description
limit Limit Order
market Market Orders

POST ONLY

The post-only flag indicates that the order should act only as a maker order. If any part of the order would lead to taking liquidity, the entire order is rejected.

Value Description
true Order will only act as a maker (and receive maker rebate)
false Order may taker (and pay taker fees)

LOCKS

The size of the lock is dependent on the denominator asset (by default TUSD) for buy orders and the numerator asset for sell orders.

For example, when purchasing eth-tusd, the purchaser will have price x size x (1 + fee-percent) TUSD locked.

In the above example, the seller simply has the size of ETH offered locked.

When orders are cancelled, the remaining funds of the partially filled or unfilled order are released from lock.

Submit Order Response

Submit Order Response

{
  "m": "order_submitted",
  "payload": {
    "response": "1",
    "order_id": "1234",
    "remaining_quantity": "5",
    "customer_order_ref": "54321",
    "request_id": "9999"
  }
}

The order response object is emitted by the exchange after a place order request has been made. Details the state of the order request.

Field Description
response Response state of the order.
order_id ID of the order generated by the exchange.
remaining_qty Remaining quantity of the order.
customer_order_ref Client-provided ID of the order.
request_id ID of the request that originally placed the order.

Response Values

Value State Description
0 accepted The order is resting in the market.
1 filled_then_killed IOC order was partially filled and then killed.
2 could_not_fill IOC did not fill and was canceled.
3 post_only_reject Order Rejected - post_only flag was set and the order did not cross.
4 no_such_account Order Rejected - No active account found.
5 insufficient_funds Order Rejected - Not enough funds to execute the order.
6 invalid_qty Order Rejected - Did not meet minimum quantity.
8 outside_pricebands Order Rejected - Price outside of the current price bands.
9 oid_exists Order Rejected - An order witih the given ID already exists.
10 market_closed Order Rejected - The market is currently closed.
11 self_trade Order Rejected - The order would cross with another working order on the same account.
12 invalid_product Order Rejected - Invalid pairsymbol.
13 partial_then_self_trade Order Partially Rejected - The order was partially filled, but would have crossed with another working order on the same account for the remaining quantity.
14 invalid_order_type Order Rejected - Invalid order type.
15 minimum_price Order Rejected - Below minimum price.

ORDER_ID

The internal order id provided by the exchange core.

REMAINING_QTY

The current remaining quantity in the market.

CUSTOMER_ORDER_REF

The client-provided customer ID that can be used to match with this response.

Cancel Order

Cancel Order Message

{
  "action": "cancel_order",
  "payload": {
    "order_id": "12345",
    "request_id": "1234",
    "symbol": "btc-tusd"
  }
}

Field Description
order_id The exchange order_id of the order to cancel.
request_id A unique identifier for the request.
symbol The product symbol of the original order.

ORDER_ID

The internal order id provided by the exchange core.

SYMBOL

The symbol of the original order. This field is required.

Cancel Order Response

Cancel Order Response

{
  "m": "order_canceled",
  "payload": {
    "response": "1",
    "order_id": "1234",
    "unfilled_qty": "5",
    "request_id": "9999"
  }
}

Cancel responses are emitted after a cancel order request has been made.

Field Description
response Response state of the cancellation.
order_id ID of the order generated by the exchange.
request_id The ID of the request that originally placed the order.
unfilled_qty The remaining quantity at the time of cancellation.

RESPONSE (CANCEL STATES)

Details the state of the cancellation request.

Value State Description
0 cancelled Order Canceled
1 no_such_order Attempted to cancel an order that could not be located.
2 already_filled Attempted to cancel an order that was already fully filled.
3 market_closed Order Canceled - The market is currently closed.
4 self_trade Order Canceled - The order would cross with another working order on the same account.
5 invalid_product Order Canceled - Invalid pair symbol.

ORDER_ID

The internal order id provided by the exchange core denoting which order was canceled.

UNFILLED_QTY

The amount successfully cancelled. If this number is less than the original order quantity, the order has been partially filled (and you should have received a corresponding fill message).

List Orders

List Orders Message

{
  "action": "list_orders",
  "payload": {
    "request_id": "12345"
  }
}
Field Description
request_id A unique identifier for the request.

Order Snapshot Message

Order Snapshot Message

{
  "m": "order_snapshot",
  "payload": {
    "request_id": "12345",
    "order_start_index": "5",
    "total_orders": "10",
    "num_orders": "1",
    "orders": [...]
  }
}

One or more Order Snapshot objects are emitted from the exchange after a list orders request has been made. Each object contains a fixed number of orders, so the number of order snapshots emitted will depend on the number of orders currently open.

You have received the entirety of your open orders when the number of orders received is equal to the total_orders specified.

Field Description
request_id The request id of the list orders request.
order_start_index The index of the first order in this message.
total_orders The total number of resting orders.
num_orders The number of orders in the message.
orders A list of order objects.

ORDER OBJECT

Each snapshot contains a list of Order objects. These Order objects represent the state of an order at the Exchange.

Order Object

{
  "price": "1",
  "remaining_qty": "2",
  "order_id": "3",
  "customer_order_ref": "4",
  "symbol": "btc-tusd",
  "side": "buy",
  "post_only": "0",
  "time_in_force": "gtc",
  "request_id": "55555",
  "original_qty": "3"
}
Field Description
price The bid or ask price for the order.
remaining_qty The current remaining quantity of the order.
order_id The ID of the order generated by the exchange.
customer_order_ref The ID of the order provided by the client.
symbol The symbol of the corresponding product.
side The side of the order. See side for more details.
post_only If 1, the order will only be accepted if it does not immediately cross.
time_in_force Time in force for the order. See tifs for more details.
request_id The ID of the request that originally placed the order.
original_qty The original order quantity.

Fill Notification

Fill Notification Message

{
  "m": "trade_executed",
  "payload": {
    "side": "buy",
    "order_id": "1415151",
    "qty": "15",
    "price": "201.1",
    "symbol": "eth-tusd",
    "aggressor": "sell",
    "remaining_qty": "4",
    "customer_order_ref": "42",
    "trade_id": "999",
    "timestamp": "1541461093573557000"
  }
}

A fill notification message is emitted from the account websocket whenever an open order on the account is filled.

Field Description
side The side of the trade.
order_id The exchange ID of the trade.
qty The quantity that was executed.
price The price at which the trade occurred.
symbol The symbol of the product for which the trade occurred.
aggressor The aggressor of the trade.
remaining_qty The quantity remaining on the order that was executed.
customer_order_ref The ID of the executed order provided by the client.
trade_id A unique ID for the trade generated by the exchange.
timestamp The time at which the trade occurred.

List Fills

List Fills Request

{
  "action": "list_fills",
  "payload": {
    "request_id": "12345"
  }
}

Retrieve a snapshot of your fills from the exchange. Each snapshot emitted as a result will contain the provided request_id.

Field Description
request_id A unique identifier for the request.

Fill Snapshot Message

{
  "m": "fill_snapshot",
  "payload": {
    "request_id": "12345",
    "fill_start_idx": "0",
    "total_fills": "50",
    "num_fills": "10",
    "fills": [...]
  }
}

Fill Snapshot Message

One or more Fill Snapshot objects are emitted from the exchange after a list fills request has been made. Each object contains a fixed number of fills, so the number of fill snapshots emitted will depend on the number of fills.

You have received the entirety of your fills when the number of fills received is equal to the total_fills specified.

Field Description
request_id The request id of the list orders request.
fill_start_index The index of the first order in this message.
total_fills The total number of fills.
num_fills The number of fills in this message.
fills A list of fill objects.

FILL OBJECT

A fill represents a historical record of part or all of an order being executed. At the moment the trade occurs, a trade notification is emitted by the exchange. A single order may be associated to many fills in the event of partial trades.

Fill Object

{
  "timestamp": "1541461093573557000",
  "order_id": "5555",
  "trade_id": "6666",
  "price": "6450",
  "qty": ".01",
  "symbol": "btc-tusd",
  "side": "sell",
  "fee": ".0774"
}
Field Description
timestamp The time at which the fill occurred.
order_id The exchange ID of the order that was filled.
trade_id The ID of this fill generated by the exchange.
price The price at which the fill occurred.
qty The quantity of the fill.
symbol The symbol on which the fill occurred.
side The Side of the book that the order was on when it was filled.
fee The fee charged by the exchange for the trade.

TIMESTAMP

Time since epoch in UTC nanoseconds as uint64

TRADE_ID

The matching engine creates a trade_id upon each match.

PRICE

The weighted average price of the fill. A single order may be filled at multiple price levels. A single fill corresponds to multiple Trade Notifications.

QTY

The total amount filled of the order. If this quantity does not match the original order quantity, the residual has been cancelled.

FEE

The fees incurred by the fill. See Fees up above.

List Total Positions

List Total Positions Message

{
  "action": "list_total_positions",
  "payload": {
    "request_id": "12345"
  }
}

Total positions reflect the sum of available positions and standing orders. Retrieve the current snapshot of your total positions at the exchange. This message also includes the total position in each active warrant. Each snapshot emitted as a result will contain the provided request_id.

Field Description
request_id A unique identifier for the request.

Total Positions Response

{
  "m": "total_position_snapshot",
  "payload": {
    "request_id": "12345",
    "balances": {
      "eth": "4000",
      "btc": "5000"
    }
  }
}

Total Positions Snapshot

Field Description
balances An object detailing the total balance for each currency.
warrants An object detailing the total balance for each warranty and the verage price at which it was acquired.

List Available Positions

List Available Positions Message

{
  "action": "list_available_positions",
  "payload": {
    "request_id": "12345"
  }
}

Available positions reflect the amount that available to place orders. Retrieve the current snapshot of your available positions at the exchange. Each snapshot emitted as a result will contain the provided request_id.

Field Description
request_id A unique identifier for the request.

Available Positions Snapshot

{
  "m":"available_position_snapshot",
  "payload":{
    "request_id":"45169372",
    "balances":{
      "usdt":0.0,
      "btc":0.0,
      "eth":0.0,
      "xrp":0.0,
      "tusd":0.0
    },
    "warrants":{
      "eth190227C152.0":{
        "amount":0.0,
        "avg_price":0.0
        },
      "eth190227P137.0":{
        "amount":0.0,
        "avg_price":0.0
      },
      "btc190301C4126.0":{
        "amount":0.0,
        "avg_price":0.0
      },
      "btc190301P3733.0":{
        "amount":0.0,
        "avg_price":0.0
      },
      "xrp190304C0.32":{
        "amount":0.0,
        "avg_price":0.0
      },
      "xrp190304P0.29":{
        "amount":0.0,
        "avg_price":0.0
      }
    }
  }
}

Available Positions Snapshot

Field Description
balances An object detailing the available balance for each currency.

Get Deposit Address

Get Deposit Address Request

{
  "action": "get_deposit_address",
  "payload": {
    "request_id": "12345",
    "currency": "BTC"
  }
}

Obtain a wallet address that can be used to deposit funds into the exchange.

Field Description
request_id A unique identifier for the request.
currency The asset for which the deposit address is being requested.

CURRENCY

The cyrpto asset for which you would like a deposit address.

Deposit Address Message

{
  "m": "deposit_address",
  "payload": {
    "currency": "btc",
    "wallet_address": "abcdef121",
    "request_id": "12345",
    "response_state": "ack"
  }
}

Deposit Address Message

Field Description
currency The asset being deposited.
wallet_address The destination address that can be used to deposit funds.
request_id The request id from the request to generate the address.
response_state The transfer state of the deposit.

WALLET ADDRESS

Some assets require the paying of a gas fee to successfully send to this address. Ensure that you provide this fee when sending to this address.

Transfer States

State Description
reject The transaction is invalid or aborted.
unknown Default.
pending_new The exchange has received the request but it has not been approved.
new The exchange has received the request and has scheduled it to the network.
transmitted The transaction has been initiated.
mined The transaction has been mined, but waiting on block confirmation requirement.
confirmed The transaction is complete.

Deposit Notification

Deposit Notification Message

{
  "m": "deposit_notification",
  "payload": {
    "currency": "btc",
    "address": "abcdef123456",
    "amount": "5",
    "confirmations": "1",
    "transaction_hash": "12345abcd",
    "transaction_state": "mined"
  }
}

The exchange will emit a Deposit Notification when the state of a deposit changes.

Field Description
currency The asset being deposited.
address The wallet address for the deposit.
amount The quantity being deposited.
confirmations The number of confirmations that have occurred on the network for the transaction.
transaction_hash The hash of the transaction on the network.
transaction_state The transfer state of the deposit.

List Deposits

List Deposits Request

{
  "action": "list_deposits",
  "payload": {
    "request_id": "12345",
  }
}

Returns your deposits via a series of snapshots. Each snapshot in contains a batch of deposits and will contain the provided request_id.

Deposit Snapshot Message

{
  "m": "deposit_snapshot",
  "payload": {
    "request_id": "12345",
    "deposit_start_index": "5",
    "total_deposits": "10",
    "num_deposits": "1",
    "deposits": [...]
  }
}

Deposit Snapshot Message

One or more Deposit Snapshot objects are emitted from the exchange after a list deposit request has been made. Each object contains a fixed number of deposits, so the number of deposit snapshots emitted will depend upon how many deposits have been executed on your account.

You have received the entirety of your deposits when the number of deposits received is equal to the total_deposits specified.

Field Description
request_id The request id of the list deposits request.
deposit_start_index The index of the first deposit in this message.
total_deposits The total number of deposits.
num_deposits The number of deposits in the message.
deposits A list of deposit objects.

DEPOSIT OBJECT

Each snapshot contains a list of Deposit objects. These represent the current state of the deposit in the Exchange.

Deposit Object

{
  "currency": "btc",
  "confirmations": "2",
  "amount": "3",
  "timestamp": "4",
  "transact_state": "confirmed",
  "wallet_address": "some-address",
  "transaction_hash": "12345abcdef"
}
Field Description
currency The asset being deposited.
confirmations The number of confirmations for the deposit that have occurred.
amount The amount of the deposit.
timestamp The time at which the deposit occurred.
transact_state The transfer state of the deposit.
wallet_address The address to which funds were deposited.
transaction_hash The hash of the transaction on the network.

Create Withdrawal

Create Withdrawal Request

{
  "action": "create_withdrawal",
  "payload": {
    "currency": "btc",
    "wallet_address": "abc1234",
    "amount": "12.5",
    "request_id": "12345"
  }
}

After a create_withdrawal request has been submitted, one or more withdrawal_notification messages will be emitted as a result. Withdrawals may be subject to restrictions based on your account's verification status.

Field Description
currency The asset being withdrawn.
wallet_address The address that will receive the withdrawal.
amount The amount of the withdrawal.
request_id A unique identifier for the request.

Withdrawal Notification

Withdrawal Notification Message

{
  "m": "withdrawal_notification",
  "payload": {
    "request_id": "12345",
    "transact_state": "pending_new" ,
    "currency": "btc",
    "withdrawal_id": "11",
    "confirmations": "2",
    "amount": "12.50",
    "deposit_address": "abcdef12345",
    "transaction_hash": "12345abcdef"
  }
}

A Withdrawal Notification is emitted down the account websocket by the exchange when the state of a withdrawal changes.

Field Description
request_id A unique identifier for the request.
transact_state The transfer state of the withdrawal.
currency The asset being withdrawn.
withdrawal_id A unique ID for the withdrawal generated by the exchange.
confirmations The number of confirmations for the transaction that have occurred.
amount The amount of the withdrawal.
deposit_address The address to which the exchange is sending funds.
transaction_hash The hash of the transaction on the network.

List Withdrawals

List Withdrawals Request

{
  "action": "list_withdrawals",
  "payload": {
    "request_id": "12345"
  }
}
Field Description
request_id A unique identifier for the request.

Withdrawal Snapshot Message

{
  "m": "withdrawal_snapshot",'
  "payload": {
    "request_id": "12345",
    "withdrawal_start_index": "5",
    "total_withdrawals": "10",
    "num_withdrawals": "1",
    "withdrawals": [...]
  }
}

Withdrawal Snapshot Message

One or more Withdrawal Snapshot objects are emitted from the exchange after a list withdrawal request has been made. Each object contains a fixed number of withdrawals, so the number of withdrawal snapshots emitted will depend upon how many withdrawals have been executed on your account.

You have received the entirety of your withdrawals when the number of withdrawals received is equal to the total_withdrawals specified.

Field Description
request_id The request id of the list withdrawals request.
withdrawal_start_index The index of the first withdrawal in this message.
total_withdrawals The total number of withdrawals.
num_withdrawals The number of withdrawals in the message.
withdrawals A list of withdrawal objects.

WITHDRAWAL OBJECT

Each snapshot contains a list of Withdrawal objects. These represent the current state of the withdrawal in the Exchange.

Withdrawal Object

{
  "currency": "btc",
  "confirmations": "2",
  "amount": "3",
  "timestamp": "4",
  "transact_state": "confirmed",
  "wallet_address": "some-address",
  "transaction_hash": "12345abcdef"
}
Field Description
currency The asset being withdrawn.
confirmations The number of confirmations for the withdrawal that have occurred.
amount The amount of the withdrawal.
timestamp The time at which the withdrawal occurred.
transact_state The transfer state of the withdrawal.
wallet_address The address to which funds were withdrawn.
transaction_hash The hash of the transaction on the network.

Market Data Websocket

The market data websocket endpoint provides a websocket connection so that events can be emitted to api clients. Once connected, a client can send messages on the websocket to subscribe an unsubscribe to market data for specific pairs.

Via websocket, the highest granularity market data available is Level 2 (price levels and aggregate quantities).

Connect

The market data websocket is available at: wss://iris.lxdx-svcs.net/v1/orderbook.

Subscribe

Subscribe Message

{
  "action": "subscribe",
  "products": ["btc-tusd"],
  "feeds": ["snapshot"]
}

After a connection has been established, a client can send one or more subscribe messages to receive market data for various product at various granularities.

Field Description
action subscribe
products List of product to subscribe to. The values must be present in the products, warrants, or indices endpoints.
feeds List of feeds to subscribe to.

For Index subscriptions, only the snapshot feed is available. This subscription will emit the current price of the index as a index price object.

Example Subscription

Example Subscription

var ws = new WebSocket('wss://iris.lxdx-svcs.net/v1/orderbook');
var msgCount = 0;
var maxMsgCount = 30;

ws.onopen = function(event) {
  ws.send(JSON.stringify({
  "action": "subscribe",
  "products": [
    "btc-tusd",
    "ld-btc"
  ],
  "feeds": ["snapshot"]
  }));
};

ws.onmessage = function(event) {
  console.log(event.data);
  msgCount = msgCount + 1;

  if (msgCount >= maxMsgCount) {
    console.log('max messages received; disconnecting');
    ws.close();
  }
}

The example javascript subscription on the left can be pasted directly into your browser console. Upon connection, this will subscribe to two snapshot feeds; one for the btc-tusd product, and one for the ld-btc index.

FEEDS

Feeds dictate what events are sent to the clients for the given subscription. The specific feed(s) needed by each client will depend upon their use case.

Feed Description
snapshot Only sends snapshot events.
volume Only sends volume events.
update Only sends update events.
all Sends snapshot, volume, and update events.
incremental(default) Sends one snapshot event, followed by all volume and update events.

Unsubscribe

Unsubscribe Message

{
  "action": "unsubscribe",
  "products": ["btc-tusd"],
  "feeds": ["snapshot"]
}
Field Description
action unsubscribe
products List of product to which to unsubscribe.
feeds List of feeds to which to unsubscribe.

Errors

General Error Message

{
  "m": "e"
  "message":  "invalid message"
}

Error messages are denoted by a message type of e. Specific requests may provide more granular error messages.

Volume Candle Data

Historical price and volume data for a given pair can be requested with this message. The API will return up to 300 candles per request.

Fetch Candles Message

{
  "action": "fetch_candles",
  "product": "btc-tusd",
  "interval": "1m",
  "start": "1234567989",
  "end": "9823598135"
}

Field Description
action fetch_candles
product Pair to retrieve candle data for
interval The time interval per candle. Valid values are 1m, 5m, 10m, and 1d,

Volume Candle Object

Volume Candle Object

{
  "p": "btc-tusd",
  "candles": [
    {
      "high": 55,
      "low": 32,
      "open": 41,
      "close": 50,
      "volume": 521.2,
      "time": 136135135
    }
  ]
}
Field Description
high The highest price during the candle
low The lowest price during the candle
open The opening price of the candle
close The closing price of the candle
volume The quantity traded during the candle.

Index Candle Data

Fetch Index Candles Message

{
  "action": "fetch_index_candles",
  "product": "ld-btc",
  "interval": "1m",
  "start": "1234567989",
  "end": "9823598135"
}
Field Description
action fetch_index_candles
product Index to retrieve candle data for
interval The time interval per candle. Valid values are 1m, 5m, 10m, and 1d,

Index Candle Object

Index Candle Object

{
  "p": "btc-tusd",
  "candles": [
    {
      "high": 55,
      "low": 32,
      "open": 41,
      "close": 50,
      "time": 136135135
    }
  ]
}
Field Description
high The highest price during the candle
low The lowest price during the candle
open The opening price of the candle
close The closing price of the candle

The Snapshot Object

Snapshot Object

{
  "m": "s",
  "p": "btc-tusd",
  "t": "1542754793988206707",
  "s": 1,
  "b": [
    {"px": 4, "qty": 6},
    {"px": 2, "qty": 3},
    {"px": 1, "qty": 1}
  ],
  "a": [
    {"px": 5, "qty": 3},
    {"px": 6, "qty": 1},
    {"px": 9, "qty": 4}
  ]
}

Contains the entire current state of the order book. The message also contains a sequence number field which matches the sequence number for the most recently published update.

Field Description
m Message Type.
p Product
t Timestamp of last update to the book. Provided as nanoseconds since unix epoch.
s Sequence Number
b A list of bid levels. px denotes the level's price, qty denotes the quantity available for the level.
a A list of ask levels. px denotes the level's price, qty denotes the quantity available for the level.

The Update Object

Update Object

{
  "m": "u",
  "p": "btc-tusd",
  "t": "1542754793988206707",
  "s": 2,
  "b": [
    {"px": 4, "qty": 0 }
  ],
  "a": [
    {"px": 5, "qty": 1 }
  ]
}

Contains only price points that have changed since the last message. A client can use the values in this message to overwrite any previous data for the given prices.

In the example here, the client's trading application should delete entirely the bids at the price of 4. The best bid is now for a price of 3. The best offer has had its size reduced from a size of 3 to a size of 1.

Updates are not emitted if no changes have occurred, and the sequence number is incremented whenever an update is published.

Field Description
m Message Type.
p Product
t Timestamp of last update. Provided as nanoseconds since unix epoch.
s Sequence Number
b A list of bid levels. px denotes the level's price, qty denotes the quantity available for the level.
a A list of ask levels. px denotes the level's price, qty denotes the quantity available for the level.

The Volume Event Object

Volume Event Object

{
  "m": "v",
  "p": "btc-tusd",
  "events": [{
    "t": "1541461093573557000",
    "s": "sell",
    "px": 4,
    "qty": 1
  }]
}

This message contains information about trades that have been executed since the last publication.

Field Description
m Message Type
p Product
events A list of Volume Events
events.t Timestamp for the trade.
events.s Aggressor for the trade.
events.px Price of the trade.
events.qty Quantity of the trade.

The Index Price Object

Index Price Object

{
  "m": "i",
  "p": "ld-btc",
  "px": 55.24,
  "t": 35135431134
}

This message contains the current price of the given index.

Field Description
m Message Type
p Product
px The current price
t The timestamp for the price

HTTP Requests

Errors

Unless otherwise noted, invalid requests will respond with HTTP 4xx or similar status codes.

The LXDX API uses the following error codes:

Error Code Meaning
400 Bad Request -- Invalid Request.
401 Unauthorized -- Invalid API key.
403 Forbidden.
404 Not Found -- The specified resource could not be found.
429 Too Many Requests.
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Exchange Unavailable -- We're temporarily offline for maintenance. Please try again later.

Submit Order

Orders can only be placed if your account has the necessary funds. Upon order placement, your account funds will be put on lock for the duration of the order. The amount of the lock depends on the price and quantity of the order. See Locks.

A successful request will result in an order response being emitted on the account websocket.

HTTP Request

POST https://api.lxdx-svcs.net/v1/orders

POST https://api.lxdx-svcs.net/v1/orders

{
  "price": "3500",
  "qty": "0.1",
  "symbol": "btc-tusd",
  "side": "buy",
  "time_in_force": "IOC",
  "customer_order_ref": "42069",
  "type": "limit",
  "post_only": "true"
}

PARAMETERS

Field Description
price Price of the order.
qty Quantity of the order.
symbol Symbol of the order.
side Side of the order buy or sell.
time_in_force [optional] Time-in-Force of the order. Default is DAY.
customer_order_ref [optional] Client-provided ID of the order.
type [optional] Message type limit or market. Default is limit.
post_only [optional] Whether the order should only provide liquidity. Default is false.

PRICE

Prices are specified as string escaped and must be in accordance to the product's tick increment. Prices are additionally subject to minimum and maximum prices.

Note that all products have tick increments denoted in TUSD (True USD) except the product tusd-usdt which has a tick increment denoted in USDT (Tether).

Product Tick Increment Minimum Price Maximum Price
btc-tusd 1 -20% +20%
eth-tusd 0.1 -30% +30%
xrp-tusd 0.01 -30% +30%
tusd-usdt 0.01 -20% +20%

PRICE BANDS

Price bands are set as the maximum movement for a product during the day's session. All price bands are computed relative to the previous session's Close.

QTY

Specifies the quantity of the order. Order quantities are subject to minimum and maximum values as detailed below:

Product Minimum Order Size Maximum Order Size
btc-tusd 0.001 999
eth-tusd 0.01 9,999
xrp-tusd 1 99,999
tusd-usdt 0.01 999,999

All order quantities must be a multiple of the product's minimum order size.

SYMBOL

The symbol must match a valid exchange product. See Products.

SIDE

The side value must match "buy" for buy orders or "sell" for orders.

Value Description
buy Bids, Buys
sell Asks, Sells

TIME IN FORCE

Time-in-Force describes the life of an order. The Day session begins 16:00 UTC and ends the following day at 15:00 UTC. Orders with the a time-in-force of GTD are cancelled upon close at the end of the session.

Value Description
GTC Good Until Canceled
DAY Good For Day
IOC Immediate or Cancel

CUSTOMER_ORDER_REF

The customer order reference should be generated by your trading application.

This ID should be a unique unsigned integer.

TYPE

The type of the order must match "limit" for limit orders and "market" for markets orders.

Value Description
limit Limit Order
market Market Orders

POST ONLY

The post-only flag indicates that the order should act only as a maker order. If any part of the order would lead to taking liquidity, the entire order is rejected.

Value Description
true Order will only act as a maker (and receive maker rebate)
false Order may taker (and pay taker fees)

LOCKS

The size of the lock is dependent on the denominator asset (by default TUSD) for buy orders and the numerator asset for sell orders.

For example, when purchasing eth-tusd, the purchaser will have price x size x (1 + fee-percent) TUSD locked.

In the above example, the seller simply has the size of ETH offered locked.

When orders are cancelled, the remaining funds of the partially filled or unfilled order are released from lock.

Cancel Order

To cancel a previously placed order, specify the order_id. A successful request will result in a cancel order message being emitted on the account websocket.

HTTP Request

POST https://api.lxdx-svcs.net/v1/orders/cancel

POST https://api.lxdx-svcs.net/v1/orders/cancel

{
  "order_id": "12345",
  "request_id": "1234",
  "symbol": "btc-tusd"
}

Field Description
order_id The exchange order_id of the order to cancel.
request_id A unique identifier for the request.
symbol The product symbol of the original order.

ORDER_ID

The internal order id provided by the exchange core.

SYMBOL

The symbol of the original order. This field is required.

List Orders

Returns all of your current open orders via a series of order snapshots. Each order snapshot contains a batch of open orders and will contain the provided request_id. A successful request will result in an order snapshot being emitted on the account websocket.

HTTP Request

POST https://api.lxdx-svcs.net/v1/snapshots/orders

POST https://api.lxdx-svcs.net/v1/snapshots/orders

{
  "request_id": "12345"
}
Field Description
request_id A unique identifier for the request.

List Fills

Retrieve a snapshot of your fills from the exchange. Each snapshot emitted as a result will contain the provided request_id. A successful request will result in a fill snapshot being emitted on the account websocket.

HTTP Request

POST https://api.lxdx-svcs.net/v1/snapshots/fills

POST https://api.lxdx-svcs.net/v1/snapshots/fills

{
  "request_id": "12345"
}
Field Description
request_id A unique identifier for the request.

List Positions

Available positions reflect the amount that available to place orders. Total positions reflect the sum of available positions and standing orders.

POST https://api.lxdx-svcs.net/v1/snapshots/positions/available

POST https://api.lxdx-svcs.net/v1/snapshots/positions/total

{
  "request_id": "12345"
}

Available Positions

A successful request will result in an available positions snapshot being emitted on the account websocket.

POST https://api.lxdx-svcs.net/v1/snapshots/positions/available

Total Positions

A successful request will result in an total positions snapshot being emitted on the account websocket.

POST https://api.lxdx-svcs.net/v1/snapshots/positions/total

Get Deposit Address

Obtain a wallet address that can be used to deposit funds into the exchange. A successful request will result in a deposit address message being emitted on the account websocket.

HTTP Request

POST https://api.lxdx-svcs.net/v1/transactions/deposit

POST https://api.lxdx-svcs.net/v1/transactions/deposit

{
  "request_id": "12345",
  "currency": "BTC"
}
Field Description
request_id A unique identifier for the request.
currency The asset for which the deposit address is being requested.

CURRENCY

The cyrpto asset for which you would like a deposit address.

List Deposits

Requests your deposits via a series of snapshots. A successful request will result in one or more deposit snapshot messages being emitted on the account websocket. Each snapshot in contains a batch of deposits and will contain the provided request_id.

HTTP Request

POST https://api.lxdx-svcs.net/v1/snapshots/deposits

POST https://api.lxdx-svcs.net/v1/snapshots/deposits

{
  "request_id": "12345"
}
Field Description
request_id A unique identifier for the request.

List Withdrawals

Returns your withdrawals via a series of snapshots. A successful request will result in one or more withdrawal snapshot messages being emitted on the account websocket. Each snapshot in contains a batch of withdrawals and will contain the provided request_id.

HTTP Request

POST https://api.lxdx-svcs.net/v1/snapshots/withdrawals

POST https://api.lxdx-svcs.net/v1/snapshots/withdrawals

{
  "request_id": "12345"
}
Field Description
request_id A unique identifier for the request.