WebSocket API Subscribe
Subscribe Kline
- channel: biboxsub_spot$pairkline$period
After buliding the connection with WebSocket API, sending the data with the following format to server to subscribe data
{
"event": "addChannel",
"channel": "bibox_sub_spot_$pair_kline_$period"
}
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Trading pair | BIX_BTC, BIX_ETH, BTC_USDT, ETH_USDT...... | |
period | true | string | K line period | 1min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 12hour, day, week |
the example of subscribing correctly
- subscribe correctly
{
"event": "addChannel",
"channel": "bibox_sub_spot_BIX_BTC_kline_1min"
}
- The example of subscribing success return data
[{
"channel": "bibox_sub_spot_BIX_BTC_kline_1min",
"data_type": 0, //Subscribe one time of returning total value sucessfully, then return increment value
"data":
[
{
"time":1536310020000,
"open":"0.00006614",
"high":"0.00006659",
"low":"0.00006604",
"close":"0.00006652",
"vol":"74056.89597166"
},
{
"time":1536310080000,
"open":"0.00006652",
"high":"0.00006652",
"low":"0.00006652",
"close":"0.00006652",
"vol":"100"
}
]
}]
"data_type"
The type of data marked to be returned , 0-return total value, 1-return incremental valuedata description
"data": {
"time": the starting time of K line period,
"open": the openging price,
"high": The highest price,
"low": the lowest price,
"close": the closing price
"vol": trading volume
}
Client will receive the incremental data as long as Kline updates, for example
[{
"channel": "bibox_sub_spot_BIX_BTC_kline_1min",
"data_type": 1,
"data":
[
{
"time":1536310020000,
"open":"0.00006614",
"high":"0.00006659",
"low":"0.00006604",
"close":"0.00006652",
"vol":"74056.89597166"
},
{
"time":1536310080000,
"open":"0.00006652",
"high":"0.00006652",
"low":"0.00006652",
"close":"0.00006652",
"vol":"100"
}
]
}]
Note: 2 closest k lines will be returned every time, when incremental value k line be returned
example of subscribing wrongly
subscribe wrongly (wrong pair, capitalized sensitively)
{
"event": "addChannel",
"channel": "bibox_sub_spot_bix_btc_kline_1min"
}
The example of subscribing wrongly return data
{
"channel": "bibox_sub_spot_bix_btc_kline_1min",
"error":
{
"code": "3009",
"msg":"推送订阅channel不合法"
}
}
Subscribe Market
- channel: bibox_sub_spot_ALL_ALL_market
After buliding the connection with WebSocket API, sending the data with the following format to server to subscribe data
{
"event": "addChannel",
"channel": "bibox_sub_spot_ALL_ALL_market"
}
subscribe correctly
{
"event": "addChannel",
"channel": "bibox_sub_spot_ALL_ALL_market"
}
The example of subscribing success return data
[{
"channel": "bibox_sub_spot_ALL_ALL_market",
"data_type": 0,
"data":
[
{
"id":1,
"coin_symbol":"BIX",
"currency_symbol":"BTC",
"last":"0.00006604",
"high":"0.00006712",
"low":"0.00006421",
"change":"+0.00000121",
"percent":"+1.87%",
"vol24H":"54475636",
"amount":"3571.11",
"last_cny":"2.91",
"high_cny":"2.95",
"low_cny":"2.83",
"last_usd":"0.42",
"high_usd":"0.43",
"low_usd":"0.41"
},
{
"id":2,
"coin_symbol":"BIX",
"currency_symbol":"ETH",
"last":"0.00190235",
"high":"0.00192190",
"low":"0.00181724",
"change":"+0.00008058",
"percent":"+4.42%",
"vol24H":"32059017",
"amount":"59861.18",
"last_cny":"2.90",
"high_cny":"2.93",
"low_cny":"2.77",
"last_usd":"0.42",
"high_usd":"0.42",
"low_usd":"0.40"
},
... //others
]
}]
data description
{
"id": pair id
"coin_symbol": Trading Token
"currency_symbol": Pricing Token
"last": 24h the lastest price
"high": 24h the highest price
"low": 24h the lowest price
"change": 24h price change
"percent": 24h price change percentage
"vol24H": 24h trading volume
"amount": 24h trading amount
"last_cny": The lastest price equivelant to CNY
"high_cny": The highest price equivelant to CNY
"low_cny": The lowest price equivelant to CNY
"last_usd": The lastest price equivelant to USD
"high_usd": The highest price equivelant to USD
"low_usd": The lowest price equivelant to USD
}
Client will receive the incremental data as long as Market updates, for example
[{
"channel": "bibox_sub_spot_ALL_ALL_market",
"data_type": 1,
"data":
[
{
"id":1,
"coin_symbol":"BIX",
"currency_symbol":"BTC",
"last":"0.00006604",
"high":"0.00006712",
"low":"0.00006421",
"change":"+0.00000121",
"percent":"+1.87%",
"vol24H":"54475636",
"amount":"3571.11",
"last_cny":"2.91",
"high_cny":"2.95",
"low_cny":"2.83",
"last_usd":"0.42",
"high_usd":"0.43",
"low_usd":"0.41"
}
]
}]
Subscribe Depth
- channel: biboxsub_spot$pair_depth
After buliding the connection with WebSocket API, sending the data with the following format to server to subscribe data
{
"event": "addChannel",
"channel": "bibox_sub_spot_$pair_depth"
}
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Trading pair | BIX_BTC, BIX_ETH, BTC_USDT, ETH_USDT...... |
the example of subscribing correctly
subscribe correctly
{
"event": "addChannel",
"channel": "bibox_sub_spot_BIX_BTC_depth"
}
The example of subscribing success return data
[{
"channel": "bibox_sub_spot_BIX_BTC_depth",
"data_type": 0,
"data": {
"pair":"BIX_BTC",
"update_time":1536648343927,
"asks":[
{
"price":"0.0000683",
"volume":"1048.8046"
},
{
"price":"0.00006831",
"volume":"1008.2509"
},
... // other data
],
"bids":[
{
"price":"0.00006801",
"volume":"2.3472"
},
{
"price":"0.00006793",
"volume":"0.3458"
},
... // other data
]
}
}]
datadescription
"bids": The depth list of buyers
"asks": The depth list of sellers
{
"price": order price,
"volume": order amount
}
Client will receive the all measured data as long as Depth updates, for example
[{
"channel": "bibox_sub_spot_BIX_BTC_depth",
"data_type": 1,
"data": {
"pair":"BIX_BTC",
"update_time":1536648343927,
"asks":[
{
"price":"0.0000683",
"volume":"1048.8046"
},
{
"price":"0.00006831",
"volume":"1008.2509"
},
... // other data
],
"bids":[
{
"price":"0.00006801",
"volume":"2.3472"
},
{
"price":"0.00006793",
"volume":"0.3458"
},
... // other data
]
}
}]
Subscribe Deals
- channel: biboxsub_spot$pair_deals
{
"event": "addChannel",
"channel": "bibox_sub_spot_$pair_deals"
}
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Trading pair | BIX_BTC, BIX_ETH, BTC_USDT, ETH_USDT...... |
the example of subscribing correctly
subscribe correctly
{
"event": "addChannel",
"channel": "bibox_sub_spot_BIX_BTC_deals"
}
The example of subscribing success return data
[{
"channel": "bibox_sub_spot_BIX_BTC_deals",
"data_type": 0,
"data":[
{
"id":71890943,
"pair":"BIX_BTC",
"price":"0.00006788",
"amount":"9705.9732",
"time":1536648308000,
"side":2
},
{
"id":71890942,
"pair":"BIX_BTC",
"price":"0.00006788",
"amount":"11914.8712",
"time":1536648308000,
"side":2
},
... // other data
]
}]
data description
{
"id": Trading history id,
"pair": Trading pair,
"price": The average price of trading,
"amount": trading amount,
"time": trading timestamp,
"side": Taker trading side, 1-Buy, 2-Sell
}
Client will receive the incremental data as long as Deals updates, for example
[{
"channel": "bibox_sub_spot_BIX_BTC_depth",
"data_type": 1,
"data":[
{
"price":"0.00006788",
"amount":"9705.9732",
"time":1536648308000,
"side":2
},
{
"price":"0.00006788",
"amount":"11914.8712",
"time":1536648308000,
"side":2
},
... // other data
]
}]
Subscribe Ticker
- channel: biboxsub_spot$pair_ticker
{
"event": "addChannel",
"channel": "bibox_sub_spot_$pair_ticker"
}
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Trading pair | BIX_BTC, BIX_ETH, BTC_USDT, ETH_USDT...... |
the example of subscribing correctly
subscribe correctly
{
"event": "addChannel",
"channel": "bibox_sub_spot_BIX_BTC_ticker"
}
The example of subscribing success return data
[{
"channel": "bibox_sub_spot_BIX_BTC_ticker",
"data_type": 0,
"data":{
"pair":"BIX_BTC",
"last":"0.00006837",
"last_usd":"0.43",
"last_cny":"2.96",
"high":"0.00007401",
"low":"0.00006628",
"buy":"0.00006814",
"buy_amount":"2654.5376",
"sell":"0.00006876",
"sell_amount":"170.3094",
"vol":"48027601",
"percent":"-6.73%",
"timestamp":1536650154258,
"base_last_cny":"2.96838961"
}
}]
data description
"data":{
"pair": Trading pair
"last": the lastest price
"last_cny": The lastest price equivelant to CNY
"last_usd": The lastest price equivelant to USD
"high": 24h The highest price
"low": 24h the lowest price
"buy": The highest bid price
"buy_amount": The highest bid amount
"sell": The lowest ask price
"sell_amount": The lowest ask amount
"vol": 24h trading volume
"percent": 24h price change percentage
"timestamp": Timestamp
"base_last_cny": The lastest trading price, equivalent to CNY (remains 8 decimals)
}
Client will receive the all measured data as long as Ticker updates, for example
[{
"channel": "bibox_sub_spot_BIX_BTC_ticker",
"data_type": 1,
"data":{
"pair":"BIX_BTC",
"last":"0.00006837",
"last_usd":"0.43",
"last_cny":"2.96",
"high":"0.00007401",
"low":"0.00006628",
"buy":"0.00006814",
"buy_amount":"2654.5376",
"sell":"0.00006876",
"sell_amount":"170.3094",
"vol":"48027601",
"percent":"-6.73%",
"timestamp":1536650154258,
"base_last_cny":"2.96838961"
}
}]
Subscribe Login
- channel: bibox_sub_spot_ALL_ALL_login
{
"event": "addChannel",
"channel": "bibox_sub_spot_ALL_ALL_login",
"apikey": "thisisyourapikey",
"sign": "thisissigneddata"
}
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
apikey | true | string | Your apikey | ||
sign | true | string | Use your apisecret to sign the whole request data |
Note: Subscription Login channel will push user-related messages, including: assets, pending orders and history of orders
Sign Steps
- 1.Before sign
{
"event": "addChannel",
"channel": "bibox_sub_spot_ALL_ALL_login",
"apikey": "thisisyourapikey"
}
- 2.Sort in ascending with the key of Object
{
"apikey": "thisisyourapikey",
"channel": "bibox_sub_spot_ALL_ALL_login",
"event": "addChannel"
}
- 3.Format the data and sign
let data = {
"apikey": "thisisyourapikey",
"channel": "bibox_sub_spot_ALL_ALL_login",
"event": "addChannel"
};
let secret = "thisisyourapisecret";
let sign = CryptoJS.HmacMD5(JSON.stringify(data), secret).toString(); // 签名结果 thisissigneddata
- 4.Append the signed data to the request params
{
"event": "addChannel",
"channel": "bibox_sub_spot_ALL_ALL_login",
"apikey": "thisisyourapikey",
"sign": "thisissigneddata"
}
the example of completed signature
nodejs implements
let CryptoJS = require("crypto-js");
function getSign(data) {
let secret = "your apisecret";
let sdic = Object.keys(data).sort();//sort in ascending
let dataTmp = {};
for(let ki in sdic){
dataTmp[sdic[ki]] = data[sdic[ki]];
}
return CryptoJS.HmacMD5(JSON.stringify(dataTmp), secret).toString();
}
let data = {
"event": "addChannel",
"channel": 'bibox_sub_spot_ALL_ALL_login',
"apikey": "your apikey"
};
let sign = getSign(data);//return the signed data
data.sign = sign;
the example of subscribing correctly
subscribe correctly
{
"event": "addChannel",
"channel": "bibox_sub_spot_ALL_ALL_login",
"apikey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"sign": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
the successful response
[{
"channel": "bibox_sub_spot_ALL_ALL_login",
"data_type": 0,
"data":{ result: '订阅成功' }
}]
Client will receive the incremental data as long as the user-related data(assets, pending orders and history of orders) updates, for example
Normal account assets
- credit --> normal
[{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0", //push compressed data or not, 0-no, 1-yes
"data_type":1,
"data":{
"assets":{ //Type of Assets
"normal":{ //Normal assets
"BIX":{
"balance":"497.59601765", //Available
"freeze":"0.00000000" //Freeze
},
"USDT":{
"balance":"20.52027574",
"freeze":"22.12000000"
}
}
}
}
}]
Credit account assets
- assets --> credit
[{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"assets":{ //Type of Assets
"credit":{ //Credit assets
"BIX_USDT":{ //Pair
"BIX":{
"balance":"681.74441804", //Available
"freeze":"0.00000000" //Freeze
},
"USDT":{
"balance":"0.21698199",
"freeze":"0.00000000"
}
},
"BTC_USDT":{
"BTC":{
"balance":"100",
"freeze":"0.00000000"
},
"USDT":{
"balance":"10",
"freeze":"0.00000000"
}
}
}
}
}
}]
Note: Credit account assets are distinguished by Pair. The same currencies under different pairs (such as the USDT in BIX_USDT and BTC_USDT) are not related to each other.
Spot Pending orders
- orderpending
[{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"orderpending":{ //Type of Pending orders
"id":159,
"createdAt": 1512756997000,
"account_type":0,
"coin_symbol":"LTC", //Trading Token
"currency_symbol":"BTC", //Pricing Token
"order_side":2, //Trading side 1-Buy, 2-Sell
"order_type":2, //2-limit order
"price":"0.00900000", //order price
"amount":"1.00000000", //order amount
"money":"0.00900000", //currency amount (price * amount)
"deal_amount":"0.00000000", //deal amount
"deal_percent":"0.00%", //deal percentage
"unexecuted":"0.00000000", //unexecuted amount
"status":1 //Status, -1-rejected,1-to be dealt, 2-dealt partly, 3-dealt totally, 4- cancelled partly, 5-cancelled totally, 6-to be cancelled
}
}
}]
History of spot orders
- 关键字 history
[{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"history":{ //Type of History orders
"id":"123432223346763",
"createdAt": 1512756997000,
"account_type":0,
"coin_symbol":"LTC",
"currency_symbol":"BTC",
"order_side":2,
"order_type":2,
"price":"0.00886500",
"amount":"1.00000000",
"money":"0.00886500",
"relay_id":"11221615825364891", // Order id
"fee":0
}
}
}]
Subscribe contract Kline
- channel: biboxsub_spot$pairkline$period (E.g bibox_sub_spot_4BTC_USDT_kline_1min)
- referance Subscribe Kline
pair parameter of contract: BTCUSDT perpetual contract = 4BTC_USDT, ETHUSDT perpetual contract = 4ETH_USDT, by parity of reasoning
data description
"data": {
"time": the starting time of a cycle of the k-line,
"count": transanction completed,
"open": opening price,
"high": the highest price,
"low": the lowest price,
"close": closing price
"vol": trading volume (Cont)
}
Subscribe contract Market
- channel: bibox_sub_spot_ALL_ALL_market
- referance Subscribe Market
data description
{
"id": trading pair id
"coin_symbol": trading token, for example: 4BTC, 4ETH
"currency_symbol": pricing token
"last": the latest price in 24h
"high": the highest price in 24h
"low": the lowest price in 24h
"change": change in 24h
"percent": change percent in 24h
"vol24H": trading volume in 24h (Cont)
"amount": trading amount in 24h (USDT)
"last_cny": the latest price in CNY
"high_cny": the highest price in CNY
"low_cny": the lowest price in CNY
"last_usd": the latest price in USD
"high_usd": the highest price in USD
"low_usd": the lowest price in USD
}
Subscribe contract Depth
- channel: biboxsub_spot$pair_depth (example:bibox_sub_spot_4BTC_USDT_depth)
- referance Subscribe Depth
pair parameter of contract: BTCUSDT perpetual contract = 4BTC_USDT, ETHUSDT perpetual contract = 4ETH_USDT, by parity of reasoning
data description
"bids": buyer's depth list
"asks": seller's depth list
{
"price": limit order price
"volume": limit order size (Cont)
}
Subscribe contract Deals
- channel: biboxsub_spot$pair_deals (example:bibox_sub_spot_4BTC_USDT_deals)
- referance Subscribe Deals
pair parameter of contract: BTCUSDT perpetual contract = 4BTC_USDT, ETHUSDT perpetual contract = 4ETH_USDT, by parity of reasoning
data description
{
"id": transanction history id
"pair": trading pair, 4BTC_USDT、4ETH_USDT...
"price": average transaction price
"amount": deal amount,
"time": transaction time
"side": transaction side, 1-open long, 2-open short
}
Subscribe contract Ticker
- biboxsub_spot$pair_ticker (example:bibox_sub_spot_4BTC_USDT_ticker)
- referance Subscribe Ticker
pair parameter of contract: BTCUSDT perpetual contract = 4BTC_USDT, ETHUSDT perpetual contract = 4ETH_USDT, by parity of reasoning
data description
"data":{
"pair": trading pair
"last": the latest transaction price
"last_cny": the latest transaction price in CNY
"last_usd": the latest transaction price in USD
"high": the highest price in 24h
"low": the lowest price in 24h
"buy": the latest buy-1 price
"buy_amount": buy-1 amount (Cont)
"sell": the latest sell-1 price
"sell_amount": sell-1 amount (Cont)
"vol": transaction amount in 24h (Cont)
"percent": change percent in 24h
"timestamp": timestamp
"base_last_cny": the latest transaction price in CNY (remaining 8 decimal places)
}
Subscribe contract Login
- bibox_sub_spot_ALL_ALL_login
- referance Subscribe Login
The example of dealing returning data
contract assets
- contract_assets
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"contract_assets":{
"user_id":10101010,
"coin_symbol":"USDT",
"balance":"99.1823", // available balance
"freeze":"0.7899", // frozen amount
"profit":"-3.6816",
"margin":"0.7899", // frozen margin
"imargin":"0.0000" // frozen limit order amount
}
}
}
]
contract position contract_order
- contract_order
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"contract_order":{
"user_id":10101010,
"coin_symbol":"USDT",
"pair":"4BTC_USDT", // contract symbol
"order_side":2, // position side, 1long, 2short
"price":"3949.7850", // average open position price
"price_up":"4009.0200", // average limit order price in long position
"price_down":"3946.0300", // average limit order price in short position
"fee_rate":"0.0000",
"contract":2, // position size (Cont)
"margin":"1.5799", // margin
"imargin":"0.0000", // limit order amount
"icontract_up":1, // uncompleted Cont of limit order in long position
"icontract_down":0, // uncompleted Cont of limit order in short position
"leverage":"50", // leverage, o represents Cross margin
"price_force":"4009.0318", // forced liquidation price
"price_alert":"3989.2829", // forced liquidation alart price
"profit":"-3.5492"
}
}
}
]
contract order pending
- contract_pending
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"contract_pending":{
"id":"628754", // order number
"user_id":10101010,
"client_oid": "1589868279533",
"coin_symbol":"USDT",
"pair":"4BTC_USDT", // contract symbol
"order_side":1, // 1long, 2short
"order_type":1,
"price":"4009.0200", // order price
"contract":1, // order size
"order_from":1,
"status":3, // 0,1:uncompleted; 2:partly completed; 3:completed; 4: partly cancel; 5 cancel completed; 6,7 system cancel; >=100 order fail
"price_deal":"3952.5600", // average transaction price
"contract_deal":1, // completed Cont
"deal_count":1,
"createdAt":1550671734000, // order time
"updatedAt":1550671734000
}
}
}
]
transaction records
- contract_detail
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"contract_detail":{
"order_id":"628754", // order id
"user_id":10101010,
"coin_symbol":"USDT",
"pair":"4BTC_USDT", // contract symbol
"order_side":1, // 1long, 2short
"order_type":1, // 1market price, 2limit price
"order_from":1,
"contract":1, // deal number
"price":"4009.0200", // open position price
"price_deal":"3952.5600", // transaction price
"fee":"0.0000", // transaction fee
"is_maker":0, // maker or not
"is_cancel":0, // canceled order or not
"is_persist":0,
"force_sub":0,
"createdAt":1550671735000, // generation time
"updatedAt":1550671735000
}
}
}
]
position change records
- contract_deal_log
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"contract_deal_log":{
"id":"1125899906842966183",
"user_id":10040000,
"type":"1", // 1 open orders,2 close orders,3 liquidation,4 ADL
"pair":"4ETH_USDT",
"coin_symbol":"USDT",
"price_open":"182.2091272149", // position open price
"price":"181.1900", // order open price
"price_deal":"181.1900", // order deal price
"contract":"1", // deal amount, maybe < 0
"profit":"0", // profit
"fee":"0.0011", // fee
"order_side":1, // 1long, 2short
"createdAt":1572855008209,
"updatedAt":1572855008209
}
}
}
Subscribe indexMarket
- channel: bibox_sub_spot_ALL_ALL_indexMarket
After buliding the connection with WebSocket API, sending the data with the following format to server to subscribe data
{
"event":"addChannel",
"channel":"bibox_sub_spot_ALL_ALL_indexMarket",
"binary":1
}
- Dealt correctly
{
"event":"addChannel",
"channel":"bibox_sub_spot_ALL_ALL_indexMarket",
"binary":1
}
- The example of dealing returning data successfully
[
{
"id":147,
"is_hide":0,
"pair_type":0,
"area_id":15,
"coin_symbol":"ETH",
"currency_symbol":"USDT",
"last":"147.1849",
"high":"148.3986",
"low":"140.4113",
"change":"-0.5364",
"percent":"-0.36%",
"vol24H":"43108",
"amount":"6240970.83",
"last_cny":"989.4382",
"base_last_cny":"",
"high_cny":"997.5971",
"low_cny":"943.9036",
"last_usd":"147.1848",
"high_usd":"148.3985",
"low_usd":"140.4113"
},
{
"id":146,
"is_hide":0,
"pair_type":0,
"area_id":15,
"coin_symbol":"BTC",
"currency_symbol":"USDT",
"last":"3955.1652",
"high":"3993.1069",
"low":"3880.6072",
"change":"+6.1701",
"percent":"+0.16%",
"vol24H":"43109",
"amount":"169654088.16",
"last_cny":"26588.2733",
"base_last_cny":"",
"high_cny":"26843.3333",
"low_cny":"26087.0635",
"last_usd":"3955.1651",
"high_usd":"3993.1068",
"low_usd":"3880.6072"
}
]
- data description description
{
"id":147,
"is_hide":0,
"pair_type":0,
"area_id":15,
"coin_symbol":"ETH", // token symbol
"currency_symbol":"USDT", // currency of price,USDTFUND stands for premium index
"last":"147.1867", // the latest price
"high":"148.3986",
"low":"140.4113",
"change":"-0.5346",
"percent":"-0.36%",
"vol24H":"43109",
"amount":"6241118.04",
"last_cny":"989.4508",
"base_last_cny":"",
"high_cny":"997.5971",
"low_cny":"943.9036",
"last_usd":"147.1867",
"high_usd":"148.3985",
"low_usd":"140.4113"
}
Client will receive data as long as the index updated, for example
{
"id":147,
"is_hide":0,
"pair_type":0,
"area_id":15,
"coin_symbol":"ETH",
"currency_symbol":"USDT",
"last":"147.1867",
"high":"148.3986",
"low":"140.4113",
"change":"-0.5346",
"percent":"-0.36%",
"vol24H":"43109",
"amount":"6241118.04",
"last_cny":"989.4508",
"base_last_cny":"",
"high_cny":"997.5971",
"low_cny":"943.9036",
"last_usd":"147.1867",
"high_usd":"148.3985",
"low_usd":"140.4113"
}
Subscribe the price limit of taking contract orders
- channel: bibox_sub_spot_ALL_ALL_contractPriceLimit
After buliding the connection with WebSocket API, sending the data with the following format to server to subscribe data
{
"event":"addChannel",
"channel":"bibox_sub_spot_ALL_ALL_contractPriceLimit",
"binary":1
}
- Dealt correctly
{
"event":"addChannel",
"channel":"bibox_sub_spot_ALL_ALL_contractPriceLimit",
"binary":1
}
- The example of dealing returning data successfully
{
"4BTC_USDT":{
"min_up":"2964.4562",
"max_up":"4090.9496",
"min_down":"3814.2670",
"max_down":"4940.7603",
"market_up":"4090.9496",
"market_down":"3814.2670"
},
"4ETH_USDT":{
"min_up":"110.3038",
"max_up":"155.1606",
"min_down":"138.9828",
"max_down":"183.8396",
"market_up":"155.1606",
"market_down":"138.9828"
}
}
- data description
{
"4BTC_USDT":{ // contract symbol
"min_up":"2964.4562", // minimum price of opening long
"max_up":"4090.9496", // maximum price of opening long
"min_down":"3814.2670", // minimum price of opening short
"max_down":"4940.7603", // maximum price of opening short
"market_up":"4090.9496", // maximum price of opening long at the market price
"market_down":"3814.2670" // minimum price of opening short at the market price
}
}
Client will receive data as long as the limit of order price updated, for example
{
"4BTC_USDT":{
"min_up":"2964.4562",
"max_up":"4090.9496",
"min_down":"3814.2670",
"max_down":"4940.7603",
"market_up":"4090.9496",
"market_down":"3814.2670"
},
"4ETH_USDT":{
"min_up":"110.3038",
"max_up":"155.1606",
"min_down":"138.9828",
"max_down":"183.8396",
"market_up":"155.1606",
"market_down":"138.9828"
}
}
Coin-based contract subscribing to Kline data
- wss://push.bibox.me/cbc
- channel: biboxsub_spot$pairkline$period (E.g bibox_sub_spot_5BTC_USD_kline_1min)
referance Subscribe Kline
example
{ event: 'addChannel', channel: 'bibox_sub_spot_5BTC_USD_kline_1min', binary: 0, ver: 8, }
Pair parameters of coin-based contracts: BTCUSDT perpetual = 5BTC_USD, ETHUSDT perpetual = 5ETH_USD, and so on
- data description
"data": {
"time": the starting time of K line period,
"open": the openging price,
"high": The highest price,
"low": the lowest price,
"close": the closing price
"vol": trading volume
}
Coin-based contract subscription mark price
- wss://push.bibox.me/cbc
- channel: biboxsub_spot$pairTAGPRICE_kline_1min (E.g bibox_sub_spot_5BTC_USDTAGPRICE_kline_1min)
referance Subscribe Market
example
{ event: 'addChannel', channel: 'bibox_sub_spot_5BTC_USDTAGPRICE_kline_1min', binary: 0, ver: 8, }
Pair parameters of coin-based contracts: BTCUSDT perpetual = 5BTC_USD, ETHUSDT perpetual = 5ETH_USD, and so on
- data description
"data": {
"time": the starting time of K line period,
"open": the openging price,
"high": The highest price,
"low": the lowest price,
"close": the closing price
"vol": ignore
}
Coin-based contract subscription depth
- wss://push.bibox.me/cbc
- channel: biboxsub_spot$pair_depth (E.g bibox_sub_spot_5BTC_USD_depth)
referance Subscribe Depth
example
{ event: 'addChannel', channel: 'bibox_sub_spot_5BTC_USD_depth', // depth binary: 0, ver: 3, }
Pair parameters of coin-based contracts: BTCUSDT perpetual = 5BTC_USD, ETHUSDT perpetual = 5ETH_USD, and so on
- data description
"bids": The depth list of buyers
"asks": The depth list of sellers
{
"price": order price,
"volume": order amount
}
Coin-based contract subscription deals records
- wss://push.bibox.me/cbc
- channel: biboxsub_spot$pair_deals (例:bibox_sub_spot_5BTC_USD_deals)
referance 订阅 Deals 数据
example
{ event: 'addChannel', channel: 'bibox_sub_spot_5BTC_USD_deals', binary: 0, }
Pair parameters of coin-based contracts: BTCUSDT perpetual = 5BTC_USD, ETHUSDT perpetual = 5ETH_USD, and so on
data description
{
"id": Trading history id,
"pair": Trading pair,
"price": The average price of trading,
"amount": trading amount,
"time": trading timestamp,
"side": Taker trading side, 1-Buy, 2-Sell
}
Coin-based contract subscription ticker
- wss://push.bibox.me/cbc
- biboxsub_spot$pair_ticker (例:bibox_sub_spot_5BTC_USD_ticker)
- referance Subscribe Ticker
Pair parameters of coin-based contracts: BTCUSDT perpetual = 5BTC_USD, ETHUSDT perpetual = 5ETH_USD, and so on
data description
"data":{
"pair": Trading pair
"last": the lastest price
"last_cny": The lastest price equivelant to CNY
"last_usd": The lastest price equivelant to USD
"high": 24h The highest price
"low": 24h the lowest price
"buy": The highest bid price
"buy_amount": The highest bid amount
"sell": The lowest ask price
"sell_amount": The lowest ask amount
"vol": 24h trading volume
"percent": 24h price change percentage
"timestamp": Timestamp
"base_last_cny": The lastest trading price, equivalent to CNY (remains 8 decimals)
}
Coin-based contract subscription user data
- wss://push.bibox.me/cbc
- bibox_sub_spot_ALL_ALL_login
- referance Subscribe user data
Return data example
Coin-based contract assets
- cbc_assets
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"cbc_assets":{
"b":"1",
"c":"BTC",
"u":100006,
"f":"0",
"m":"0"
}
}
}
]
Coin-based contract position
- cbc_order
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"cbc_order":{
"pt":"0",
"f":"0",
"l":"10",
"sd":2,
"pa":"1.0006153088",
"ui":100006,
"fb0":"0",
"pf":"1.0006148393",
"md":1,
"lc":"0",
"pi":"5BTC_USD",
"mg":"0",
"hc":"0",
"fb":"0",
"po":"0"
}
}
}
]
Coin-based contract pending order
- cbc_pending
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"cbc_pending":{
"f":"0",
"dp":"0",
"eq":"0",
"p":"11692",
"tif":0,
"q":"1",
"sd":2,
"r":0,
"s":1,
"t":1602750121093,
"ui":100006,
"fz":"0.0000086786",
"fb0":"0",
"of":4,
"pi":"5BTC_USD",
"oi":"432108069716000",
"coi":"1602750117690",
"fb":"0",
"po":false
}
}
}
]
Coin-based contract deal records
- cbc_detail
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"cbc_detail":{
"oi":"432108069715999",//order id
"ui":"100006",//user id
"id":"1125899906842648855",// record id
"coi":"1602750117684",//client order id
"pi":"5BTC_USD",//pair
"sd":1,//
"s":3,//
"ot":2,
"of":4,// order source
"q":"1",
"p":"11692",//target parice
"dp":"10655",//deal price
"ep":"1",
"f":"0.0000000657",//fee
"fb":"0",//bix deduction
"fb0":"0",//Coupon deduction
"im":0,//is maker
"t":1602750121093//time
}
}
}
]
Coin-based contract position change records
- cbc_deal_log
[
{
"channel":"bibox_sub_spot_ALL_ALL_login",
"binary":"0",
"data_type":1,
"data":{
"cbc_deal_log":{
"id":"1125899906842654296",// record id
"user_id":100006,//user id
"type":5,//Change type, 1 open position, 2 close position, 3 lighten position to reduce risk level, 4 liquidate position, 5ADL
"mode":2,//position mode, 1 cross, 2 fixed
"pair":"5BTC_USD",//pair
"price":"11247.6",//proposed price
"hold_dx":"1",//Change in position
"order_side":2,// position side, 1 long, 2 short
"time":1602755131000//time
}
}
}
]