NAV Navbar
shell
English
中文
English

Introduction

Welcome to the LBANK API! You can use our API to access all market data, trading, and account management endpoints.The version of the document is V2,and it will continuously update.

LBank API v1 It is still available at present, but it will not be updated any more. It will be deactivated at a later time. Please switch to v2 version in time.

LBANK offers powerful APIs for you to integrate into your applications. They are divided into three categories: account, trading, and market trends.

The account and trading APIs require authentication with an API key which allows you to create order、cancel order、query order and account info.

The market data API is publicly accessible and provides market data such as:historical price of trading pairs.

Process

To access the API, create an API key via this link API Key. Follow the instructions in setting up access.

Please remember below information after creation:

LBank support both RSA and HmacSHA256 signature.

SDK

Developers can use the LBANK API. in a way that suits them based on their preferences and usage scenarios. We currently provide three SDKs based on Java, Python and Go language. Each SDK include full function interface in example file for directly using or testing. If you want to implement the SDK based on other language such as C#, the existing SDKs could be your best reference.

Endpoints Configurations

We offers REST and WebSocket APIs. Both support market data, trading, and withdrawals.

REST API

REST (Representational State Transfer) is the most popular internet software architecture nowadays. It is clear in structure, easy to understand, and convenient to expand. More and more companies therefore apply the structures in their websites. It has following advantages:

1.In a RESTful architecture, each URL represents a resource
2.Between the client and the server, a certain presentation layer of such resources passed
3.The client uses the four HTTP commands to operate on the server-side resources to achieve “state transition of the presentation layer.”

We suggested that user should use the REST API for trading and/or asset operations (such as deposite and withdrawals)

WebSocket API

WebSocket protocol which achieves full-duplex communications over a single TCP connection between client and server is based on a new network protocol of the TCP. Server sends information to client, reducing unnecessary overhead such as frequent authentication. It greatest advantage includes that:

1.Request header is small in size (2 Bytes) .
2. The server no longer passively responses after receiving the client's request, but actively pushes the new data to the client.
3. There is no need to establish and close TCP connection repeatedly, so it saves bandwidth and server resources.

Changelog

Live Date Time(UTC+8) API Type Description
2019.10.24 19:00 Init new version
2019.11.04 19:00 /v2/incrDepth.do Add Add incrDepth API
2019.11.04 19:00 WebSocket Add Add new WebSocket
2019.11.30 19:00 API Add Add /v2/cancel_clientOrders.do
2019.12.09 19:00 API Add Add HmacSHA256
2019.12.16 19:00 Echostr Update Update echostr param
2020.2.24 19:00 /v2/batch_create_order.do Add Add new API
2020.3.04 19:00 WebSocket Add Asset & Order add customerID return message

Interaction Introduction

URL

REST API

https://www.lbkex.net/

https://api.lbkex.com/

https://api.lbank.info/

Websocket

wss://www.lbkex.net/ws/V2/

Endpoint Rate Limit

Create order and cancel order Request 500/10s

The other Request 200/10s

Authentication

To protect API communication from unauthorized change, all non-public API calls are required to be signed.

Request Header Setting

You should put the following parameters in every http requests

contentType:'application/x-www-form-urlencoded'

timestamp: millisecond of current time (1567833674095). It's strongly recommended that you get it from /v2/timestamp.do

signature_method: RSA/HmacSHA256.

echostr: the param is digit or letter,length is from 30 to 40. You can directly use echostr of SDK, it's safe.

Signature Process (how to generate the 'sign' parameter)

1. Get parameter String(need to be signed):

Each required parameter of API, exclude sign, add three additional parameters(signature_method, timestamp, echostr) , then we get the parameter string which need to be signed. The parameter string should be ordered according to the parameter name (first compares the first letter of all parameter names, in alphabet order, if you encounter the same first letter, then look at the second letter, and so on). For example, if we use user_info API, the parameter string is like

string parameters="api_key=c821db84-6fbd-11e4-a9e3-c86000d26d7c&echostr=P3LHfw6tUIYWc8R2VQNy0ilKmdg5pjhbxC7&signature_method=RSA&timestamp=1585119477235"

2. Turn parameters into MD5 digest

The MD5 digest should be Hex encoded and all letters are uppercase.

string preparedStr = DigestUtils.md5Hex(parameters).toUpperCase()

3. Signature:

Users could use their secret key to perform a signature operation (Base64 coded) by RSA or HmacSHA256.

RSA method(signature_method = RSA):

use secret key of your api_key,sign the preparedStr(Base64 encode),then we get the parameter sign.

RSA example:

    public static String RSA_Sign(String preparedStr, String secretKey) {
        try {
            PrivateKey priKey = getPrivateKey(secretKey);
            Signature signature = Signature.getInstance("SHA256WithRSA");
            signature.initSign(priKey);
            signature.update(content.getBytes(CharEncoding.UTF_8));
            byte[] signed = signature.sign();
            return new String(Base64.getEncoder().encode(signed));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    private static PrivateKey getPrivateKey(String key) {
        PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(key));
        PrivateKey privateKey = null;
        try {
            KeyFactory keyFactory = KeyFactory.getInstance(RSA);
            privateKey = keyFactory.generatePrivate(keySpec);
        } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
            e.printStackTrace();
        }
        return privateKey;
    }

