General API Information

The base endpoint is: https://api.xbond.io. All endpoints return either a JSON object or an Array. All time and timestamp related fields are in milliseconds. Request URL needs to be determined by BASE and specific endpoint combination.

Endpoint

Each interface has its own endpoint, described by field HTTP REQUEST in the docs.

Request

All requests and responses are application/json content type.

Endpoint security type

Each endpoint has a security type that determines the how you will interact with it. API-keys are passed into the Rest API via the API_KEY header. API-keys and secret-keys are case sensitive. For User data => Endpoint requires sending a valid API-Key and signature. For User stream => Endpoint requires sending a valid API-Key. TRADE and USER_DATA endpoints are SIGNED endpoints.

SIGNED (TRADE and USER_DATA) Endpoint security

SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body. Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation. The signature is not case sensitive.

Timing security

A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent. An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000. The logic is as follows:

    if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
    // process request
    } else {
    // reject request
    }

Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server. It recommended to use a small recvWindow of 5000 or less!

SIGNED Endpoint Examples for POST /api/v1/trade

coin : BTC

apiKey : FcJXEbiSbFBOIJKVEMcdICdaRTiGHeNYhYc

secretKey : iPBUpOwOPrSmokZbnJpXxDfnMXZUHOFbTQwjejeVbhVujbliYo

queryString:

coin=BTC&recvWindow=5000&timestamp=1558088640489

HMAC SHA256 signature:

bf04aa37e7073ae88e6132bb41401811e55736d3191ae4a94e932968140f7a3f

signed querystring:

coin=BTC&recvWindow=5000&timestamp=1558088640489&signature=bf04aa37e7073ae88e6132bb41401811e55736d3191ae4a94e932968140f7a3f

General endpoints

Test connectivity

Http Request

GET /v1/api/ping

                        

Response

{ "msg": "Success", "status": "1", "info": {} }

Check server time

Http Request

GET /v1/api/time

                        

Response

{ "msg": "Success", "status": "1", "info": 1558089702000 }

Market data

Order Book

Get a list of open orders for a symbol.

Http Request

GET /v1/api/depth

Request Parameter

pair : LTCBTC

count : 100 (Optional)

 
                        

Response

{ "msg": "Success", "status": "1", "info": { "bids": [ { "price": 0.017, "volume": 3.4, "total": 0.0578 }, { "price": 0.018, "volume": 3, "total": 0.05399999 } ], "asks": [ { "price": 0.027, "volume": 9, "total": 0.243 }, { "price": 0.026, "volume": 5, "total": 0.13 } ] } }

Trade History

Http Request

GET /v1/api/tradehistory

Request Parameter

pair : LTCBTC

count : 100 (Optional)

  
                        

Response

{ "msg": "Success", "status": "1", "info": [ { "price": 0.022, "volume": 0.3, "time": 1557315914, "side": "buy" }, { "price": 0.023, "volume": 0.1, "time": 1557315888, "side": "sell" } ] }

Kline/Candlestick data

Http Request

GET /v1/api/kline

Request Parameter

pair : LTCBTC

period : 1m (1m,5m,15m,30m,1h,8h,1d,1w)

                        

Response

{ "msg": "Success", "status": "1", "info": [ { "o": 0.02500000, "h": 0.02500000, "l": 0.02500000, "c": 0.02500000, "v": 0.02680000, "t": 1562758980 }, { "o": 0.02500000, "h": 0.02680000, "l": 0.02500000, "c": 0.02680000, "v": 25.00000000, "t": 1562759100 }, { "o": 0.02680000, "h": 0.02750000, "l": 0.02680000, "c": 0.02750000, "v": 24.97320000, "t": 1562760900 }, ] }

Last 24 hour Detail

Http Request

GET /v1/api/market

Request Parameter

pair : LTCBTC (optional)

                        

Response

{ "msg": "Success", "status": "1", "info": { "Table": [ { "TwentyHRVol": 0, "TwentHRHigh": 0, "TwentHRLow": 0, "Pair": "LTCBTC", "Coin": "LTC", "Currency": "BTC", "Price": 0.022, "Volume": 0.3, "ChangePer": 46.66666, "ChangePrice": 0.007, "VolBTC": 0, "VolUSD": 0 } ] } }

Account

Get Balance

Http Request

POST /v1/api/balance

Request Parameters

coin : BTC

                        

Response

{ msg: 'Success', status: '1', info: [ { coin: 'BTC', balance: 90.77753529, onorders: 5.47373137, pendingWithdraw: 0, available: 85.30380392 } ] }

Trading

Trade

Http Request

POST /v1/api/trade

Request Parameters

pair : LTCBTC

side : buy (sell)

size : 1

type : market (Limit,Stop-limit)

price : 0.03140000 (if order type in Limit or Stop-limit)

stopPrice : 0.03110000 (if order type is Stop-limit)

 
                        

Response

{ "msg": "Success", "status": "1", "info": { "Isvalid": true, "Errors": [], "Successes": [ "orderId:756010567" ], "Model": null } }

© 2020 XBOND All Rights Reserved