NAV

WebSocket API

Overview

WebSocket is a new HTML5 protocol that achieves full-duplex data transmission between the client and server, allowing data to be transferred effectively in both directions. A connection between the client and server can be established with just one handshake. The server will then be able to push data to the client according to preset rules. Its advantages include:

Connect

Connenction instruction: Connection limit: 1 request per second When subscribing to a public channel, use the address of the public service. When subscribing to a private channel, use the address of the private service

URLs: The url to connect to our websocket stream is: production: wss://api.yourexchange.com/streams

Login

Request Example (Using Bearer Token)

    {
        "method": "login",
        "token": "your_bearer_token"
    }

Rate Limit: 1 request per second

Request parameters

Request Example (Using API Keys)


    {
        "method": "login",
        "api": {
            "public_key": "api-public-key",
            "timestamp": 1608028160
        },
        "hmac": "computed-hmac-of-only-api-object"
    }

Parameter Type Required Description
method String Yes Operation, login
api Object Yes contains public key and epoch timestamp
> public_key String Yes Public Key
> timestamp Long Yes Unix Epoch time, the unit is seconds
> hmac String Yes Signature string

Response

Response

    {
        "method":"login",
        "status":"WS_SUCCESS"
    }

Parameter Type Description
method String login
status String success or failed
message String Server Response

HMAC

Timestamp: the Unix Epoch time, the unit is seconds e.g. 1661519941

SecretKey: The security key generated when the user applies for API Key, e.g. : 5a300eea-9436-49e8-ac78-b1f0b7e06773

hmac: signature string, the signature algorithm is as follows:

Subscribe

Subscription Instructions

Request format

      {
         "method":"subscribe",
         "channels":[
            "<SubscriptionTopic>"
         ]
      }

WebSocket channels are divided into two categories: public and private channels.

Public channels-- No authentication is required, includes tickers channel, K-Line channel, and orderbook channel etc.

Private channels -- Login is required, includes order channel, and balance channel.

Users can choose to subscribe to one or more channels, and the total length of multiple channels cannot exceed 1024 bytes.

Request parameters

Request Example

      {
         "method":"subscribe",
         "channels":[
            "tickers",
            "orders.ALL"
         ]
      }
Parameter Type Required Description
method String Yes subscribe
channels Array Yes List of subscribed channels

Return parameters

Response Example

{
         "method":"subscribe",
         "response":[
            {
               "channel":"tickers",
               "status":"WS_SUBSCRIBED"
            },
            {
               "channel":"orders.ALL",
               "status":"error"
            }
         ]
      }

Parameter Type Description
method String subscribe
response Array List of subscribed channels
> channel String Channel name
> status String Status code
> message String Error message

Unsubscribe

Request format

  {
         "method":"unsubscribe",
         "channels":[
          "<SubscriptionTopic>"
         ]
      }

Unsubscribe from one or more channels.

Request parameters

Request Example

      {
         "method":"unsubscribe",
         "channels":[
            "tickers",
            "orders.ALL"
         ]
      }

Parameter Type Required Description
method String Yes unsubscribe
channels Array Yes List of channels to unsubscribe from

Return parameters

Response Example

      {
         "method":"unsubscribe",
         "response":[
            {
               "channel":"tickers",
               "status":"success"
            },
            {
               "channel":"orders.ALL",
               "status":"error",
            }
         ]
      }

Parameter Type Description
method String unsubscribe
response Array List of unsubscribed channels
> channel String Channel name
> status String Status code
> message String Server Response

Private channel

Private channel methods require authentication.

Balance channel

Retrieve account balance and position information. Data will be pushed when triggered by events such as filled order, funding transfer.

Request Example

         {
            "channels":[
               "wallets"
            ],
            "method":"subscribe"
         }

Request parameters

Parameter Type Required Description
method String Yes subscribe
channels Array Yes Channel name, wallet

Response

Response Example

      {
         "method":"stream",
         "channel":"wallets",
         "data":[
            {
               "BTC":[
                  10219,
                  6
               ],
               "ETH":[
                  10015,
                  0
               ],
               "TRDFY":[
                  0,
                  0
               ],
               "USD":[
                  935.56,
                  31
               ]
            }
         ]
      }
Parameter Type Description
method String stream
channel String Channel name, wallet
data Array
> data[0] Decimal Cash Balance
> data[1] Decimal Frozen Balance

Order channel

Retrieve order information. Data will not be pushed when first subscribed. Data will only be pushed when triggered by events such as placing/canceling order.

Request Example

         {
            "channels":[
               "orders.ALL"
            ],
            "method":"subscribe"
         }

Request parameters

Parameter Type Required Description
method String Yes subscribe
channels Array Yes Channel name, orders.ALL

Response

Response Example

{
   "method":"stream",
   "event":"orders.ALL",
   "data":[
    [
        47106267,
        497519,
        "BTC_USDT",
        62982.92,
        0.0001,
        0.0001,
        2,
        2,
        0,
        1713356878402,
        true,
        0,
        0,
        0,
        0,
        0
    ],
    [
        47106266,
        497519,
        "BTC_USDT",
        0,
        1,
        1,
        8,
        1,
        62876.94112,
        1713356787265,
        true,
        0.00628795,
        0,
        0.00628795,
        1,
        0
    ]
  ]
}
Parameter Type Description
method String stream
channel String Channel name, orders.ALL
data Array Subscribed data
> data[0] decimal Order Id
> data[1] decimal User Id
> data[2] String Symbol BTC_USD
> data[3] decimal Price
> data[4] decimal Size
> data[5] decimal Remaining Size
> data[6] Integer Order type
1: Market
2: Limit (Good Till Cancelled)
3: Stop Market
4: Stop Limit
5: Day Only
6: Fill or Kill
7: Immediate or Cancel
8: Trailing Stop
> data[7] Integer Order side, 1:Buy, 2:Sell
> data[8] decimal Stop Price
> data[9] String Timestamp (milliseconds)
> data[10] boolean true if order is open
> data[11] decimal Quote amount frozen (applicable on for Quote orders)
> data[12] string Stop order activation timestamp (milliseconds)
> data[13] decimal Initial Quote amount (applicable on for Quote orders)
> data[14] decimal Trail amount (in Quote asset, applicable on for Trailing orders)
> data[15] decimal Trail percent (in % terms, applicable on for Trailing orders)