HmacSHA256 method(signature_method = HmacSHA256):

use secret key of your api_key,make the hash operation of preparedStr,then we get the parameter sign.

HmacSHA256 example:

    public static String HmacSHA256_Sign(String preparedStr, String secretKey) {
        String hash = "";
        try {
            Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
            SecretKeySpec secret_key = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256");
            sha256_HMAC.init(secret_key);
            byte[] bytes = sha256_HMAC.doFinal(message.getBytes());
            hash = byteArrayToHexString(bytes);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return hash;
    }

Submit:

After we get the parameter 'sign', put it together with each required parameters of API, then submit. Example of user_info API

Request Format

All request are GET or POST.

Content-Type:application/x-www-form-urlencoded、timestamp:1567427936729、signature_method:RSA、echostr:3d47056c0bf0429c81afc8c3de7b0f94。

Response Format

Parameter Type Description
result boolean API return,true/false
error_code string return error_code
ts long return timestamp
data object return body

Error code

REST API code

Error code Description
00000 return success
10000 Internal error
10001 The required parameters can not be empty
10002 Validation Failed
10003 Invalid parameter
10004 Request too frequent
10005 Secret key does not exist
10006 User does not exist
10007 Invalid signature
10008 Invalid Trading Pair
10009 Price and/or Amount are required for limit order
10010 Price and/or Amount must be more than 0
10013 The amount is too small
10014 Insufficient amount of money in account
10015 Invalid order type
10016 Insufficient account balance
10017 Server Error
10018 Page size should be between 1 and 50
10019 Cancel NO more than 3 orders in one request
10020 Volume < 0.001
10021 Price < 0.01
10022 Invalid authorization
10023 Market Order is not supported yet
10024 User cannot trade on this pair
10025 Order has been filled
10026 Order has been cancelld
10027 Order is cancelling
10028 Wrong query time
10029 'from' is not in the query time
10030 'from' do not match the transaction type of inqury
10031 echostr length must be valid and length must be from 30 to 40
10033 Failed to create order
10036 customID duplicated
10100 Has no privilege to withdraw
10101 Invalid fee rate to withdraw
10102 Too little to withdraw
10103 Exceed daily limitation of withdraw
10104 Cancel was rejected
10105 Request has been cancelled
10106 None trade time
10107 Start price exception
10108 can not create order
10109 wallet address is not mapping
10110 transfer fee is not mapping
10111 mount > 0
10112 fee is too lower
10113 transfer fee is 0
10600 intercepted by replay attacks filter, check timestamp
10601 Interface closed unavailable

Websocket API Error Code

Error code Description
10000 request param must not be null
10001 request param is error
10002 request frequently
10003 repeat request
10003 service is null

Common

Available trading pairs

curl "https://api.lbkex.com/v2/currencyPairs.do"

Example:

[
  "bcc_eth","etc_btc","dbc_neo","eth_btc",
  "zec_btc","qtum_btc","sc_btc","ven_btc",
  "ven_eth","sc_eth","zec_eth"
]

HTTP Request

GET /v2/currencyPairs.do

Paramters

none

Returns

Parameter Type Required Note
data object Yes pari info

Trading pairs

Acquiring the basic information of all trading pairs

curl "https://api.lbkex.com/v2/accuracy.do"

Example:

   [
        {
          "priceAccuracy": "2",
          "quantityAccuracy": "4",
          "symbol": "pch_usdt"
        }
    ]

HTTP Request

GET /v2/accuracy.do

Parameters

none

Returns

Parameter Type Required Note
minTranQua string Yes Min TranQua
symbol string Yes Trading Pair,eth_btc:Etherum, zec_btc:ZCash
quantityAccuracy string Yes Quantity Accuracy
priceAccuracy string Yes Price Accuracy

Exchange rate of USD/RMB

Exchange rate of USD/RMB (Update on 00:00 everyday)

curl "https://api.lbkex.com/v2/usdToCny.do"

Example:

 {"USD2CNY":"6.4801"}

HTTP Request

GET /v2/usdToCny.do

Parameters

none

Returns

Parameter Type Required Note
data object Yes Exchange rate of USD/RMB

Withdraw configurations

curl "https://api.lbkex.com/v2/withdrawConfigs.do"

Example:

    { 
        "amountScale":4,
        "assetCode":"eth", 
        "canWithDraw":"true", 
        "fee":0.01,
        "type":1, 
        "min":0.01,
        "chain":1
     }

HTTP Request

GET /v2/withdrawConfigs.do

Parameters

Parameter Type Required Note
assetCode String No Code of the asset

Returns

Parameter Type Required Note
assetCode string Yes Code of token
min double Yes Minimum amount to withdraw
canWithDraw boolean Yes Whether the currency can be withdrawn
fee double Yes Charged fee for withdrawal(amount)
amountScale int Yes amount scale
type int Yes 1:fixed fee,2:rate fee
chain string no chain for usdt:OMNI or ERC20

Get timestamp

curl "https://api.lbkex.com/v2/timestamp.do"

Example:

  {"timestamp":1568269063244}

HTTP Request

GET /v2/timestamp.do

Parameters

none

Returns

Parameter Type Required Note
data long Yes timestamp

Query current Market Data

   curl "https://api.lbkex.com/v2/ticker.do"

Example:

 [
   {
     "symbol":"eth_btc",
     "timestamp":"1410431279000",
     "ticker":{
       "change":"4.21",
       "high":"7722.58",
       "latest":"7682.29",
       "low":"7348.30",
       "turnover":"0.00",
       "vol":"1316.3235"
     }
   },
   {
     "symbol":"sc_btc",
     "timestamp":"1410431279000",
     "ticker":{
       "change":"4.21",
       "high":"7722.58",
       "latest":"7682.29",
       "low":"7348.30",
       "turnover":"0.00",
       "vol":"1316.3235"
     }
   }
 ]

HTTP Request

GET /v2/ticker.do

Parameters

Parameter Type Required Note
symbol String Yes Pair
Such as: eth_btczec_btcall

Returns

Parameter Note
vol 24 hr trading volume
high 24 hr highest price
low 24 hr lowest price
change Fluctuation (%) in 24 hr
turnover Total Turn over in 24 hr
latest Latest Price
timestamp Timestamp of latest transaction

Query Market Depth

   curl "https://api.lbkex.com/v2/depth.do"

Example:

{
  "asks":[
    [5370.4, 0.32],
    [5369.5, 0.28],
    [5369.24, 0.05],
    [5368.2, 0.079],
    [5367.9, 0.023]
  ],
  "bids":[
    [5367.24, 0.32],
    [5367.16, 1.31],
    [5366.18, 0.56],
    [5366.03, 1.42],
    [5365.77, 2.64]
  ]
}

HTTP Request

GET /v2/depth.do

Parameters

Parameter Type Required Note
symbol String Yes Trading Pair. Such as eth_btc
size Integer Yes The count of returned items.(1-60)
merge Integer No(Default is 0) Depth: 0,1

Returns

Parameter Note
asks Depth of asks (Sellers')
bids Depth of bids (Buyers')

Query Market Increment Depth

   curl "https://api.lbkex.com/v2/incrDepth.do"

Example:

{
  "asks":[
    [5370.4, 0.32],
    [5369.5, 0.28],
    [5369.24, 0.05],
    [5368.2, 0.079],
    [5367.9, 0.023]
  ],
  "bids":[
    [5367.24, 0.32],
    [5367.16, 1.31],
    [5366.18, 0.56],
    [5366.03, 1.42],
    [5365.77, 2.64]
  ],
  "version": 3001,
  "timestamp": 1571904037912
}

HTTP Request

GET /v2/incrDepth.do

Parameters

Parameter Type Required Note
symbol String Yes Trading Pair. Such as eth_btc
merge Integer No(Default is 0) Depth: 0,1

Returns

Parameter Note
asks Depth of asks (Sellers')
bids Depth of bids (Buyers')
version Version number
timestamp timestamp

Query historical transactions

   curl "https://api.lbkex.com/v2/trades.do"

Example:

[
  {
    "date_ms":1482311500000,
    "amount":1.4422,
    "price":5242.66,
    "type":"buy",
    "tid":"a4aie34"
  },
  {
    "date_ms":1482311400000,
    "amount":51.3454,
    "price":5412.24,
    "type":"sell",
    "tid":"iodsio1934"
  },
  {
    "date_ms":1482311300000,
    "amount":4.2355,
    "price":5124.22,
    "type":"buy",
    "tid":"di124kq"
  }
]

HTTP Request

GET /v2/trades.do

Parameters

Name Type Required Description
symbol String Yes Trading pair.
Such as eth_btc
size Integer Yes The count of returned items.(1-600)
time String No Start transaction timestamp of the querying. Return latest records if it is not provided.

Returns

Parameter Note
date_ms Transaction Time
amount Transaction Volume
price Transaction Price
type buy or sell
tid Transaction ID

Query K Bar Data

   curl "https://api.lbkex.com/v2/kline.do"

Example:

[
  [
    1482311500,
    5423.23,
    5472.80,
    5516.09,
    5462,
    234.3250
  ],
  [
    1482311400,
    5432.52,
    5459.87,
    5414.30,
    5428.23,
    213.7329
  ]
]

HTTP Request

GET /v2/kline.do

Parameters

Name Type Required Description
symbol String Yes Trading Pair eth_btc
size Integer Yes Count of the bars (1-2880)
type String Yes minute1:1 minute
minute5:5 minutes
minute15:15minutes
minute30:30 minutes
hour1:1 hour
hour4:4 hours
hour8:8 hours
hour12:12 hours
day1:1 day
week1:1 week
month1:1 month
time String Yes Timestamp (of Seconds)

Returns

Parameter Note
1482311500 Timestamp
5423.23 Open Price
5472.80 Highest Price
5516.09 Lowest Price
5462 Close Price
234.3250 Trading Volume

Account API

Asset Information

Acquiring Users' Asset Information

curl "https://api.lbkex.com/v2/user_info.do"

Example:

  {
    "freeze":{
         "btc":1.0000,
         "zec":0.0000,
         "cny":80000.00
       },
       "asset":{
         "net":95678.25
       },
       "free":{
         "btc":2.0000,
         "zec":0.0000,
         "cny":34.00
       }
   }

HTTP Request

POST /v2/user_info.do

Parameters

Parameter Type Required Note
api_key string Yes User's api_key
sign string Yes signature of the request

Response

Parameter Type Required Note
freeze object Yes Frozen balance of the asset
asset object Yes Total balance of the asset
free object Yes Available balance of the account

Create subscribeKey

The key is valid in 60 minutes from creation.

curl "https://api.lbkex.com/v2/subscribe/get_key.do"

Example:

 {
    "key":"9301ef1ca6cafbef2df4a1430dc8b53879ea68c595a142eac311d8d590fbd60a"
  }

HTTP Request

POST /v2/subscribe/get_key.do

Parameters

Parameter Type Required Note
api_key string Yes User's api_key
sign string Yes signature of the request

Response

Parameter Type Required Note
data string Yes subscribeKey

Extend the validity of subscribeKey

The key is valid in 60 minutes from this call.

curl "https://api.lbkex.com/v2/subscribe/refresh_key.do"

Example:

{"result":"true"}

HTTP Request

POST /v2/subscribe/refresh_key.do

Parameters

Parameter Type Required Description
api_key String Y API key requested by user
sign String Y Signature of parameter in request
subscribeKey String Y subscribeKey

Response

Parameter Type Required Description
result boolean Yes true or false

Close subscribeKey

Close the data stream for an account.

curl "https://api.lbkex.com/v2/subscribe/destroy_key.do"

Example:

{"result":"true"}

HTTP Request

POST /v2/subscribe/destroy_key.do

Parameters

Parameter Type Required Description
api_key String Y API key requested by user
sign String Y Signature of parameter in request
subscribeKey String Y subscribeKey

Response

Parameter Type Required Description
result boolean Yes true or false

Order

Place Order

curl "https://api.lbkex.com/v2/create_order.do"

Example:

{"order_id":"12074652-d827-4f8d-8f52-92a005c6ce53"}

HTTP Request

POST /v2/create_order.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
symbol String Yes Trading Pair
eth_btc:Etherum over bitcoin; zec_btc:zcoin over bitcoin
type String Yes trade type: buy/sell
price String Yes Price
Greater than 0
amount String Yes Volume
More than 0.001 BTC
sign String Yes signature of the request
custom_id String No custom_id

Returns

Parameter Type Required Note
order_id string Yes Order ID

Batch Place Order

curl "https://api.lbkex.com/v2/batch_create_order.do"
post: orders = "[{"symbol": "lbk_usdt", "type": "buy", "price": 0.05, "amount": 100, "customer_id": ""},{"symbol": "lbk_usdt", "type": "buy", "price": 0.05, "amount": 100, "customer_id": ""}]"

Return Example:

  {'result': True, 'data': [{'result': True, 'data': {'customer_id': '100001', 'order_id': 'c3d6aa2b-fff4-44a3-a958-e0bc0d3e1b62'}, 'error_code': 0, 'ts': 1582601927140}]}

HTTP Request

POST /v2/batch_create_order.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
orders String Yes json array for every single create order para
sign String Yes signature of the request

Returns

Parameter Type Required Note
result string Yes return result
data string Yes return result for every single order

Cancel the Order

curl "https://api.lbkex.com/v2/cancel_order.do"

Example:

{"order_id":"12074652-d827-4f8d-8f52-92a005c6ce53"}

HTTP Request

POST /v2/cancel_order.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
symbol String Yes Trading Pair
eth_btc:Etherum over bitcoin; zec_btc:zcoin over bitcoin
order_id String Yes Order ID
Use comma to join the multiply orders. order_id1,order_id2, No more than 10 orders in one order.
sign String Yes signature of the request

Returns

Parameter Type Required Note
order_id string No Order ID (For single order)
success object No Order IDs cancelled sucessfully. (For multiply orders)
error object No Order IDs failed to cancel.(For multiply orders))

Cancel the Order With Customer_Id

curl "https://api.lbkex.com/v2/cancel_clientOrders.do"

Example:

{"customer_id":"12074652-d827-4f8d-8f52-92a005c6ce53"}

HTTP Request

POST /v2/cancel_clientOrders.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
symbol String Yes Trading Pair
eth_btc:Etherum over bitcoin; zec_btc:zcoin over bitcoin
customer_id String Yes Customer ID
Use comma to join the multiply orders. customer_id1,customer_id2, No more than 10 orders in one order.
sign String Yes signature of the request

Returns

Parameter Type Required Note
customer_id string No Customer ID (For single order)
success object No Customer IDs cancelled sucessfully. (For multiply orders)
error object No Customer IDs failed to cancel.(For multiply orders))

Query Order

curl "https://api.lbkex.com/v2/orders_info.do"

Example:

  {
    "symbol":"eth_btc", 
    "amount":100.00000000, 
    "create_time":1568257977151, 
    "price":0.01100000, 
    "avg_price":0E-8, 
    "type":"buy", 
    "order_id":"12074652-d827-4f8d-8f52-92a005c6ce53", 
    "deal_amount":0E-8, 
    "status":0, 
    "customer_id":""
   }

HTTP Request

POST /v2/orders_info.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
symbol String Yes Trading Pair
eth_btc:Etherum over bitcoin; zec_btc:zcoin over bitcoin
order_id String Yes Order ID
Use comma to join the multiply orders. order_id1,order_id2, No more than 3 orders in one order.
sign String Yes signature of the request

Returns

Parameter Type Required Note
order_id string Yes Order ID (For single order)
orders object No A list of querying orders
symbol string Yes Trading Pair,eth_btc:Etherum, zec_btc:ZCash
amount string Yes required volume
create_time string Yes order time
price string Yes price
avg_price string ]Yes Average strike price
type string Yes buy:Buy
sell:Sell
deal_amount string Yes filled volume
status string Yes Status
-1:Cancelled
0:on trading
1: filled partially
3:filled partially and cancelled
2:Filled totally
4:Cancelling

Query history order

Query history order (Only the records in recent two days are available)

curl "https://api.lbkex.com/v2/orders_info_history.do"

Example:

     {
       "total""1",
       "page_length""20",
       "orders"[
         {
           "symbol""eth_btc",
           "amount"5.0000,
           "create_time"1484716198613,
           "price"6666.0000,
           "avg_price"0.0000,
           "type""sell",
           "order_id""c3f9c478-5b06-4e1e-9df9-9f84f57a446c",
           "deal_amount"0.0000,
           "status"0
         },
         {
           "symbol""eth_btc",
           "amount"10.0000,
           "create_time"1484716151390,
           "price"6000.0000,
           "avg_price"6136.3895,
           "type""sell",
           "order_id""9ead39f5-701a-400b-b635-d7349eb0f6b4",
           "deal_amount"10.0000,
           "status"2
         }
       ],
       "current_page""1"
     }

HTTP Request

POST /v2/orders_info_history.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
symbol String Yes Trading Pair
eth_btc:Etherum over bitcoin; zec_btc:zcoin over bitcoin
current_page String Yes Current Page
page_length String Yes The records in a page. No more than 200.
sign String Yes signature of the request
status String No the status of order

Returns

Parameter Type Required Note
order_id string Yes Order ID (For single order)
orders object No A list of querying orders
symbol string Yes Trading Pair,eth_btc:Etherum, zec_btc:ZCash
amount string Yes required volume
create_time string Yes order time
price string Yes price
avg_price string Yes Average strike price
type string Yes buy:Buy
sell:Sell
deal_amount string Yes filled volume
status string Yes Status
-1:Cancelled
0:on trading
1: filled partially
2:Filled totally
3:filled partially and cancelled
4:Cancelling
current_page string Yes Current Page
page_length string Yes The page size
total string Yes Total number of records

Search order transaction details

curl "https://api.lbkex.com/v2/order_transaction_detail.do"

Example:

{
       "transaction":[
         {
           "txUuid": "ae926ba8f6f44cae8d347a4b7ac90135",
           "orderUuid": "24f7ce27-af1d-4dca-a8c1-ef1cbeec1b23",
           "tradeType": "sell",
           "dealTime": 1562553793113,
           "dealPrice": 0.0200000000,
           "dealQuantity": 0.0001000000,
           "dealVolumePrice": 0.0000020000,
           "tradeFee": 0.0000010000,
           "tradeFeeRate": 0.000001
         }
       ]
 }

HTTP Request

POST /v2/order_transaction_detail.do

Parameters

Parameter Type Required Note
sign String Yes signature of the request
api_key String Yes User's api_key
symbol String Yes Trading Pair,eth_btc:Etherum, zec_btc:ZCash
order_id String Yes Order ID

Returns

Parameter Type Required Note
txUuid string Yes Trading ID
orderUuid string Yes Order ID
tradeType string Yes buy:Buy
sell:Sell
dealTime string Yes Trading time
dealPrice string Yes Trading price
dealQuantity string Yes Trading volume
dealVolumePrice string Yes Aggregated trading value
tradeFee string Yes Transaction fee
tradeFeeRate string Yes Transaction fee ratio

Past transaction details

curl "https://api.lbkex.com/v2/transaction_history.do"

Example:

 {
  "transaction":[
    {
      "txUuid": "ae926ba8f6f44cae8d347a4b7ac90135",
      "orderUuid": "5976ed05-6141-4fea-bcd5-179fa7a1fa56",
      "tradeType": "sell",
      "dealTime": 1562553793113,
      "dealPrice": 0.0200000000,
      "dealQuantity": 0.0001000000,
      "dealVolumePrice": 0.0000020000,
      "tradeFee": 0.0000010000,
      "tradeFeeRate": 0.000001
    },
    {
      "txUuid": "ae926ba8f6f44cae8d347a4b7ac90135",
      "orderUuid": "d65d4302-a4ff-4578-aa6b-6717758fb8c2",
      "tradeType": "buy",
      "dealTime": 1562553793113,
      "dealPrice": 0.0200000000,
      "dealQuantity": 0.0001000000,
      "dealVolumePrice": 0.0000020000,
      "tradeFee": 0.0000010000,
      "tradeFeeRate": 0.000002
    },
    {
      "txUuid": "bebadd0f953747d88d1e3181bba36f12",
      "orderUuid": "e0465949-12c2-4b87-87fa-12847a324a09",
      "tradeType": "sell",
      "dealTime": 1562575780302,
      "dealPrice": 0.0200000000,
      "dealQuantity": 0.0001000000,
      "dealVolumePrice": 0.0000020000,
      "tradeFee": 0.0000010000,
      "tradeFeeRate": 0.000001
    }
  ]
}

HTTP Request

POST /v2/transaction_history.do

Parameters

Parameter Type Required Note
sign String Yes signature of the request
api_key String Yes User's api_key
symbol String Yes Trading Pair,eth_btc:Etherum, zec_btc:ZCash
type String No Order type sell, buy
start_date String No Start time yyyy-mm-dd, the maximum is today, the default is yesterday
end_date String No Finish time yyyy-mm-dd, the maximum is today, the default is today
The start and end date of the query window is up to 2 days
from String No Initial transaction number inquiring
direct String No inquire direction,The default is the 'next' which is the positive sequence of dealing time,the 'prev' is inverted order of dealing time
size String No Query the number of defaults to 100

Returns

Parameter Type Required Note
txUuid string Yes Trading ID
orderUuid string Yes Order ID
tradeType string Yes buy:Buy
sell:Sell
dealTime string Yes Trading time
dealPrice string Yes Trading price
dealQuantity string Yes Trading volume
dealVolumePrice string Yes Aggregated trading value
tradeFee string Yes Transaction fee
tradeFeeRate string Yes Transaction fee ratio

Acquiring openning orders

curl "https://api.lbkex.com/v2/orders_info_no_deal.do"

Example:

{
  'page_length': 100, 
  'current_page': 1, 
  'total': 1, 
  'orders': [
    {
      'status': 0,
      'custom_id': "", 
      'order_id': 'a7de8dae-16a3-416b-8fc9-e3bb88e0d819', 
      'price': 0.015, 
      'amount': 100.0, 
      'create_time': 1527498699770, 
      'avg_price': 0.0, 
      'type': 'sell',
      'symbol': 'eth_btc', 
      'deal_amount': 0.0
    }
  ]
}

HTTP Request

POST /v2/orders_info_no_deal.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
symbol String Yes Trading Pair
eth_btc:Etherum over bitcoin; zec_btc:zcoin over bitcoin
sign String Yes signature of the request
current_page String Yes Current Page
page_length String Yes The records in a page. No more than 200.

Returns

Parameter Type Required Note
page_length string Yes The page size
current_page string Yes Current Page
total string Yes Total number of records
status string Yes Status
0:on trading
1: filled partially
customer_id string Yes customer id
order_id string Yes Order ID (For single order)
price string Yes price
amount string Yes required volume
create_time string Yes order time
avg_price string Yes Average strike price
type string Yes buy:Buy
sell:Sell
symbol string Yes Trading Pair,eth_btc:Etherum, zec_btc:ZCash
deal_amount string Yes filled volume

Withdraw

Withdraw

Withdraw (IP binding is required.)

curl "https://api.lbkex.com/v2/withdraw.do"

Example:

{"withdrawId":90082,"fee":0.001}

HTTP Request

POST /v2/withdraw.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
account String Yes Address,if internal,this is email or mobile account
assetCode String Yes Asset Code
amount String Yes Amount(Must be integer for NEO)
memo String No Required for BTS and/or DCT
mark String No User's memo.(length <= 255)
sign String Yes signature of the request
type String No withdraw type,1:internal,2:normal

Return

Parameter Type Required Note
withdrawId string Yes Current withdrawal ID
fee string Yes Withdrawal fee(amount)

Revoke Withdraw

Revoke Withdraw (IP binding is required.)

curl "https://api.lbkex.com/v2/withdrawCancel.do"

Example:

{"withdrawId":"1207"}

HTTP Request

POST /v2/withdrawCancel.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
withdrawId Current withdrawal ID
sign String Yes signature of the request

Return

Parameter Type Required Note
withdrawId string Current withdrawal ID

Withdrawal record

Withdrawal record (IP binding is required.)

curl "https://api.lbkex.com/v2/withdraws.do"

Example:

{
    'totalPages': 1,
    'pageSize': 20,
    'pageNo': 1
    'list': [{
        'amount': 20.0,
        'assetCode': 'btc',
        'address': 'erfwergertghrehyrhethyryuj',
        'fee': 0.0,
        'id': 89686,
        'time': 1525750028000,
        'txHash': '',
        'status': '2'
    }, {
        'amount': 335.0,
        'assetCode': 'btc',
        'address': 'erfwergertghrehyrhethyryuj',
        'fee': 0.0,
        'id': 89687,
        'time': 1525767979000,
        'txHash': '',
        'status': '2'
    }
    ....]
}

HTTP Request

POST /v2/withdraws.do

Parameters

Parameter Type Required Note
api_key String Yes User's api_key
assetCode String Yes
status String Yes Status:
0: All, 1: applying. 2. Revoked. 3. Failed. 4. Completed )
pageNo String Yes Current Page. Default 1.
pageSize String Yes The records in a page. No more than 100. Default 20
sign String Yes signature of the request

Return

Parameter Type Required Note
totalPage string Yes Total Number of Pages
pageSize string Yes The records in a page
pageNo string Yes Current Page
list string Yes List data(id: coin withdrawal ID,assetCode: Asset Code,address: coin withdrawal address,amount:withdrawal amount fee:withdrawal fee,time:wtihdrawal time,txHash:withdrawal hash, status:Coin withdrawal status)

WebSocket API (Market Data)

Request & subscription instruction

1.One-time request to get k-line needs extra parameters defined in following

Parameters Parameters Type Required Description
start String fasle Start time. Accept 2 formats, such as 2018-08-03T17:32:00 (beijing time), another timestamp, such as 1533288720 (Accurate to second)
end String false Deadline
size String false Number of kbars
  1. One-time request to get trade records needs extra parameters defined in following
Parameters Parameters Type Required Description
size String Y Number of trades
     # Get k-line data Request
    {
        "action":"request",
        "request":"kbar",
        "kbar":"5min",
        "pair":"eth_btc",
        "start":"2018-08-03T17:32:00",
        "end":"2018-08-05T17:32:00",
        "size":"576"
    }
     # Get depth data Request
    {
        "action":"request",
        "request":"depth",
        "depth":"100",
        "pair":"eth_btc"
    }
     # Get transaction data Request
    {
        "action":"request",
        "request":"trade",
        "pair":"eth_btc",
        "size":"100"
    }
     # Get market data Request
    {
        "action":"request",
        "request":"tick",
        "pair":"eth_btc"
    }

Subscription of K-line Data

    {
        "action":"subscribe",
        "subscribe":"kbar",
        "kbar":"5min",
        "pair":"eth_btc"
    }

Example:

 {
        "kbar":{
            "a":64.32991311,
            "c":0.02590293,
            "t":"2019-06-28T17:45:00.000",
            "v":2481.1912,
            "h":0.02601247,
            "slot":"5min",
            "l":0.02587925,
            "n":272,
            "o":0.02595196
        },
        "type":"kbar",
        "pair":"eth_btc",
        "SERVER":"V2",
        "TS":"2019-06-28T17:49:22.722"
    }

Parameters

Parameter Parameter Type Required Description
action String Y Action requested: subscribe or unsubscribe
subscribe String Y kbar
kbar String Y To subscribe to k-line types
1min: 1 minute
5min: 5 minutes
15min: 15 minutes
30min: 30 minutes
1hr: 1 hour
4hr: 4 hours
day: 1 day
week: 1 week
month: 1 month
year: 1 year
pair String Y Trading pair:eth_btc

Return

Parameters Parameters Type Description
t String K-line updates the time
o BigDecimal Open price
h BigDecimal Highest price
l BigDecimal Lowest price
c BigDecimal Close price
v BigDecimal Trading volume
a BigDecimal Aggregated turnover (summation of price times volume for each trade)
n BigDecimal Number of trades
slot String K-line type

Market Depth

    {
        "action":"subscribe",
        "subscribe":"depth",
        "depth":"100",
        "pair":"eth_btc"
    }

Example:

 {
         "depth":{
             "asks":[
                 [
                     0.0252,
                     0.5833
                 ],
                 [
                     0.025215,
                     4.377
                 ],
                 ...
             ],
             "bids":[
                 [
                     0.025135,
                     3.962
                 ],
                 [
                     0.025134,
                     3.46
                 ],
                 ...
             ]
         },
         "count":100,
         "type":"depth",
         "pair":"eth_btc",
         "SERVER":"V2",
         "TS":"2019-06-28T17:49:22.722"
     }

Parameters

Parameters Parameters Type Required Description
action String Y Type of action requested:subscribe,unsubscribe
subscribe String Y depth
depth String Y Pro-choise:10/50/100
pair String Y Trading pair:eth_btc

Return

Parameters Parameters Type Description
asks List Selling side: list.get(0): delegated price, list.get(1): delegated quantity
bids List Buying side

Market Increment Depth

    {
        "action":"subscribe",
        "subscribe":"incrDepth",
        "pair":"eth_btc"
    }

Example:

 {
         "depth":{
             "asks":[
                 [
                     0.0252,
                     0.5833
                 ],
                 [
                     0.025215,
                     4.377
                 ],
                 ...
             ],
             "bids":[
                 [
                     0.025135,
                     3.962
                 ],
                 [
                     0.025134,
                     3.46
                 ],
                 ...
             ]
         },
         "count":100,
         "type":"depth",
         "pair":"eth_btc",
         "SERVER":"V2",
         "VERSION":1000,
         "TS":"2019-06-28T17:49:22.722"
     }

Parameters

Parameters Parameters Type Required Description
action String Y Type of action requested:subscribe,unsubscribe
subscribe String Y depth
pair String Y Trading pair:eth_btc

Return

Parameters Parameters Type Description
asks List Selling side: list.get(0): delegated price, list.get(1): delegated quantity
bids List Buying side

Trade record

    {
        "action":"subscribe",
        "subscribe":"trade",
        "pair":"eth_btc"
    }

Example:

 {
         "trade":{
             "volume":6.3607,
             "amount":77148.9303,
             "price":12129,
             "direction":"sell",
             "TS":"2019-06-28T19:55:49.460"
         },
         "type":"trade",
         "pair":"btc_usdt",
         "SERVER":"V2",
         "TS":"2019-06-28T19:55:49.466"
     }

Parameters

Parameters Parameters Type Required Description
action String Y Action requested: subscribe or unsubscribe
subscribe String Y trade
pair String Y Trading pair:eth_btc

Return

Parameters Parameters Type Description
amount String Recent trading volume
price Integer Trade price
volumePrice String Aggregated turnover
direction String sell,buy
TS String Deal time

Market

    {
        "action":"subscribe",
        "subscribe":"tick",
        "pair":"eth_btc"
    }

Example:

 {
         "tick":{
             "to_cny":76643.5,
             "high":0.02719761,
             "vol":497529.7686,
             "low":0.02603071,
             "change":2.54,
             "usd":299.12,
             "to_usd":11083.66,
             "dir":"sell",
             "turnover":13224.0186,
             "latest":0.02698749,
             "cny":2068.41
         },
         "type":"tick",
         "pair":"eth_btc",
         "SERVER":"V2",
         "TS":"2019-07-01T11:33:55.188"
     }

Parameters

Parameters Parameters Type Required Description
action String Y Action requested:subscribe,unsubscribe
subscribe String Y tick
pair String Y Trading pair:eth_btc

Return

Parameters Parameters Type Description
high BigDecimal Highest price in last 24 hours
low BigDecimal Lowest price in last 24 hours
latest BigDecimal Lastest traded price
vol BigDecimal Trading volume
turnover BigDecimal Aggregated turnover (summation of price times volume for each trade)
to_cny BigDecimal Such as eth_btc, convert btc into cny
to_usd BigDecimal Such as eth_btc, convert btc into usd
cny BigDecimal Such as eth_btc, convert eth into cny
usd BigDecimal Such as eth_btc, convert eth into usd
dir String sell, buy
change BigDecimal Price limit in last 24 hours

WebSocket API(Asset & Order)

Update subscribed orders

Such events will be pushed when there are new orders created, new orders dealed or new status changes of the account.

    {
      "action": "subscribe",
      "subscribe": "orderUpdate",
      "subscribeKey": "24d87a4xxxxxd04b78713f42643xxxxf4b6f6378xxxxx35836260",
      "pair": "all",
    }

Example:

 {
     "orderUpdate":{
         "amount":"0.003",
         "symbol":"eth_btc",
         "type":"buy",
         "orderStatus":2,
         "price":"0.02455211",
         "role":"maker",
         "updateTime":1561704577786,
         "uuid":"d0db191d-xxxxx-4418-xxxxx-fbb1xxxx2ea9",
    "txUuid":"da88f354d5xxxxxxa12128aa5bdcb3",
         "volumePrice":"0.00007365633"
     },
     "pair":"eth_btc",  
     "type":"orderUpdate",
     "SERVER":"V2",
     "TS":"2019-06-28T14:49:37.816"
 }

Parameters

Parameters Parameters Type Required Description
action String Y Action requested: subscribe
subscribe String Y orderUpdate
subscribeKey String Y Obtained through the REST interface of the /v2/subscribe/refresh_key.do
pair String Y Trading pair :eth_btc. Support matching all: all

Return

Parameters Parameters Type Description
uuid String Order ID
customerID String Order customer ID
symbol String Trading pair
type String buy or sell
txUuid String Trading record ID
amount String Trading volume
volumePrice String Aggregated trading value
role Long maker,taker
price Integer Last price(When the order status is' 1 'or' 2 ' ,it is the transaction price, and the others are the Delegat price)
orderStatus Integer Order status
-1:Withdrawn
0:Unsettled
1: Partial sale
2:Close the deal
4:Withdrawing
updateTime Long Updating time of order