Trades channel

Pushes trades where your buy/sell orders have matched with a counterparty. Data will not be pushed when first subscribed. Data will only be pushed when triggered by new order match event.

Request Example

         {
            "channels":[
               "my-trades.BTC_USDT"
            ],
            "method":"subscribe"
         }

Request parameters

Parameter Type Required Description
method String Yes subscribe
channels Array Yes Channel name, my-trades.BTC_USDT

Response

Response Example

{
   "method":"stream",
   "event":"my-trades.BTC_USDT",
   "data":[
      [
         "b7512911-5e90-4f8c-b3a6-6d12a5f82a9f",
         44240783,
         "BTC_USDT",
         0.01,
         8000.0,
         80.0
         0,
         1,
         1695901614730,
         2
      ],
      [
         "b7612911-5e90-4f8c-b3a6-6d12a5f82a9f",
         44240784,
         "BTC_USDT",
         0.01,
         8100.0,
         81.0
         0,
         2,
         1695901614830,
         1
      ],

   ]
}
Parameter Type Description
method String stream
channel String Channel name, my-trades.BTC_USDT
data Array Subscribed data
> data[0] string Trade Id
> data[1] Integer Order Id
> data[2] String Symbol BTC_USDT
> data[3] decimal Executed Size
> data[4] decimal Execution Price
> data[5] decimal Total (Price * Size)
> data[6] decimal Fee
> data[7] Integer Order side, 1:Buy, 2:Sell
> data[9] String Timestamp in (ms)
> data[7] Integer Execution side, 1:Buying, 2:Selling

Public channel

Tickers channel

Retrieve the last traded price, bid price, ask price and 24-hour trading volume of instruments. Data will be pushed every 100 ms when there are updates.

Request Example

      {
         "channels":["tickers"],
         "method":"subscribe"
      }

Request parameters

Parameter Type Required Description
method String Yes subscribe
channels Array Yes Channels name, tickers

Response

Response Example

{
   "method":"stream",
   "event":"tickers",
   "data":[
      [
         "BTC_USD",
         11.00000000,
         0,
         1088,
         100.00000000,
         11.00000000
      ]
   ]
}
Parameter Type Description
method String stream
channel String Channel name, tickers
data Array Subscribed data
> data[0] String Symbol BTC_USD
> data[1] decimal Price
> data[2] decimal Change %
> data[3] decimal Base volume
> data[4] decimal Quote volume
> data[5] decimal 24hr high
> data[6] decimal 24hr low
> data[7] int Execution side, 1:Buy, 2:Sell

Books channel

Retrieve order book data.

Request Example

{
    "channels":["books.BTC_USDT"],
    "method":"subscribe"
}

Request parameters

Parameter Type Required Description
method String Yes subscribe
channels Array Yes Channels name, books.BTC_USDT

Response

Response Example

{
   "method":"stream",
   "channel":"books.BTC_USD",
   "data":[
      [
         [
            10.00000000,
            2.00000000
         ],
         [
            11.00000000,
            2.00000000
         ]
      ],
      [
         [
            18.00000000,
            6.00000000
         ]
      ]
   ]
}
Parameter Type Description
method String stream
channel String Channels name, books.BTC_USDT
data Array Subscribed data
> data[0] Array Bids [price, size] => [decimal, decimal]
> data[1] Array Asks [price, size] => [decimal, decimal]

Trades channel

Retrieve the recent trades data. Data will be pushed whenever there is a trade. Every update contain only one trade.

Request Example

{
         "channels":["trades.BTC_USD"],
         "method":"subscribe"
      }

Request parameters

Parameter Type Required Description
method String Yes subscribe
channels Array Yes Channels name, trades.BTC_USD

Response

Response Example

{
   "method":"stream",
   "channel":"trades.BTC_USD",
   "data":[
      [
         1658986843,
         11.00000000,
         3.00000000,
         1,
         "2022-07-28T05:40:43.053Z"
      ],
      [
         1658986838,
         11.00000000,
         3.00000000,
         2,
         "2022-07-28T05:40:38.529Z"
      ],
      [
         1658986773,
         11.00000000,
         1.00000000,
         2,
         "2022-07-28T05:39:33.635Z"
      ],
      [
         1658917150,
         100.00000000,
         10.00000000,
         2,
         "2022-07-27T10:19:10Z"
      ],
      [
         1658905225,
         11.00000000,
         1.00000000,
         1,
         "2022-07-27T07:00:25Z"
      ]
   ]
}
Parameter Type Description
method String stream
channel String Channels name, trades.BTC_USD
data Array Subscribed data
> data[0] decimal Order Id
> data[1] decimal Price
> data[2] decimal Size
> data[3] Integer Execution side, 1:Buy, 2:Sell
> data[4] String Timestamp (ms)

Kline channel

Retrieve the chart data of an instrument. the push frequency is the fastest interval 500ms push the data.

Request Example

{
         "channels":["kline.BTC_USD.1"],
         "method":"subscribe"
      }

Request parameters

Parameter Type Required Description
method String Yes subscribe
channels Array Yes Channels name, kline.BTC_USD.1

Response

Response Example

{
   "method":"stream",
   "channel":"kline.BTC_USD.1",
   "data":[
      [
         11.00000000,
         11.00000000,
         11.00000000,
         11.00000000,
         0.00000000,
         1659070860000
      ]
   ]
}
Parameter Type Description
method String stream
channel String Channels name, kline.BTC_USD.1
data Array Subscribed data
> data[0] decimal Open
> data[1] decimal High
> data[2] decimal Low
> data[3] decimal Close
> data[4] decimal Volume
> data[5] decimal Time

REST API

Introduction

The REST API provides developers with 24x7 programmatic access to our trading backend that allow you to:

Get your account’s balance for all assets Get all tradable symbols Get your account history Execute trades and more

URLs: The url to connect to our REST endpoints is: production: https://api.yourexchange.com

Authentication

Generating an API Key

For security reasons, IP whitelisting is required to consume APIs. Head over to Spot Exchange > Settings > API Keys page.

The system returns randomly-generated public-key and private-key. We cannot recover your private key if you have lost it. You will need to create a new key pair.

Making Requests

All private REST requests must contain the following headers:

Request bodies should have content type application/json and be in valid JSON format

Signature

The x-signature header is generated as follows:

The timestamp value is the same as the x-timestamp header.

The request method should be in UPPERCASE: e.g. GET and POST.

The requestPath is the path of requesting an endpoint.

Example: /lp/v1/order-history

The body refers to the String of the request body. It can be omitted if there is no request body (i.e. for GET requests). Example: {"side":1,"symbol":"BTC_USD","type":2,"size":15,"price":10}

The PrivateKey is generated when you create an API key pair, for e.g. 318c2575-f2cb-44f5-8281-23176d6917e1

Trade

All Trade API endpoints require authentication.

New order

You can place an order only if you have sufficient funds.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/new-order

Request Example

{  
    "side": 1,
    "symbol": "ETH_USD",
    "type": 2,
    "size": 0.3, // 0.3 ETH order
    "price": 1500
}
{  
    "side": 1,
    "symbol": "ETH_USD",
    "type": 2,
    "quote_amount": 100, // 100 USD order
    "price": 1500
}

Request parameters

Parameter Type Required Description
side Integer Yes Order side, 1:Buy, 2:Sell
symbol String Yes Symbol, e.g. BTC_USD
type Integer Yes Order type
1: Market
2: Limit (Good Till Cancelled)
3: Stop Market
4: Stop Limit
5: Day Only
6: Fill or Kill
7: Immediate or Cancel
8: Trailing Stop
size Decimal Yes Quantity (in base) to buy or sell
quote_amount Decimal No Amount (in quote) to spend for buying or selling
price Decimal Yes Order price. Not applicable for market stop-market trailing-stop type orders.
stop Decimal No Stop price. Applicable for market & stop-market only.
trail_amt Decimal No Trail amount (in Quote). Applicable for trailing-stop type order only.
trail_perc Int No Trail by Percentage (e.g 10%). Applicable for trailing-stop type order only.
client_order_id string No Third party reference number to be associate to an order.

Response

Response Example

{
    "order_id": 47107268,
    "side": "BUY",
    "side_enum": 1,
    "order_type": 8,
    "size": 0.01,
    "filled": 0.00,
    "remaining": 0.01,
    "price": 0,
    "filled_price": 0,
    "symbol": "ETH_USD",
    "ts": 1713361721055
}
Parameter Type Description
order_id Integer Order Id
side String Order side, Buy Sell
order_type String Order type
size Decimal Quantity to buy or sell
filled Decimal Filled Size
remaining Decimal Remaining Size
price Decimal Order price.
filled_price Decimal Filled Price
symbol string Symbol, e.g. BTC_USD
ts Integer Order acceptance timestamp, e.g. 1693896261005.

Edit orders

You can update several open orders.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/update-orders

Request Example

{
    "symbol": "ETH_USD",
    "orders": [
        {
            "size": 0.03,
            "price": 1651,
            "orderId": 43652720
        },
        {
            "size": 0.04,
            "price": 1650,
            "orderId": 43652719
        }
    ]
}

Request parameters

Parameter Type Required Description
symbol String Yes Symbol, e.g. BTC_USD
orders Array Yes order objects
> order_id Integer Yes Order Id
> size Decimal Yes New quantity you wish to set
> price Decimal Yes New limit price you wish to set

Response

Response Example

{
  "Code": 1000,
  "Message": "SUCCESS"
}

Cancel order

Cancel an open order.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/cancel-order

Request Example

{
    "symbol": "BTC_USDT",
    "order_id": 1018

}

Request parameters

Parameter Type Description
symbol String Symbol, e.g. BTC_USD
order_id Integer Order Id

Response

Error Response Example

{
  "status": "Success",
  "message": "SUCCESS",
}

Parameter Type Description
Status String Status of the request execution
Message String Error Code

Trades

Retrieve the completed trade history.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/trades

Request Example

{
    "symbol": "BTC_USD",
    "order_id": 111,
    "row_count": 1000
}

Request parameters

Parameter Type Required Description
symbol String Yes Symbol, e.g. BTC_USD
order_id Long No Your buy/sell order's order-id, e.g. 10202022. Only matching trades are returned when order-id is passed. e.g. when 1002 is passed, all trades where order-id is >= 1002 are returned.
row_count Integer No Number of rows (aka trades) to return. The maximum/default is 1000;

Response

Response Example

[
  {
    "trade_id": "cblp3rgtefqs73fepir0",
    "order_id": 45,
    "symbol": "BTC_USD",
    "size": 2,
    "price": 10,
    "total": 20,
    "fee": 0.0049995,
    "side": 1,
    "ts": "2022-08-04T09:31:27Z"
  },
  {
    "trade_id": "cblp3rgtefqs73fepiqg",
    "order_id": 43,
    "symbol": "BTC_USD",
    "size": 1,
    "price": 11,
    "total": 11,
    "fee": 0.00249975,
    "side": 1,
    "ts": "2022-08-04T09:31:27Z"
  }
]

Parameter Type Description
trade_id String Trade Id
order_id Integer Order Id
symbol String Symbol, e.g. BTC_USD
size Decimal Executed size
price Decimal Execution Price
total Decimal Executed Amount
fee Decimal Fee (maker/taker)
ts Integer Execution timestamp (ms) 1693896261005.
side Integer Execution side, 1:Buy 2:Sell

Orders

Retrieve the order history.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/orders

Request parameters

Request Example

{
    "side": 2,
    "symbol": "BTC_USD",
    "order_id": 111,
    "row_count": 1000
}
Parameter Type Required Description
symbol String Yes Symbol, e.g. BTC_USD
side Integer Yes Order side, 1:Buy 2:Sell
order_id Integer No Your buy/sell order's order-id, e.g. 10202022. Only matching orders are returned when order-id is passed. e.g. when 1002 is passed, all rows where order-id is >= 1002 are returned.
open_orders Boolean No A flag to return active/open orders, default:false. When true is passed, only open orders are returned.
row_count Integer No Number of rows (aka orders) to return. The maximum/default is 1000;

Response

Response Example

[
    {
        "order_id": 47105676,
        "symbol": "BTC_USDT",
        "size": 0.01590433,
        "pending_size": 0.00000000,
        "open_order": false,
        "price": 0.00000000,
        "ts": 1713351084077,
        "side": 2,
        "order_type": 1,
        "quote_amount": 1000.00000000,
        "pending_quote_amount": 0.00028337,
        "stop_price": 0.00000000,
        "ts_activated": null,
        "trail_amount": 0.00000000,
        "trail_percent": 0.00,
        "ts_modified": 1713351084081,
        "order_status": 1,
        "filled_size": 0.01590433,
        "cancelled_size": 0.00000000,
        "client_order_id": null
    }
]

Parameter Type Description
order_id Integer Buy/Sell Order Id
symbol String Symbol, e.g. BTC_USD
size Decimal Initial size
pending_size Decimal Unfilled size
open_order Boolean Is order open? true false
price Decimal Limit Price
ts Integer Order acceptance timestamp, e.g. 1693896261005.
side String Order side, 1: Buy 2: Sell
order_type Integer Order type
1: Market
2: Limit (Good Till Cancelled)
3: Stop Market
4: Stop Limit
5: Day Only
6: Fill or Kill
7: Immediate or Cancel
8: Trailing Stop
quote_amount Decimal Initial quote amount applicable only for quote orders
pending_quote_amount Decimal Unfilled quote amount applicable only for quote orders
stop_price Decimal Stop priceapplicable for stop orders
trail_amount Decimal Trail amount (in Quote). Applicable for trailing-stop type order only.
trail_percent Decimal Trail by Percentage (e.g 10%). Applicable for trailing-stop type order only.
ts_activated Integer Stop order actiation timestamp
ts_modified Integer last modified timestamp, e.g. 1693896261005.
order_status Integer Order status
0: Unfilled (Open)
1: Filled
3: Cancelled
filled_size Decimal Filled size
cancelled_size Decimal Cancelled size
client_order_id String Third party reference number associated to the order.

Order Detail

Retrieves an order and its trades.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/order-detail

Request parameters

Request Example

{
    "order_id": 111
}
Parameter Type Required Description
order_id Integer Yes Your buy/sell order's order-id, e.g. 10202022.

Response

Response Example

{
    "order_id": 47102550,
    "symbol": "BTC_USDT",
    "size": 0.01000000,
    "pending_size": 0.00000000,
    "open_order": false,
    "price": 63062.84985000,
    "ts": 1713350021110,
    "side": 1,
    "order_type": 1,
    "quote_amount": 4953.17290790,
    "pending_quote_amount": 4322.54440940,
    "stop_price": 0.00000000,
    "ts_activated": null,
    "trail_amount": 0.00000000,
    "trail_percent": 0.00,
    "ts_modified": 1713350021125,
    "order_status": 1,
    "filled_size": 0.01000000,
    "cancelled_size": 0,
    "fee": 0.00002760,
    "fee_in": "BTC",
    "trades": [
        {
            "trade_id": "583bc795-ffc4-46aa-a7b7-23f617c83466",
            "size": 0.01000000,
            "price": 63062.84985000,
            "total": 630.62849850,
            "fee": 0.00002760,
            "ts": 1713350021126
        }
    ]
}

Parameter Type Description
order_id Integer Buy/Sell Order Id
symbol String Symbol, e.g. BTC_USD
size Decimal Original Order size
pending_size Decimal Pending size
open_order Boolean Open order, true false
price Decimal Limit Price
ts Integer Order acceptance timestamp, e.g. 1693896261005.
side String Order side, 1: Buy 2: Sell
order_type Integer Order type
1: Market
2: Limit (Good Till Cancelled)
3: Stop Market
4: Stop Limit
5: Day Only
6: Fill or Kill
7: Immediate or Cancel
8: Trailing Stop
quote_amount Decimal Initial quote amount applicable only for quote orders
pending_quote_amount Decimal Unfilled quote amount applicable only for quote orders
stop_price Decimal Stop priceapplicable for stop orders
ts_activated Integer Stop order actiation timestamp
trail_amount Decimal Trail amount (in Quote). Applicable for trailing-stop type order only.
trail_percent Decimal Trail by Percentage (e.g 10%). Applicable for trailing-stop type order only.
ts_modified Integer last modified timestamp, e.g. 1693896261005.
order_status Integer Order status
0: Unfilled (Open)
1: Filled
3: Cancelled
filled_size Decimal Filled size
cancelled_size Decimal Cancelled size
fee Decimal Maker/Taker fee order has paid
fee_in Decimal asset in which fee was charged
trades Array trades recorded for the order
> trade_id string unique id for the trade event
> size Decimal executed size
> price Decimal execution price
> total Decimal execution order total
> fee Decimal fee charged for this execution
> ts Integer trade execution timestamp in ms

Batch orders

Place multiple limit orders (Good till cancelled) in one request . Maximum 50 orders can be placed per request. Request parameters should be passed in the form of an array.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/batch-orders

Request Example

{
    "symbol": "BTC_USD",
    "sell": {
        "cancel_orders": [
            111,
            222
        ],
        "new_orders": [
            [
                "12",
                "6"
            ],
            [
                "13",
                "7"
            ]
        ]
    },
    "buy": {
        "cancel_orders": [
            110,
            220
        ],
        "new_orders": [
            [
                "14",
                "2"
            ],
            [
                "11",
                "3"
            ]
        ]
    }
}

Request parameters

Parameter Type Required Description
symbol String Yes Currency BTC_USDT
sell or buy Object Yes contains new_orders & cancel_orders objects
new_orders Array Yes contains array of new orders as Array of [Size, Price]
cancel_orders Array Yes contains array of order_id to cancel

Response

Response Example

Cancel all orders

Cancels all open orders for a symbol.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/cancel-all-orders

Request Example

{
    "symbol": "BTC_USDT",
    "side": 1
}

Request parameters

Parameter Type Description
side Integer Order side, 1:Buy, 2:Sell
symbol String Symbol, e.g. BTC_USD

Response

Error Response Example

{
  "Code": 1000,
  "Message": "SUCCESS",
}

Parameter Type Description
Code Integer Status of the request execution
Message String Error Code

Wallet

Addresses

Retrieves the list of generated addresses.

HTTP Request

GET {{url}}/lp/v1/addresses

Response Example

{
  "ETH": [
    {
      "network": "Ethereum",
      "address": "0x7ef44B21b95921D1c5fd6b611784b2073491B911",
      "address_tag": ""
    }
  ]
}

Response

Parameter Type Description
network String Blockchain name, e.g. Ethereum
blockchain String Yes Parent Blockchain Ticker, e.g. ETH
address String Address
address_tag String Address Tag is an additional address feature necessary for identifying a transaction recipient beyond a wallet address.

Address

Generates a address for a specefic currency for one or more networks.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/address

Request Example

{
    "asset": "USDT",
    "blockchain": "ETH"
}

Request parameters

Parameter Type Required Description
asset String Yes Currency ETH
blockchain String Yes Blockchain, e.g. ETH

Response

Response Example

{
  "ETH": [
    {
      "network": "Ethereum",
      "blockchain": "ETH",
      "address": "0x7ef44B21b95921D1c5fd6b611784b2073491B911",
      "legacy_address":"",
      "address_tag": ""
    }
  ]
}

Parameter Type Required Description
network String Yes Blockchain name, e.g. Ethereum
blockchain String Yes Parent Blockchain Ticker, e.g. ETH
address String Yes Address
legacy_address String Yes Legacy addresses are the original addresses. You can expect all wallets to support sending and receiving to Legacy addresses.
address_tag String Yes Address Tag is an additional address feature necessary for identifying a transaction recipient beyond a wallet address.

Balance

Retrieves remaining balance, and the amount locked in the trades.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/balance

Request Example

{
    "asset": "BTC",
}

Request parameters

Parameter Type Required Description
asset String Yes Asset BTC

Response

Response Example

[
  {
    "currency": "BTC",
    "balance": 10233.13468976,
    "balance_in_trade": 0
  }
]

Parameter Type Description
asset String Asset BTC
balance Decimal Remaining/Usable balance
balance_in_trade Decimal Funds locked up in trades.

Deposits

Retrieves the deposit records and other relevant information about the deposits

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/deposits

Request Example

{
    "asset": "BTC",
    "from_ts": "19-11-2022 06:23:04",
    "to_ts": "31-01-2023 06:23:04"
}

Request parameters

Parameter Type Required Description
asset String Yes Asset BTC
txn_id String No Transaction Id, used to query a specific transaction
txn_hash String No Transaction Hash, used to query a specific crypto transaction
from_ts String No for paging 2022-07-01
to_ts String No Timestamp for paging 2022-08-01

Response

Response Example

[
  {
    "asset": "ETH",
    "address": "0xbc72B791471fBFE6E2E900e66C85c2010F5aAeE6",
    "amount": 0.5,
    "txn_hash": "0xb618a7373aa27aad07d8ee3ee9de59016ecf4a5908c939677e6239d21e12911f",
    "timestamp": "2022-08-20T06:24:57Z",
    "confirmations": {
      "current": 10,
      "required": 10
    },
    "explorer_url": "https://ropsten.etherscan.io/tx/0xb618a7373aa27aad07d8ee3ee9de59016ecf4a5908c939677e6239d21e12911f",
    "network": "Ethereum",
    "parent": "",
    "internal": true
  }
]

Parameter Type Description
asset String asset ticker
network String Blockchain
parent String Blockchain ticker
address String Deposit address
amount Decimal Deposit amount
txn_hash String Hash record of the deposit
timestamp String Time that the deposit is credited
explorer_url String Explorer URL
confirmations object Transactions on blockchains are not executed as soon as you make the request. You have to wait until the block is completed, locked, and added to the chain.
internal Boolean An internal transfer is an off-chain transfer

Withdrawals

Retrieves the withdrawal records and other relevant information.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/withdrawals

Request Example

{
    "asset": "USDT",
    "from_ts": "09-11-2022 06:23:04",
    "to_ts": "10-01-2023 06:23:04"
}

Request parameters

Parameter Type Required Description
asset String Yes Asset BTC
txn_id String No Transaction Id, used to query a specific transaction
txn_hash String No Transaction Hash, used to query a specific crypto transaction
from_ts String No Timestamp for paging 2022-07-01
to_ts String No Timestamp for paging 2022-08-01

Response

Response Example

[
   {
        "asset": "USDT",
        "address": "TJ7m5YEU3QGKdLVCuPZGTkNea14QfYgfvu",
        "amount": 0.01000000,
        "fee": 5.00005000,
        "txn_hash": null,
        "timestamp": "2023-01-04T07:04:37Z",
        "status": "Rejected",
        "reject_reason": "test",
        "explorer_url": "https://shasta.tronscan.org/#/transaction/",
        "network": "Tron",
        "parent": "TRX",
        "fiat_bank": null,
        "internal": false
    }
]
Parameter Type Description
asset String Assset ticker
network String Blockchain
parent String Blockchain ticker
address String Blockchain payment address
amount Decimal Withdrawal amount
txn_hash String Blockchain Hash for the transaction
internal String An internal transfer is an off-chain transfer
timestamp String Time of the Withdrawal
status String Status of Withdrawal
Pending
Submitted
Rejected
Approved
Processed
reject_reason String Transaction count required for crypto assets
explorer_url String Explorer URL for crypto assets
fiat_bank Object Bank details for fiat assets
fee Decimal Fee

Crypto Withdraw

Retrieves the withdrawal records and other relevant information.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/lp/v1/crypto-withdraw

Request Example

{
    "asset": "USDT",
    "blockchain": "ETH",
    "address": "0x595f1c56eF8A26a33062a8C7Bf831caD37938865",
    "address_tag": "",
    "amount": 0.01,
    "client_ref_id": "0011001"
}

Request parameters

Parameter Type Required Description
asset String Yes Asset USDT
blockchain String Yes Parent Blockchain ETH
address String Yes Withdrawal address
address_tag String Yes Address Tag is an additional address feature necessary for identifying a transaction recipient beyond a wallet address.
amount Decimal Yes Withdrawal amount
client_ref_id String Yes Client's Refer ID

Response

Response Example

[
{
    "Code": 1000,
    "Message": "SUCCESS"
}
]
Parameter Type Description
Code String Code of the request execution
Message String Error Code

Market Data

Symbols

HTTP Request

GET {{url}}/market/symbols

Response Example

[
  {
    "symbol": "BCH_USDT",
    "min_size": "0.000010000000",
    "min_price": "0.010000000000",
    "min_order_total": "10.000000000000",
    "active": true,
    "maker_fee": "0.2500",
    "taker_fee": "0.5000"
  },
  {
    "symbol": "BTC_USD",
    "min_size": "0.000500000000",
    "min_price": "0.000001000000",
    "min_order_total": "15.000000000000",
    "active": true,
    "maker_fee": "0.2500",
    "taker_fee": "0.5000"
  },
  {
    "symbol": "ETH_USD",
    "min_size": "4.000000000000",
    "min_price": "2.000000000000",
    "min_order_total": "8.000000000000",
    "active": true,
    "maker_fee": "0.2500",
    "taker_fee": "0.5000"
  },
  {
    "symbol": "XLM_USDT",
    "min_size": "0.000100000000",
    "min_price": "0.000001000000",
    "min_order_total": "10.000000000000",
    "active": true,
    "maker_fee": "0.2500",
    "taker_fee": "0.5000"
  },
  {
    "symbol": "XRP_USDT",
    "min_size": "0.000100000000",
    "min_price": "0.000010000000",
    "min_order_total": "20.000000000000",
    "active": true,
    "maker_fee": "0.2500",
    "taker_fee": "0.5000"
  }
]

Response

Parameter Type Description
symbol String Symbol e.g.BTC_USD
min_size String Minimum Order Size e.g. 0.001 BTC
min_price String Minimum Order Price e.g.$10
min_order_total String Minimum Order Total Price e.g.$100
active Boolean Active Status
maker_fee String Maker Fee(%)
taker_fee String Taker Fee(%)

Markets

Retrieves the list of supported instruments (aka Trading Pairs).

HTTP Request

GET {{url}}/market/markets/{symbol}

Request parameters

Parameter Type Required Description
symbol String No Symbol, e.g. BTC_USD

Response Example

{
  "XRP_USDT": {
    "last_price": 40,
    "lowest_ask": 120,
    "highest_bid": 100,
    "base_volume": 0,
    "high_24hr": 40,
    "low_24hr": 0
  },
  "BCH_USDT": {
    "last_price": 1,
    "lowest_ask": 0,
    "highest_bid": 0,
    "base_volume": 0,
    "high_24hr": 1,
    "low_24hr": 0
  },
  "XLM_USDT": {
    "last_price": 0.087672,
    "lowest_ask": 0,
    "highest_bid": 0,
    "base_volume": 7747.47631111,
    "high_24hr": 0.082573,
    "low_24hr": 0
  },
  "ETH_USD": {
    "last_price": 100,
    "lowest_ask": 1669,
    "highest_bid": 1665,
    "base_volume": 25.175,
    "high_24hr": 100,
    "low_24hr": 0
  },
  "BTC_USD": {
    "last_price": 24867.48762,
    "lowest_ask": 24913.9891,
    "highest_bid": 24867.48762,
    "base_volume": 0.05,
    "high_24hr": 24913.9891,
    "low_24hr": 0
  }
}

Response

Parameter Type Description
last_price Decimal Last Price of Base Currency
lowest_ask Decimal Lowest Ask
highest_bid Decimal Highest Bid
base_volume Decimal Base Volume
high_24hr Decimal Highest Price in 24hr
low_24hr Decimal Lowest Price in 24hr

Depth

HTTP Request

GET {{url}}/market/depth?symbol={symbol}&limit={limit}

Request parameters

Parameter Type Required Description
symbol String Yes Symbol, e.g. BTC_USD
limit Integer Yes Number of price-points, valid values are:
5  10  20  50  100   500   1000

Response Example

{
  "ts": 1678970255625,
  "bids": [
    [
      24867.48762,
      0.065
    ],
    [
      24867.47763,
      0.0034
    ]
  ],
  "asks": [
    [
      24913.9891,
      0.0456
    ],
    [
      24913.99911,
      0.1506
    ]
  ]
}

Response

Parameter Type Description
ts Integer TimeStamp (ms)
bids Array Buy Order Books
> bids[0][0] Decimal Price
> bids[0][1] Decimal Size
asks Array Sell Order Books
> asks[0][0] Decimal Price
> asks[0][1] Decimal Size

Trades

HTTP Request

GET {{url}}/market/trades/{symbol}

Request parameters

Parameter Type Required Description
symbol String Yes Symbol, e.g. BTC_USD

Response Example

[
  [
    "a592a622-c9e4-4a92-94d9-5893276c8c09",
    24867.48762,
    0.005,
    2,
    1678964309471
  ],
  [
    "0872477f-2124-4928-a847-22e39948f6e0",
    24913.9891,
    0.002,
    1,
    1678963463274
  ],
  [
    "6c8a6b78-511c-4667-89a4-a2b15af42dda",
    24913.9891,
    0.001,
    1,
    1678963274763
  ],
  [
    "c4478a59-45b2-46c7-a159-496b073ba103",
    24792.73797,
    0.001,
    1,
    1678962531622
  ]
]

Response

Parameter Type Description
data Array Subscribed data
> data[0] String Matched Id
> data[1] decimal Price
> data[2] decimal Size
> data[3] Integer Execution side, 1:Buy, 2:Sell
> data[4] Long Timestamp (mx)

Kline

HTTP Request

GET {{url}}/market/charts?base={base}&quote={quote}&ts={ts}&interval={interval}

Request parameters

Parameter Type Required Description
base String Yes Base Currency, e.g. XLM
quote String Yes Quote Currency, e.g. USDT
ts Long Yes Timestamp, e.g. 1678968824498
interval Long Yes Interval (minutes), valid values are:
1  5  15  60  240  1440  10080  43200

Response Example

[
  {
    "time": 1678838400000,
    "open": 0.082573,
    "close": 0.082573,
    "high": 0.082573,
    "low": 0.082573,
    "volume": 0
  },
  {
    "time": 1678752000000,
    "open": 0.082573,
    "close": 0.082573,
    "high": 0.082573,
    "low": 0.082573,
    "volume": 0
  }
]

Response

Parameter Type Description
time Integer Timestamp (mx)
open Decimal Opening Price
close Decimal Closing Price
high Decimal Highest Price
low Decimal Lowest Price
volume Decimal Volume in Base Currency

Swap Tokens

Swap token module is only accessible to Business partners. Not available for regular traders. These API endpoints require authentication.

Estimate Price

Used to estimate the conversion price for swapping an asset to another.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/swap/create

Request Example

{
    "estimate": true,
    "source": {
        "asset": "ETH",
        "blockchain": "",
        "amount": 0.01
    },
    "destination": {
        "asset": "USDT",
        "blockchain": "ETH"
    }
}

Request parameters

Parameter Type Required Description
estimate bool Yes fetch estimated price
true doesn't creates an order.
false creates an order.
source Object Yes specifics of the source asset
> asset string Yes e.g. USDT
> blockchain string No e.g. ETH (required if its a token)
> amount decimal Yes amount you wish to convert, e.g. 0.01
destination Object Yes specifics of the reuired asset
> asset string Yes e.g. ETH
> blockchain string No e.g. ETH (required if its a token)

Response

Response Example

{
    "estimate": true,
    "source": {
        "asset": "ETH",
        "blockchain": "",
        "amount": 1
    },
    "destination": {
        "asset": "USDT",
        "blockchain": "ETH",
        "amount": 1676.290000
    }
}
destination Object
> amount decimal e.g. 0.001 ETH

Create Order

Used to create an order for swapping an asset to another.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/swap/create

Request Example

{
    "estimate": false,
    "source": {
        "asset": "ETH",
        "blockchain": "",
        "amount": 1
    },
    "destination": {
        "asset": "USDT",
        "blockchain": "ETH",
        "address": "0x595f1c56eF8A26a33062a8C7Bf871caD37838863",
        "address_tag": ""
    }
}

Request parameters

Parameter Type Required Description
estimate bool Yes fetch estimated price
true doesn't creates an order.
false creates an order.
source Object Yes specifics of the source asset
> asset string Yes e.g. USDT
> blockchain string No e.g. ETH (required if its a token)
> amount decimal Yes amount you wish to convert, e.g. 0.01
destination Object Yes specifics of the reuired asset
> asset string Yes token that you wish to receive
> blockchain string No blockchain of the receiving token
> address string Yes address where you wish to receive swapped tokens
> address_tag string No DT/Memo value as applicable for a blockchain e.g. XRP, XLM

Response

Response Example

{
    "estimate": false,
    "source": {
        "asset": "ETH",
        "blockchain": "",
        "amount": 1,
        "address": "0x1DE0781941BEf9549539eb7337E1D332C2a2dCeE",
        "address_tag": ""
    },
    "destination": {
        "asset": "USDT",
        "blockchain": "ETH",
        "amount": 1673.040000,
        "address": "0x595f1c56eF8A26a33062a8C7Bf871caD37838863",
        "address_tag": ""
    },
    "status": "Pending",
    "ts": 1698053358382,
    "expiry_ts": 1698053658382,
    "order_guid": "404405fb-991e-4c1e-b72b-46171b6ab751"
}
order_guid string Unique order-id for tracking swap request
ts int Unix timestamp of the swap order request
source Object
> address string address where you'll send your tokens to
> address_tag string DT/Memo value as applicable for a blockchain e.g. XRP, XLM
destination Object
> amount decimal e.g. 1673.04 USDT
expiry_ts int Unix timestamp before customer must deposit funds to source.address
status string Pending : Waiting for payment from the customer
TimedOut : Order is cancelled after expiry_ts has passed
PartialPayment : Customer has sent less payment than source.amount
PaymentReceived : customer's payment is complete, further processing follows.
Converting : Token swapping in progress.
PaymentSent : Converted tokens sent to destination.address, blockchain confirmations awaited.
Paid : Order is complete.

Order Status

Used to query status of an order.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/swap/transactions

Request Example

{
    "from_date": 1696189028000,
    "to_date": 1698694628000,
    "order_guid": ""
}

Request parameters

Parameter Type Required Description
from_date int No Unix timestamp, for date range filter
to_date int No Unix timestamp, for date range filter
order_guid string No bb5f6c38-7155-4b8b-a3b0-705001b96de4;
date range is optional, when order_guid is passed.

Response

Response Example

{
    "estimate": false,
    "source": {
        "asset": "ETH",
        "blockchain": "",
        "amount": 1,
        "address": "0x1DE0781941BEf9549539eb7337E1D332C2a2dCeE",
        "address_tag": ""
    },
    "destination": {
        "asset": "USDT",
        "blockchain": "ETH",
        "amount": 1673.040000,
        "address": "0x595f1c56eF8A26a33062a8C7Bf871caD37838863",
        "address_tag": ""
    },
    "status": "Pending",
    "ts": 1698053358382,
    "expiry_ts": 1698053658382,
    "order_guid": "404405fb-991e-4c1e-b72b-46171b6ab751"
}

Partnerships

Partnerships API are only accessible to Business partners. Not available for regular traders. These API endpoints require authentication.

Addresses

Used to list crypto deposits addresses of a customer.

Rate Limit: 100 requests per 1 minute

HTTP Request

POST {{url}}/partners/addresses

Request Example

{
    "email": "john@yahoo.com",
    "asset": "USDT",
    "blockchain": "ETH"
}

Request parameters

Parameter Type Required Description
email string Yes customer's email address.
asset string Yes e.g. USDT
blockchain string No e.g. ETH (required if its a token)

Response

Response Example

{
    "BNB": [
        {
            "network": "Binance Smart Chain",
            "address": "0x7ef44B21b95921D1c5fd6b611784b2073491B911",
            "blockchain": "BNB",
            "legacy_address": null,
            "address_tag": null
        }
    ],
    "BTC": [
        {
            "network": "Bitcoin",
            "address": "2NDQJsAuX2cVhND5qW8PZ6DCRHk5rXKzMJu",
            "blockchain": "BTC",
            "legacy_address": "mnUF7ryQxXYFokVyzrnnr4Ucn2SkLGJ2Eo",
            "address_tag": ""
        }
    ],
    "ETH": [
        {
            "network": "Ethereum",
            "address": "0xbc72B791471fBFE6E2E900e66C85c2010F5aAeE6",
            "blockchain": "ETH",
            "legacy_address": null,
            "address_tag": null
        }
    ],
    "LTCT": [
        {
            "network": "Litecoin",
            "address": "tltc1qsthrk2wayl57vgrkpks65z7q0zvlhhz7gt78uu",
            "blockchain": "LTCT",
            "legacy_address": null,
            "address_tag": ""
        }
    ],
    "TRX": [
        {
            "network": "Tron",
            "address": "TCkfi3x4sncXXVUEbuLBygaZxKUqVutXzG",
            "blockchain": "TRX",
            "legacy_address": null,
            "address_tag": null
        }
    ],
    "USDT": [
        {
            "network": "Binance Smart Chain",
            "address": "0x375Ca4C3d29182dBF0B212Ee308123927233F4a0",
            "blockchain": "BNB",
            "legacy_address": null,
            "address_tag": ""
        },
        {
            "network": "Ethereum",
            "address": "0x375Ca4C3d29182dBF0B212Ee308123927233F4a0",
            "blockchain": "ETH",
            "legacy_address": null,
            "address_tag": ""
        },
        {
            "network": "Tron",
            "address": "TYfqKh7ANJ25MosjoWekdf69N38NdQZRA8",
            "blockchain": "TRX",
            "legacy_address": null,
            "address_tag": ""
        }
    ],
    "XLM": [
        {
            "network": "Stellar",
            "address": "GDX24M6CYHECSSVF6DDJ6HJKOGDTVTFI6DIDRV5MK3EH7474N24R4765",
            "blockchain": "XLM",
            "legacy_address": null,
            "address_tag": "931758260"
        }
    ],
    "XRP": [
        {
            "network": "Ripple",
            "address": "rEnEfiJk5aGvGyhMXwhJMPgnD3wG5kgTAc",
            "blockchain": "XRP",
            "legacy_address": null,
            "address_tag": "841679235"
        }
    ]
}