English
javascript python csharp

API Booster

API Booster Intro

Bibox API Booster (hereinafter referred to as API Booster) is a fast development tool launched by Bibox for traders. Using API Booster can greatly reduce the difficulty of trading system development and obtain stable and reliable real-time data.

How to use API Booster

To use API Booster, traders only need to download API Booster to their computer and start it. API Booster will automatically connect to Bibox and continuously synchronize market data and account order data. Traders develop or modify their own trading system to make it connected with HTTP RESTFul interface provided by API Booster instead of directly connecting with Bibox API.

Why use API Booster

console.log('Bibox javascript demo');

# -*- coding:utf-8 -*-


if __name__ == '__main__':
    print('Bibox python demo')

Console.WriteLine("Bibox c# demo");

Using API Booster is much simpler than using Bibox API directly. Traders can complete the connection with API Booster in a very small time. Traders only need to focus on writing strategies, and the maintenance of real-time data is done automatically by API Booster.

Below we will list main advantages of API Booster.

Install

Installation of API Booster is divided into two steps, first install JAVA environment, and then install API Booster.

Install JAVA environment

Please visit following link and follow instructions on the page to install JAVA environment.

Install API Booster

To install API Booster, please download API Booster executable JAR file from Bibox official website.

Tips: x.x.x is the version number, please modify it to the version number of the corresponding version you downloaded when running

Please create a new directory on your computer and move the above JAR file to this directory. During runtime, API Booster will create some necessary data files in this directory, please make sure there are no other files in this directory.

Start API Booster

console.log('Bibox javascript demo');

# -*- coding:utf-8 -*-


if __name__ == '__main__':
    print('Bibox python demo')

Console.WriteLine("Bibox c# demo");

To start API Booster, just enter the following command in command line tool.

java -jar bibox-spot-apibooster-x.x.x.jar

Specific method is as follows:

Platform Start method
Linux Enter command line mode, or start "Terminal" application in graphics mode.
Use cd command to enter the directory where bibox-spot-apibooster-x.x.x.jar is located.
Enter the above command
MacOS Click the "Launchpad" rocket icon in the shortcut menu.
Find and click the "Terminal" icon.
Use cd command to enter the directory where bibox-spot-apibooster-x.x.x.jar is located.
Enter the above command
Windows Open "File Explorer"
Find and enter the directory where bibox-spot-apibooster-x.x.x.jar is located
Hold down Shift key and click right mouse button on a blank space in "File Explorer"
In the pop-up menu, click "Open Powershell window here"
Enter the above command in "Powershell" window

Service Port

API Booster uses port 8080 to provide HTTP services by default. If there are other services using this port in your system, you can specify the service port of API Booster through the "port" command line parameter.

java -jar bibox-spot-apibooster-x.x.x.jar --port 8081

The 8081 can be any unused port.

Stop Method

To stop API Booster, close command line tool, or use process management tool to close API Booster process.

API Booster Interface Documentation

console.log('Bibox javascript demo');

# -*- coding:utf-8 -*-


if __name__ == '__main__':
    print('Bibox python demo')

Console.WriteLine("Bibox c# demo");

To read API Booster's detailed interface documentation, please enter localhost:8080 in the browser after starting API Booster.

Spot trading

SDK and Demo

Bibox provides contract SDKs for developers in multiple languages.

These SDKs are developed based on the Bibox contract API and automatically complete the following functions:

It's more convenient to use SDK to develop programs to access Bibox than to use API.

If you need to download or read more information, please click the following link:

Signature interface request method

Example

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1. Current timestamp

let param = {// 2. Requested parameters
    select: 1
};

let strParam = JSON.stringify(param); // 2. Formatting parameters

let strToSign ='' + timestamp + strParam; // 3. This is the string that needs to be signed

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4. Signed result

let url = "https://api.bibox.com/v3.1/transfer/mainAssets";

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//5. Set request headers
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6. Formatting parameters
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 7. Response data

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests
import sys, getopt

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/transfer/mainAssets'
    body = {

    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/transfer/mainAssets";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {

             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

Field name Field type Field description Field value
content-type string 'application/json'
bibox-api-key string your apikey
bibox-timestamp long Current timestamp,expressed in milliseconds timestamp
bibox-api-sign string Signature result sign

Network test

Request

let request = require("request");
let url = "https://api.bibox.com/v3/mdata/ping";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });
# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3/mdata/ping'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3/mdata/ping";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3/mdata/ping

Name Necessary or not Type Description Default value Value range

Response

{
    "state":0,
    "result":1604319540420,
    "cmd":"ping",
    "ver":"3"
}

Name Description
state 0 means success, otherwise means failure
result server timestamp
Other fields Ignore

Market

Query trading pairs

Request

let request = require("request");
let url = "https://api.bibox.com/v3/mdata/pairList";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3/mdata/pairList'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3/mdata/pairList";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3/mdata/pairList

Name Necessary or not Type Description Default value Value range

Response

{
    "state":0,
    "result":[
        {
            "id":1,
            "pair":"BIX_BTC",
            "pair_type":0,
            "area_id":7,
            "is_hide":0,
            "decimal":8
        },
        {
            "id":2,
            "pair":"BIX_ETH",
            "pair_type":0,
            "area_id":8,
            "is_hide":0,
            "decimal":8
        }
    ],
    "cmd":"pairList",
    "ver":"3"
}
Name Description
state 0 means success, otherwise means failure
id Trading pair id
pair Trading pair
decimal Price accuracy
Other fields Ignore

Query kline

Request

let request = require("request");
let url = "https://api.bibox.com/v3/mdata/kline?pair=BTC_USDT&period=1min&size=2";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3/mdata/kline?pair=BTC_USDT&period=1min&size=2'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3/mdata/kline?pair=BTC_USDT&period=1min&size=2";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3/mdata/kline?pair=BTC_USDT&period=1min&size=10

Name Necessary or not Type Description Default value Value range
pair true string trading pair BIX_BTC, ETH_BTC, ...
period true string k-line period '1min', '3min', '5min', '15min', '30min', '1hour', '2hour', '4hour', '6hour', '12hour ','day','week'
size false integer quantity 1000 1-1000

Response

{
    "state":0,
    "result":[
        {
            "time":1604319840000,
            "open":"11700.00000000",
            "high":"11700.00000000",
            "low":"11700.00000000",
            "close":"11700.00000000",
            "vol":"0.00000000"
        },
        {
            "time":1604319900000,
            "open":"11700.00000000",
            "high":"11700.00000000",
            "low":"11700.00000000",
            "close":"11700.00000000",
            "vol":"0.00000000"
        }
    ],
    "cmd":"kline",
    "ver":"3"
}
Name Description
state 0 means success, otherwise means failure
time Timestamp
open Opening price
high Highest price
low Lowest price
close Closing price
vol Volume
Other fields Ignore

Query market of all pairs

Request

let request = require("request");
let url = "https://api.bibox.com/v3/mdata/marketAll";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3/mdata/marketAll'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3/mdata/marketAll";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3/mdata/marketAll

Name Necessary or not Type Description Default value Value range

Response

{
    "state":0,
    "result":[
        {
            "is_hide":0,
            "high_cny":"0.3668",
            "amount":"380746.08",
            "coin_symbol":"BIX",
            "last":"0.053142",
            "currency_symbol":"USDT",
            "change":"+0.000460",
            "low_cny":"0.3470",
            "base_last_cny":"0.35286384",
            "area_id":15,
            "percent":"+0.87%",
            "last_cny":"0.3529",
            "high":"0.055248",
            "low":"0.052253",
            "pair_type":0,
            "last_usd":"0.0531",
            "vol24H":"7059898",
            "id":90,
            "high_usd":"0.0552",
            "low_usd":"0.0522"
        },
        {
             "is_hide":0,
             "high_cny":"92032.3103",
             "amount":"392242739.20",
             "coin_symbol":"BTC",
             "last":"13328.9300",
             "currency_symbol":"USDT",
             "change":"-437.5799",
             "low_cny":"87735.6210",
             "base_last_cny":"88504.33592048",
             "area_id":15,
             "percent":"-3.17%",
             "last_cny":"88504.3359",
             "high":"13860.2500",
             "low":"13213.1600",
             "pair_type":0,
             "last_usd":"13318.9290",
             "vol24H":"28728",
             "id":36,
             "high_usd":"13849.8503",
             "low_usd":"13203.2459"
        }
    ],
    "cmd":"marketAll",
    "ver":"3"
}
Name Description
state 0 means success, otherwise means failure
id trading pair id
coin_symbol Trading currency
currency_symbol Pricing currency
last 24h latest price
high 24h highest price
low 24h lowest price
change 24h change
percent 24h change percent
vol24H 24h Volume
amount 24h amount
last_cny 24h latest price discount cny
high_cny 24h highest price discount cny
low_cny 24h lowest price discount cny
last_usd 24h latest price discount usd
high_usd 24h highest price discount usd
low_usd 24h lowest price discount usd
Other fields Ignore

Query the market of one pair

Request

let request = require("request");
let url = "https://api.bibox.com/v3/mdata/market?pair=BIX_USDT";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3/mdata/market?pair=BIX_USDT'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3/mdata/market?pair=BIX_USDT";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3/mdata/market?pair=BIX_USDT

Name Necessary or not Type Description Default value Value range
pair true string trading pair BIX_BTC, ETH_BTC, ...

Response

{
    "state":0,
    "result":{
        "is_hide":0,
        "high_cny":"0.3668",
        "amount":"380746.08",
        "coin_symbol":"BIX",
        "last":"0.053142",
        "currency_symbol":"USDT",
        "change":"+0.000460",
        "low_cny":"0.3470",
        "base_last_cny":"0.35286384",
        "area_id":15,
        "percent":"+0.87%",
        "last_cny":"0.3529",
        "high":"0.055248",
        "low":"0.052253",
        "pair_type":0,
        "last_usd":"0.0531",
        "vol24H":"7059898",
        "id":90,
        "high_usd":"0.0552",
        "low_usd":"0.0522"
    },
    "cmd":"market",
    "ver":"3"
}
Name Description
state 0 means success, otherwise means failure
id trading pair id
coin_symbol Trading currency
currency_symbol Pricing currency
last 24h latest price
high 24h highest price
low 24h lowest price
change 24h change
percent 24h change percent
vol24H 24h Volume
amount 24h amount
last_cny 24h latest price discount cny
high_cny 24h highest price discount cny
low_cny 24h lowest price discount cny
last_usd 24h latest price discount usd
high_usd 24h highest price discount usd
low_usd 24h lowest price discount usd
Other fields Ignore

Query depth

Request

let request = require("request");
let url = "https://api.bibox.com/v3/mdata/depth?pair=BTC_USDT&size=2";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3/mdata/depth?pair=BTC_USDT&size=2'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3/mdata/depth?pair=BTC_USDT&size=2";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3/mdata/depth?pair=BIX_BTC&size=10

Name Necessary or not Type Description Default value Value range
pair true string trading pair BIX_BTC, ETH_BTC, ...
size false integer quantity 200 1-200

Response

{
    "state":0,
    "result":{
        "pair":"BTC_USDT",
        "update_time":1604316939377,
        "asks":[
            {
                "volume":"0.00320000",
                "price":"11739.1407"
            },
            {
                "volume":"0.00320000",
                "price":"11762.6189"
            }
        ],
        "bids":[
            {
                "volume":"0.00640000",
                "price":"11692.3246"
            },
            {
                "volume":"0.00490000",
                "price":"11668.9866"
            }
        ]
    },
    "cmd":"depth",
    "ver":"3"
}
Name Description
state 0 means success, otherwise means failure
pair Trading pair
update_time Timestamp
asks Seller Depth
bids Buyer Depth
price Pending price
volume Pending volume
Other fields Ignore

Query market records

Request

let request = require("request");
let url = "https://api.bibox.com/v3/mdata/deals?pair=BTC_USDT&size=2";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3/mdata/deals?pair=BTC_USDT&size=2'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3/mdata/deals?pair=BTC_USDT&size=2";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3/mdata/deals?pair=BTC_USDT&size=10

Name Necessary or not Type Description Default value Value range
pair true string trading pair BIX_BTC, ETH_BTC, ...
size false integer quantity 200 1-200

Response

{
    "state":0,
    "result":[
        {
            "pair":"BTC_USDT",
            "price":"11700.0000",
            "amount":"0.01000000",
            "time":1604316939377,
            "side":2
        },
        {
            "pair":"BTC_USDT",
            "price":"11857.0026",
            "amount":"0.00160000",
            "time":1604308219643,
            "side":2
        }
    ],
    "cmd":"deals",
    "ver":"3"
}
Name Description
state 0 means success, otherwise means failure
pair Trading pair
price Deal price
volume Deal quantity
time Deal time
side taker trading direction, 1-buy, 2-sell
Other fields Ignore

Query tiker

Request

let request = require("request");
let url = "https://api.bibox.com/v3/mdata/ticker?pair=BTC_USDT";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3/mdata/ticker?pair=BTC_USDT'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3/mdata/ticker?pair=BTC_USDT";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3/mdata/ticker?pair=BTC_USDT

Name Necessary or not Type Description Default value Value range
pair true string trading pair BIX_BTC, ETH_BTC, ...

Response

{
    "state":0,
    "result":{
        "pair":"BTC_USDT",
        "last":"11700.0000",
        "last_usd":"11700.00",
        "last_cny":"78287.05",
        "high":"11880.0000",
        "low":"11700.0000",
        "buy":"11692.3246",
        "buy_amount":"0.00640000",
        "sell":"11739.1407",
        "sell_amount":"0.00320000",
        "vol":"0.02160000",
        "percent":"-1.51%",
        "timestamp":1604316939377,
        "base_last_cny":"78287.05250000"
    },
    "cmd":"ticker",
    "ver":"3"
}
Name Description
state 0 means success, otherwise means failure
pair Trading pair
buy Latest buying price
buy_amount Latest buying amount
sell Latest selling price
sell_amount Latest selling amount
high 24h highest price
last latest price
low 24h lowest price
timestamp Timestamp
vol 24h volume
percent 24h change percent
last_cny Latest Trading price, priced in cny
last_usd Latest Trading price, priced in usd
Other fields Ignore

Order restriction information

Request

let request = require("request");
let url = "https://api.bibox.com/v3.1/orderpending/tradeLimit";
request.get(url,
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import requests


BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_request():
    path = '/v3.1/orderpending/tradeLimit'
    resp = requests.get(BASE_URL + path)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;

namespace ConsoleProgram
{

    public class Class1
    {

        static readonly HttpClient client = new HttpClient();

        static async Task Main()
        {
          try
          {
             String uri = "https://api.bibox.tel/v3.1/orderpending/tradeLimit";
             string responseBody = await client.GetStringAsync(uri);

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

GET https://api.bibox.com/v3.1/orderpending/tradeLimit

Name Necessary or not Type Description Default value Value range

Response

{
    "result":{
        "min_trade_price":{
            "default":"0.00000001",
            "USDT":"0.0001",
            "DAI":"0.0001"
        },
        "min_trade_amount":{
            "default":"0.0001"
        },
        "min_trade_money":{
            "USDT":"1",
            "DAI":"1",
            "GUSD":"1",
            "BIX":"3",
            "BTC":"0.0002",
            "ETH":"0.005"
        }
    },
    "cmd":"tradeLimit",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
min_trade_price Minimum order price column
-default The minimum order price limit for ordinary trading pairs is 0.00000001
-USDT The maximum order price limit in the USDT trading area is 0.0001. The decimal part exceeding 0.0001 will be automatically discarded. It is applicable to all trading pairs denominated in USDT
-DAI The minimum order price limit in the DAI trading area is 0.0001. The decimal part exceeding 0.0001 will be automatically discarded. It is applicable to all trading pairs denominated in DAI
min_trade_amount Minimum order quantity column
-default The minimum order quantity limit is 0.0001, the decimal part exceeding 0.0001 will be automatically discarded, applicable to all trading pairs
min_trade_money Minimum order amount column
-USDT The minimum order amount in USDT trading area is limited to 1, and so on

Spot Asset(Need ApiKey)

Wallet assets

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/transfer/mainAssets";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    select: 1
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests
import sys, getopt

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/transfer/mainAssets'
    body = {

    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/transfer/mainAssets";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {

             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/transfer/mainAssets

Name Necessary or not Type Description Default value Value range
select false integer Whether to query asset details 0-Total assets of each currency, 1-Request asset details of all currencies

Response

{
    "result":{
        "total_btc":"0.01373280",
        "total_cny":"1253.48",
        "total_usd":"188.63",
        "assets_list":[
            {
                "coin_symbol":"BTC",
                "BTCValue":"0.00149188",
                "CNYValue":"136.17",
                "USDValue":"20.49",
                "balance":"0.00149188",
                "freeze":"0.00000000"
            },
            {
                "coin_symbol":"BIX",
                "BTCValue":"0.00098407",
                "CNYValue":"89.82",
                "USDValue":"13.52",
                "balance":"247.87570000",
                "freeze":"0.00000000"
            }
        ]
    },
    "cmd":"assets",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
total_btc The sum of assets in each currency, btc-based
total_cny The sum of assets in each currency, cny-based
total_usd The sum of assets of each currency, usd-based
assets_list Currency asset list
coin_symbol currency
balance Available assets
freeze freeze assets
BTCValue btc valuation
CNYValue cny valuation
USDValue usd valuation
Other fields Ignore

Spot assets

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/spot/account/assets";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    select: 1
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/spot/account/assets'
    body = {
        'select': 1
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/spot/account/assets";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                select = 1,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/spot/account/assets

Name Necessary or not Type Description Default value Value range
select false integer Whether to query asset details 0-Total assets of each currency, 1-Request asset details of all currencies

Response

{
    "result":{
        "total_btc":"0.01373280",
        "total_cny":"1253.48",
        "total_usd":"188.63",
        "assets_list":[
            {
                "coin_symbol":"BTC",
                "BTCValue":"0.00149188",
                "CNYValue":"136.17",
                "USDValue":"20.49",
                "balance":"0.00149188",
                "freeze":"0.00000000"
            },
            {
                "coin_symbol":"BIX",
                "BTCValue":"0.00098407",
                "CNYValue":"89.82",
                "USDValue":"13.52",
                "balance":"247.87570000",
                "freeze":"0.00000000"
            }
        ]
    },
    "cmd":"assets",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
total_btc The sum of assets in each currency, btc-based
total_cny The sum of assets in each currency, cny-based
total_usd The sum of assets of each currency, usd-based
assets_list Currency asset list
coin_symbol currency
balance Available assets
freeze freeze assets
BTCValue btc valuation
CNYValue cny valuation
USDValue usd valuation
Other fields Ignore

Deposit

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/transfer/transferIn";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    coin_symbol:'BTC'
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests
import sys, getopt

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/transfer/transferIn'
    body = {
        'coin_symbol': 'BTC'
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/transfer/transferIn";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "BTC",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/transfer/transferIn

Name Necessary or not Type Description Default value Value range
coin_symbol true string Deposit currency BIX, BTC, ...

Response

{
    "result":"13f2LpNAdsKuxdTt2bKFLaSZL7toeyieGE",
    "cmd":"transferIn",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
result Deposit address
Other fields Ignore

Withdrawal

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/transfer/transferOut";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    coin_symbol:'BTC',
    amount: 0.1,
    addr: '13f2LpNAdsKuxdTt2bKFLaSZL7toeyieGExxx',
    memo:''
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests
import sys, getopt

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/transfer/transferOut'
    body = {
        'coin_symbol': 'BTC',
        'amount': 0.1,
        'addr': '13f2LpNAdsKuxdTt2bKFLaSZL7toeyieGExxx',
        'memo': ''
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/transfer/transferOut";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "BTC",
                amount = "0.1",
                addr = "13f2LpNAdsKuxdTt2bKFLaSZL7toeyieGExxx",
                memo = "",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/transfer/transferOut

Name Necessary or not Type Description Default value Value range
coin_symbol true string Withdrawal currency BIX, BTC, ...
amount true double Withdrawal quantity Must be greater than the minimum withdrawal quantity for each currency
addr true string Withdrawal address Currency legal address
memo false string Withdrawal label Some currency withdrawals must specify a label, which is unique in combination with the address, such as EOS

Response

{
    "state":0,
    "result":228,
    "cmd":"transfer/transferOut"
}
Name Description
state 0 means success, otherwise means failure
result withdrawal id
Other fields Ignore

Query deposit records

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/transfer/transferInList";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    coin_symbol:'USDT',
    filter_type: 0,
    page: 1,
    size: 10
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests


API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/transfer/transferInList'
    body = {
        'coin_symbol': 'USDT',
        'filter_type': 0,
        'page': 1,
        'size': 10
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/transfer/transferInList";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "USDT",
                filter_type = 0,
                page = 1,
                size = 10,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/transfer/transferInList

Name Necessary or not Type Description Default value Value range
filter_type false integer deposit record filter 0 0-all, 1-deposit in progress, 2-deposit received, 3-deposit failed
coin_symbol false string Deposit currency BIX, ETH, ...
page true integer page number starting from 1
size true integer number per page 1-50

Response

{
    "result":{
        "count":1,
        "page":1,
        "items":[
            {
                "id":1682192,
                "to":"TXLhYFsWu84vU5ngs8J88yphTPdv69zrqoD",
                "tx_id":"a8f77b3a20758d85f71f2d993766c9b6c2daf1b1f34992e409e1a47247e5a5e45",
                "coin_symbol":"USDT",
                "chain_type":"TRC20",
                "confirmCount":"20",
                "amount":"0.00094400",
                "createdAt":1596876872000,
                "status":2
            }
        ]
    },
    "cmd":"transferInList",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
count The number of records on the current page, if there is a next page, count=the number of records on the current page+1
page page number, starting from 1
items records
coin_symbol currency
to_address deposit address
amount deposit amount
confirmCount deposit confirmation number
createdAt deposit time
status deposit status, 1-deposit in progress, 2-deposit received, 3-deposit failed
Other fields Ignore

Query withdrawal records

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/transfer/transferOutList";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    coin_symbol:'USDT',
    filter_type: 2,
    page: 1,
    size: 10
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests


API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/transfer/transferOutList'
    body = {
        'coin_symbol': 'USDT',
        'filter_type': 2,
        'page': 1,
        'size': 10
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/transfer/transferOutList";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "USDT",
                filter_type = 2,
                page = 1,
                size = 10,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/transfer/transferOutList

Name Necessary or not Type Description Default value Value range
filter_type false integer Withdrawal record screening -2: failed review; -1: user cancelled; 0: pending review; 1: approved (to be issued currency); 2: currency issued; 3: currency issued Complete
coin_symbol false string Withdrawal currency BIX, ETH, ...
page true integer page number starting from 1
size true integer number per page 1-50

Response

{
    "result":{
        "count":1,
        "page":1,
        "items":[
            {
                "id":809022,
                "to_address":"0x606a84A14307418F47C6ad538b5E73C93Ff9C8Cf",
                "tx_id":"0xd3cf26d514c1e62f85de84b4e24fbd219084dd078daa7e639844c33cdf81bd62b",
                "coin_symbol":"USDT",
                "chain_type":"ERC20",
                "amount_real":"1000.00000000",
                "amount":"1003.00000000",
                "createdAt":1596876972000,
                "memo":"",
                "status":2
            }
        ]
    },
    "cmd":"transferOutList",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
count The number of records on the current page, if there is a next page, count=the number of records on the current page+1
page page number, starting from 1
items records
coin_symbol currency
to_address Withdrawal address
amount Withdrawal amount
fee Withdrawal fee
createdAt deposit time
memo memo
status status, 1-withdrawal in progress, 2-withdrawal received, 3-withdrawal failed, 4-withdrawal cancelled
Other fields Ignore

Get currency configuration

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/transfer/coinConfig";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests


API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/transfer/coinConfig'
    body = {

    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/transfer/coinConfig";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {

             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/transfer/coinConfig

Name Necessary or not Type Description Default value Value range
coin_symbol false string currency type BIX, ETH...

Response

{
    "result":[
        {
            "coin_symbol":"BTC",
            "is_active":1,
            "original_decimals":8,
            "enable_deposit":1,
            "enable_withdraw":1,
            "withdraw_fee":0.0008,
            "withdraw_min":0.005
        }
    ],
    "cmd":"coinConfig",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
coin_symbol currency
original_decimals Currency original value precision
enable_deposit Whether it can be depositd, 0-prohibited, 1-can
enable_withdraw Whether withdrawal is possible, 0-forbidden, 1-yes
withdraw_fee Withdrawal fee
withdraw_min Minimum withdrawal amount
Other fields Ignore

Query a certain withdrawal record

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/transfer/withdrawInfo";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    id: 228
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests


API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/transfer/withdrawInfo'
    body = {
        'id': 228
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/transfer/withdrawInfo";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                id = 228,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/transfer/withdrawInfo

Name Necessary or not Type Description Default value Value range
id true integer withdrawal id

Response

{
    "state":0,
    "result":{
      "id":228,
        "createdAt": 1512756997000,
        "coin_symbol":"LTC",
        "to_address":"xxxxxxxxxxxxxxxxxxxxxxxxxx",
        "status":3,
        "amount":"1.00000000",
        "fee":0.1
    },
    "cmd":"withdrawInfo"
}
Name Description
state 0 means success, otherwise means failure
id withdrawal id
coin_symbol currency
createdAt Withdrawal time
to_address Withdrawal address
status Status, -2: Approval failed; -1: User canceled; 0: Pending approval; 1: Approved (to be issued coins); 2: In the process of issuing coins; 3: Issuing coins completed
amount Withdrawal amount
fee Withdrawal fee
Other fields Ignore

Spot Trade(Need ApiKey)

Place an order

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3/spot/order/trade";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    pair:'BIX_USDT',
    order_side: 2,
    order_type: 2,
    price: 0.05458,
    amount: 100
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3/spot/order/trade'
    body = {
        'pair': 'BIX_USDT',
        'order_side': 2,
        'order_type': 2,
        'price': 0.05458,
        'amount': 100
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3/spot/order/trade";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BIX_USDT",
                order_side = 2,
                order_type = 2,
                price = "0.05458",
                amount = "100",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3/spot/order/trade

Name Necessary or not Type Description Default value Value range
pair true string trading pair BIX_BTC, ETH_BTC, ...
order_type true integer Trading type 2-Limit order
order_side true integer Trading direction 1-buy, 2-sell
price true double order price minimum value 0.00000001
amount true double order amount minimum 0.0001
client_oid false long to string User-defined id '110011223344'

Response

{
    "order_id":"12845594488036185",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
order_id order id
status Status, -1 Failed 0 or 1-Pending, 2-Partially completed, 3-Completely completed, 4-Partially cancelled, 5-Completely cancelled
Other fields Ignore

Cancel an order

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3/spot/order/cancel";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    orders_id: "12845594488036185"
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3/spot/order/cancel'
    body = {
        'orders_id': "12845594488036185"
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3/spot/order/cancel";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                orders_id = "12845594488036185",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3/spot/order/cancel

Name Necessary or not Type Description Default value Value range
orders_id true string order id

Response

{
    "result":"success",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
result Note: The result only means that the server has received an order cancellation request, and the order record can be queried from the cancellation result
Other fields Ignore

Cancel some orders

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3/spot/order/cancelBatch";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    order_ids:["12845594488036185","12845594488036186"]
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,
        method: "POST",
        headers: {
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3/spot/order/cancelBatch'
    body = {
        'order_ids': ["12845594488036185","12845594488036186"]
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3/spot/order/cancelBatch";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                order_ids = new [] {"12845594488036185", "12845594488036186"},
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3/spot/order/cancelBatch

Name Necessary or not Type Description Default value Value range
order_ids true string array order id array

Response

{
    "result":"success",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
result Note: The result only means that the server has received an order cancellation request, and the order record can be queried from the cancellation result
Other fields Ignore

Cancel all orders

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3/spot/order/cancelAll";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "pair": "BTC_USDT"
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,
        method: "POST",
        headers: {
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3/spot/order/cancelAll'
    body = {
        "pair": "BTC_USDT"
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3/spot/order/cancelAll";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BTC_USDT"
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3/spot/order/cancelAll

Name Necessary or not Type Description Default value Value range
pair true string Trading pair BIX_BTC, ETH_BTC, ...

Response

{
    "result":"success",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
result Note: The result only means that the server has received an order cancellation request, and the order record can be queried from the cancellation result
Other fields Ignore

Get open orders

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/orderpending/orderPendingList";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    pair:'BIX_USDT',
    account_type: 0,
    page: 1,
    size: 10
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/orderpending/orderPendingList'
    body = {
        'pair': 'BIX_USDT',
        'account_type': 0,
        'page': 1,
        'size': 10
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/orderpending/orderPendingList";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BIX_USDT",
                account_type = 0,
                page = 1,
                size = 10,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/orderpending/orderPendingList

Name Necessary or not Type Description Default value Value range
pair false string Trading pair BIX_BTC, ETH_BTC, ...
account_type true integer account type 0-spot account
order_side false integer Trading direction 1-Buy, 2-Sell
coin_symbol false string Trading currency BIX, EOS, ...
currency_symbol false string Pricing currency BTC, USDT, ...
page true integer page number starting from 1
size true integer number per page 1-50

Response

{
    "result":{
        "count":1,
        "page":1,
        "items":[
            {
                "id":"12874181782731851",
                "createdAt":1604309861000,
                "account_type":0,
                "pair":"BIX_USDT",
                "coin_symbol":"BIX",
                "currency_symbol":"USDT",
                "order_side":2,
                "order_type":2,
                "price":"0.054330",
                "deal_price":"0.000000",
                "amount":"100.0000",
                "money":"5.43300000",
                "deal_amount":"0.0000",
                "deal_percent":"0.00%",
                "deal_money":"0.00000000",
                "deal_count":0,
                "status":1,
                "unexecuted":"100.0000"
            }
        ]
    },
    "cmd":"orderPendingList",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
count The number of records on the current page, if there is a next page, count=the number of records on the current page+1
page page number, starting from 1
items records
id order id
createdAt Creation time
account_type Account type 0-spot account
coin_symbol Trading currency
currency_symbol Pricing currency
order_side Trading direction, 1-buy, 2-sell
order_type Order type, 1-market order, 2-limit order
price Order price, market order is 0
amount Order quantity
money Order value
deal_amount Deal quantity
deal_percent Deal percentage
unexecuted Unexecuted quantity
status Status, -1 Failed 0 or 1-Pending, 2-Partially completed, 3-Completely completed, 4-Partially cancelled, 5-Completely cancelled
Other fields Ignore

Get historical orders

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/orderpending/pendingHistoryList";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    pair:'BIX_USDT',
    account_type: 0,
    page: 1,
    size: 10
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/orderpending/pendingHistoryList'
    body = {
        'pair': 'BIX_USDT',
        'account_type': 0,
        'page': 1,
        'size': 10
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/orderpending/pendingHistoryList";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BIX_USDT",
                account_type = 0,
                page = 1,
                size = 10,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/orderpending/pendingHistoryList

Name Necessary or not Type Description Default value Value range
pair false string Trading pair BIX_BTC, ETH_BTC, ...
account_type true integer account type 0-spot account
order_side false integer Trading direction 1-Buy, 2-Sell
coin_symbol false string Trading currency BIX, EOS, ...
currency_symbol false string Pricing currency BTC, USDT, ...
hide_cancel false integer hide cancelled orders 0-not hide, 1-hidden
page true integer page number starting from 1
size true integer number per page 1-50

Response

{
    "result":{
        "count":11,
        "page":1,
        "items":[
            {
                "id":"12845594488036185",
                "createdAt":1604305967000,
                "account_type":0,
                "coin_symbol":"BIX",
                "currency_symbol":"USDT",
                "order_side":2,
                "order_type":2,
                "price":"0.054580",
                "amount":"100.0000",
                "money":"5.45800000",
                "deal_price":"0.000000",
                "deal_amount":"0.0000",
                "deal_money":"0.00000000",
                "status":5
            }
        ]
    },
    "cmd":"pendingHistoryList",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
count The number of records on the current page, if there is a next page, count=the number of records on the current page+1
page page number, starting from 1
items records
id order id
createdAt Creation time
account_type Account type 0-spot account
coin_symbol Trading currency
currency_symbol Pricing currency
order_side Trading direction, 1-buy, 2-sell
order_type Order type, 1-market order, 2-limit order
price Order price
amount Order quantity
money Order value
deal_price Average deal price
deal_amount Deal quantity
deal_money Deal value
deal_percent Deal percentage
status Status, -1 Failed 0 or 1-Pending, 2-Partially completed, 3-Completely completed, 4-Partially cancelled, 5-Completely cancelled
Other fields Ignore

Get deal records(based on order id)

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/orderpending/orderDetail";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    id: "12826902662624234",
    account_type: 0
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/orderpending/orderDetail'
    body = {
        'id': '12826902662624234',
        'account_type': 0,
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/orderpending/orderDetail";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                id = "12826902662624234",
                account_type = 0,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/orderpending/orderDetail

Name Necessary or not Type Description Default value Value range
id true string order id
account_type true integer account type 0-spot account

Response

{
    "result":{
        "sum":"3.57490350",
        "orderList":[
            {
                "id":"2251799823470863898",
                "createdAt":1599730918000,
                "account_type":0,
                "coin_symbol":"BIX",
                "currency_symbol":"USDT",
                "order_side":1,
                "order_type":2,
                "price":"0.071300",
                "amount":"0.4825",
                "money":"0.03440225",
                "pay_bix":0,
                "fee_symbol":"BIX",
                "fee":"0.00000000",
                "is_maker":0,
                "relay_id":"12826902662624234"
            },
            {
                "id":"2251799823470863900",
                "createdAt":1599730918000,
                "account_type":0,
                "coin_symbol":"BIX",
                "currency_symbol":"USDT",
                "order_side":1,
                "order_type":2,
                "price":"0.071500",
                "amount":"39.8408",
                "money":"2.84861720",
                "pay_bix":0,
                "fee_symbol":"BIX",
                "fee":"0.00000000",
                "is_maker":0,
                "relay_id":"12826902662624234"
            },
            {
                "id":"2251799823470863902",
                "createdAt":1599730918000,
                "account_type":0,
                "coin_symbol":"BIX",
                "currency_symbol":"USDT",
                "order_side":1,
                "order_type":2,
                "price":"0.071500",
                "amount":"9.6767",
                "money":"0.69188405",
                "pay_bix":0,
                "fee_symbol":"BIX",
                "fee":"0.00000000",
                "is_maker":0,
                "relay_id":"12826902662624234"
            }
        ]
    },
    "cmd":"orderDetail",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
sum Total turnover
orderList Deal records
id Deal record id
createdAt Deal record time
account_type Account type, 0-spot account
coin_symbol Trading currency
currency_symbol Pricing currency
order_side Trading direction, 1-buy, 2-sell
order_type Order type, 1-market order, 2-limit order
price Deal price
amount Deal amount
money Deal value
pay_bix Wether pay fee with BIX, 0 not activated, 1 activated
fee_symbol fee currency
fee fee
is_maker Whether is maker, 0-No, 1-Yes
relay_id associated order id
Other fields Ignore

Get an order detail

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/orderpending/order";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    id: "12845594488036185",
    account_type: 0
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/orderpending/order'
    body = {
        'id': '12845594488036185',
        'account_type': 0,
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/orderpending/order";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                id = "12845594488036185",
                account_type = 0,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/orderpending/order

Name Necessary or not Type Description Default value Value range
id true string order id
account_type true integer account type 0-spot account

Response

{
    "result":{
        "id":"12845594488036185",
        "createdAt":1604305967000,
        "account_type":0,
        "pair":"BIX_USDT",
        "coin_symbol":"BIX",
        "currency_symbol":"USDT",
        "order_side":2,
        "order_type":2,
        "price":"0.054580",
        "deal_price":"0.000000",
        "amount":"100.0000",
        "money":"5.45800000",
        "deal_amount":"0.0000",
        "deal_percent":"0.00%",
        "deal_money":"0.00000000",
        "deal_count":0,
        "status":5,
        "unexecuted":"100.0000"
    },
    "cmd":"order",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
id order id
createdAt Creation time
account_type Account type 0-spot account
pair Trading pair
coin_symbol Trading currency
currency_symbol Pricing currency
order_side Trading direction, 1-buy, 2-sell
order_type Order type, 1-market order, 2-limit order
price Order price, market order is 0
amount Order quantity
money Order value
deal_amount Dealed quantity
deal_percent Deal percentage
unexecuted Unexecuted quantity
status Status, -1 Failed 0 or 1-Pending, 2-Partially completed, 3-Completely completed, 4-Partially cancelled, 5-Completely cancelled
Other fields Ignore

Get deal records

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/orderpending/orderHistoryList";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    pair:'BIX_USDT',
    account_type: 0,
    page: 1,
    size: 10
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/orderpending/orderHistoryList'
    body = {
        'pair': 'BIX_USDT',
        'account_type': 0,
        'page': 1,
        'size': 10
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/orderpending/orderHistoryList";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BIX_USDT",
                account_type = 0,
                page = 1,
                size = 10,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/orderpending/orderHistoryList

Name Necessary or not Type Description Default value Value range
pair false string Trading pair BIX_BTC, ETH_BTC, ...
account_type true integer account type 0-spot account
order_side false integer Trading direction 1-Buy, 2-Sell
coin_symbol false string Trading currency BIX, EOS, ...
currency_symbol false string Pricing currency BTC, USDT, ...
page true integer page number starting from 1
size true integer number per page 1-50

Response

{
    "result":{
        "count":1,
        "page":1,
        "items":[
            {
                "id":"2251799823470863902",
                "createdAt":1599730918000,
                "account_type":0,
                "coin_symbol":"BIX",
                "currency_symbol":"USDT",
                "order_side":1,
                "order_type":2,
                "price":"0.071500",
                "amount":"9.6767",
                "money":"0.69188405",
                "pay_bix":0,
                "fee_symbol":"BIX",
                "fee":"0.00000000",
                "is_maker":0,
                "relay_id":"12826902662624234"
            }
        ]
    },
    "cmd":"orderHistoryList",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
sum Total turnover
orderList Deal records
id Deal record id
createdAt Deal record time
account_type Account type, 0-spot account
coin_symbol Trading currency
currency_symbol Pricing currency
order_side Trading direction, 1-buy, 2-sell
order_type Order type, 1-market order, 2-limit order
price Deal price
amount Deal amount
money Deal value
pay_bix Wether pay fee with BIX, 0 not activated, 1 activated
fee_symbol fee currency
fee fee
is_maker Whether is maker, 0-No, 1-Yes
relay_id associated order id
Other fields Ignore

Get the latest deal records

Query the deal records after the specified id number, and return 1000 records per page

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/orderpending/orderDetailsLast";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842";

let param = {
    pair:'BIX_USDT',
    account_type: 0,
    page: 1,
    id:"2251799823470863900"
};

let cmd = JSON.stringify(param); //format param
let timestamp ='' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//request path
        method: "POST",//Request method
        headers: {//Set request header
            'content-type':'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//post parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/orderpending/orderDetailsLast'
    body = {
        'pair': 'BIX_USDT',
        'account_type': 0,
        'page': 1,
        'id': "2251799823470863900"
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/orderpending/orderDetailsLast";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BIX_USDT",
                account_type = 0,
                page = 1,
                id = "2251799823470863900",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/orderpending/orderDetailsLast

Name Necessary or not Type Description Default value Value range
pair false string Trading pair BIX_BTC, ETH_BTC, ...
account_type true integer account type 0-spot account
id true string id number at the beginning of the Trading record greater than "1000000000"
page true integer page number starting from 1

Response

{
    "result":{
        "count":2,
        "page":1,
        "items":[
            {
                "id":"2251799823470863902",
                "createdAt":1599730918000,
                "account_type":0,
                "coin_symbol":"BIX",
                "currency_symbol":"USDT",
                "order_side":1,
                "order_type":2,
                "price":"0.071500",
                "amount":"9.6767",
                "money":"0.69188405",
                "pay_bix":0,
                "fee_symbol":"BIX",
                "fee":"0.00000000",
                "is_maker":0,
                "relay_id":"12826902662624234"
            },
            {
                "id":"2251799825448005865",
                "createdAt":1604312287000,
                "account_type":0,
                "coin_symbol":"BIX",
                "currency_symbol":"USDT",
                "order_side":2,
                "order_type":2,
                "price":"0.054330",
                "amount":"100.0000",
                "money":"5.43300000",
                "pay_bix":0,
                "fee_symbol":"USDT",
                "fee":"0.00000000",
                "is_maker":1,
                "relay_id":"12874181782731851"
            }
        ]
    },
    "cmd":"orderDetailsLast",
    "state":0
}
Name Description
state 0 means success, otherwise means failure
sum Total turnover
orderList Deal records
id Deal record id
createdAt Deal record time
account_type Account type, 0-spot account
coin_symbol Trading currency
currency_symbol Pricing currency
order_side Trading direction, 1-buy, 2-sell
order_type Order type, 1-market order, 2-limit order
price Deal price
amount Deal amount
money Deal value
pay_bix Wether pay fee with BIX, 0 not activated, 1 activated
fee_symbol fee currency
fee fee
is_maker Whether is maker, 0-No, 1-Yes
relay_id associated order id
Other fields Ignore

Transfer Assets(Need ApiKey)

Wallet to Spot

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); 

let param = {
    "type": 0,
    "amount": "100",
    "symbol": 'USDT'
};

let strParam = JSON.stringify(param);

let strToSign = '' + timestamp + strParam; 

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; 
let sign = CryptoJS.HmacMD5(strToSign, secret).toString()

let url = "https://api.bibox.com/v3/assets/transfer/spot";

request.post({
        url: url,
        method: "POST",
        headers: {
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam 
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_reqeust():
    path = '/v3/assets/transfer/spot'
    body = {
        "type": 0,
        "amount": "100",
        "symbol": 'USDT'
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_reqeust()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
       {
           HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
           byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
           StringBuilder sb = new StringBuilder();

           for (int i = 0; i < inArray.Length; i++)
           {
               sb.Append(inArray[i].ToString("X2"));
           }

           hmacmd.Clear();

           return sb.ToString().ToLower();
       }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3/assets/transfer/spot";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                type = 0,
                amount = "100",
                symbol = "USDT",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3/assets/transfer/spot

Name Necessary Type Description Default Range
symbol true string
amount false string
type false int 0wallet to spot; 1 spot to wallet

Response

{}

Wallet to Leverage

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); 

let param = {
    "pair": "*_USDT",
    "amount": 100,
    "symbol": 'USDT'
};

let strParam = JSON.stringify(param); 

let strToSign = '' + timestamp + strParam; 

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; 
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();

let url = "https://api.bibox.com/v3.1/credit/transferAssets/base2credit";

request.post({
        url: url,
        method: "POST",
        headers: {
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam 
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/transferAssets/base2credit'
    body = {
        "pair": "*_USDT",
        "amount": 100,
        "symbol": 'USDT'
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/transferAssets/base2credit";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "*_USDT",
                amount = "100",
                symbol = "USDT",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/transferAssets/base2credit

Name Necessary Type Description Default Range
coin_symbol true string
amount false double
pair false string EOS_USDT,BTC_USDT, *_USDT...

Response

{}

Leverage to Wallet

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); 

let param = {
    "pair": "BTC_USDT",
    "amount": 100,
    "symbol": 'USDT'
};

let strParam = JSON.stringify(param); 

let strToSign = '' + timestamp + strParam; 

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; 
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();

let url = "https://api.bibox.com/v3.1/credit/transferAssets/credit2base";

request.post({
        url: url,
        method: "POST",
        headers: {
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam 
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/transferAssets/credit2base'
    body = {
        "pair": "BTC_USDT",
        "amount": 100,
        "symbol": 'USDT'
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/transferAssets/credit2base";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BTC_USDT",
                amount = "100",
                symbol = "USDT",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/transferAssets/credit2base

Name Necessary Type Description Default Range
coin_symbol true string
amount false double
pair false string EOS_USDT,BTC_USDT, *_USDT...

Response

{}

Credit/Leverage(Need ApiKey)

Lend Order

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "page":1,
    "status":[
        0,
        1
    ],
    "coin_symbol":"USDT",
    "size":1
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/lendOrder/get";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/lendOrder/get'
    body = {
        "page": 1,
        "status": [
            0,
            1
        ],
        "coin_symbol": "USDT",
        "size": 1
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/lendOrder/get";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "USDT",
                size = 1,
                page = 1,
                status = new [] {0, 1},
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/lendOrder/get

Name Necessary Type Description Default Range
coin_symbol true string
status false int 0-normal 1-part 2-finish
page false int
size false int

Response

{
    "count": 2,
    "page": 1,
    "items": [
        {
            "id": 14,
            "user_id": 8114202916,
            "coin_id": 60,
            "coin_symbol": "USDT",
            "amount": "1000.00000000",
            "amount_receipt": "0.00000000",
            "interest_rate": "0.00200000",
            "insurance_rate": "0.10000000",
            "fee": "0.00000000",
            "insurance": "0.00000000",
            "interest": "2.33333324",
            "interest_receipt": "0.00000000",
            "period": 7,
            "expireAt": "2019-11-18T03:00:00.000Z",
            "status": 0,
            "createdAt": "2019-11-11T03:50:47.000Z",
            "days": 1
        }
    ],
    "validSymbols": [
        "USDT"
    ]
}

Name Description
coin_symbol
amount lend amount
amount_receipt receipt
interest_rate interest rate
insurance_rate insurance
fee fee
insurance insurance
interest interest
status 0:normal,part,finish

Borrow Order

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "page":1,
    "status":[
        1,
        2
    ],
    "size":10,
    "pair":"BTC_USDT"
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/borrowOrder/get";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/borrowOrder/get'
    body = {
        "page": 1,
        "status": [
            1,
            2
        ],
        "size": 10,
        "pair": "BTC_USDT"
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/borrowOrder/get";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BTC_USDT",
                size = 10,
                page = 1,
                status = new [] {1, 2},
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/borrowOrder/get

Name Necessary Type Description Default Range
coin_symbol true string USDT, EOS...
pair true string BTC_USDT, ETH_USDT, *_USDT cross
status true int or Array status 1Normal, 2Part, 3-6Finish
page true integer
size true integer 1-50

Response

{
    "count": 2,
    "page": 1,
    "items": [
        {
            "id": 539354,
            "user_id": 8114202916,
            "coin_id": 60,
            "coin_symbol": "USDT",
            "pair": "BTC_USDT",
            "amount": "406.00000000",
            "amount_refund": "0.00000000",
            "interest_rate": "0.00010000",
            "interest_rate_hour": "0.00000417",
            "interest": "0.26559180",
            "interest_refund": "0.00000000",
            "period": 7,
            "expireAt": "2019-11-15T11:00:00.000Z",
            "status": 1,
            "createdAt": "2019-11-08T11:53:15.000Z"
        }
    ],
    "validSymbols": [
        {
            "coin_symbol": "USDT",
            "pair": "BTC_USDT"
        }
    ]
}

Name Description
coin_symbol
pair
amount borrow amount
amount_refund borrow refund
interest_rate interest rate
interest interest
interest_refund refund
status 1normal,2part,3finish

LendOrder Pending

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "page":1,
    "status":[
        0,
        1
    ],
    "coin_symbol":"EOS",
    "size":50
}

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/lendOrderbook/get";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/lendOrderbook/get'
    body = {
        "page": 1,
        "status": [
            0,
            1
        ],
        "coin_symbol": "EOS",
        "size": 50
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/lendOrderbook/get";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "EOS",
                size = 50,
                page = 1,
                status = new [] {0, 1},
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/lendOrderbook/get

Name Necessary Type Description Default Range
coin_symbol true string USDT, EOS, ...
status true integer or integerArray status 0未成交, 1部分成交, 2已完成
page true integer
size true integer 1-50

Response

{
    "count":1,
    "page":1,
    "items":[
        {
            "id":1,
            "user_id":10000000,
            "coin_id":61,
            "coin_symbol":"EOS",
            "amount":5,
            "amount_finish":0,
            "interest_rate":0.001,
            "period":7,
            "expireAt":"2018-12-29T10:59:18.000Z", 
            "status":0,
            "createdAt":"2018-12-22T10:59:18.000Z" 
        }
    ],
    "validSymbols":[
        "EOS"
    ]
}

Name Description
coin_symbol
amount unfill amount
amount_finish finish amount
interest_rate interest rate

Lend Assets

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "coin_symbol":"EOS"
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/transferAssets/lendAssets";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/transferAssets/lendAssets'
    body = {
        "coin_symbol": "EOS"
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/transferAssets/lendAssets";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "EOS",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/transferAssets/lendAssets

Name Necessary Type Description Default Range
coin_symbol true string

Response

{
    "balance":"1.52319980",
    "lend":"0.00000000",
    "lend_book":"0.00000000",
    "interest":"0.00000000",
    "lend_receipt":"1.44000000",
    "interest_receipt":"0.16115200" 
}

Name Description
balance avaliable
lend lend
lend_book pending
interest interest
lend_receipt receipt
interest_receipt interest

Borrow Assets

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "pair":"BTC_USDT",
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/transferAssets/borrowAsset";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/transferAssets/borrowAsset'
    body = {
        "pair": "BTC_USDT",
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/transferAssets/borrowAsset";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                pair = "BTC_USDT",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/transferAssets/borrowAssets

Name Necessary Type Description Default Range
pair true string BTC_USDT, ETH_USDT, *_USDT cross

Response

{
    "pair": "BTC_USDT",
    "currency_deposit": "8406.00000000",
    "currency_borrow": "506.34642529",
    "currency_can_borrow": "70590.53574710",
    "margin_radio": "1660.13",
    "max_leverage_ratio": 10, 
    "current_leverage_radio": "2",
    "force_deal_radio": 110,
    "force_price": "0",
    "items": [
        {
            "coin_symbol": "BTC",
            "coin_id": 42,
            "balance": "0.00000000",
            "freeze": "0.00000000",
            "borrow": "0",
            "can_transfer_credit": "0.00000000",
            "can_transfer_main": "0",
            "can_borrow": "8.82381696",
            "borrow_book": "0",
            "force_price": "0",
            "bust_price": "0",
            "price": "8000",
            "interest": "0",
            "total": "0.00000000"
        },
        {
            "coin_symbol": "USDT",
            "coin_id": 60,
            "balance": "8406.00000000",
            "freeze": "0.00000000",
            "borrow": "506.34642529",
            "can_transfer_credit": "7494.57643447",
            "can_transfer_main": "5000.00000000",
            "can_borrow": "70590.53574710",
            "borrow_book": "0",
            "force_price": "0",
            "bust_price": "0",
            "price": "1",
            "interest": "0.34642529",
            "total": "8406.00000000"
        }
    ]
}

Name Description
pair
currency_deposit all amount
currency_borrow borrow amount
currency_can_borrow can borrow
margin_radio margin radio
current_leverage_radio current_leverage
force_deal_radio force deal radio
force_price force price(isolated)
balance avaliable
freeze freeze
borrow borrow
interest interest

Borrow

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "coin_symbol": "BTC",
    "pair": "BTC_USDT",
    "amount":"5.0036"
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/borrowOrder/autobook";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/borrowOrder/autobook'
    body = {
        "coin_symbol": "BTC",
        "pair": "BTC_USDT",
        "amount": "5.0036"
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/borrowOrder/autobook";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "BTC",
                pair = "BTC_USDT",
                amount = "5.0036",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/borrowOrder/autobook

Name Necessary Type Description Default Range
coin_symbol true string EOS, BTC, USDT
pair true string BTC_USDT, *_USDT
amount true double

Response

{}

Refund

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "coin_symbol": "BTC",
    "pair": "BTC_USDT",
    "amount":"5.0036"
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/borrowOrder/refund";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/borrowOrder/refund'
    body = {
        "coin_symbol": "BTC",
        "pair": "BTC_USDT",
        "amount": "5.0036"
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/borrowOrder/refund";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "BTC",
                pair = "BTC_USDT",
                amount = "5.0036",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/borrowOrder/refund

Name Necessary Type Description Default Range
coin_symbol true string EOS, BTC, USDT
pair true string BTC_USDT, *_USDT
amount true double

Response

{}

Publish Lend

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "coin_symbol":"EOS",
    "amount":"5",
    "interest_rate":0.001,
    "is_insurance":1,
    "force":1
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/lendOrderbook/publish";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/lendOrderbook/publish'
    body = {
        "coin_symbol": "EOS",
        "amount": "5",
        "interest_rate": 0.001,
        "is_insurance": 1,
        "force": 1
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/lendOrderbook/publish";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                coin_symbol = "EOS",
                amount = "5",
                interest_rate = "0.001",
                is_insurance = 1,
                force = 1,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/lendOrderbook/publish

Name Necessary Type Description Default Range
coin_symbol true string USDT, EOS, ...
amount true double
interest_rate true double
is_insurance true integer 0 or 1
force true integer 1

Response

{}

Cancel LendOrder

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
     "orderbook_id":9064
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/lendOrderbook/cancel";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/lendOrderbook/cancel'
    body = {
        "orderbook_id": 9064
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/lendOrderbook/cancel";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                orderbook_id = "9064",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/lendOrderbook/cancel

Name Necessary Type Description Default Range
orderbook_id true integer order id

Response

{}

Credit Trade

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "account_type":1,
    "pair":"BTC_USDT",
    "order_type":2,
    "price":"100",
    "amount":"1",
    "money":"100.0000",
    "order_side":1
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/trade/trade";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/trade/trade'
    body = {
        "account_type": 1,
        "pair": "BTC_USDT",
        "order_type": 2,
        "price": "100",
        "amount": "1",
        "money": "100.0000",
        "order_side": 1
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/trade/trade";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                account_type = 1,
                pair = "BTC_USDT",
                order_type = 2,
                price = "100",
                amount = "1",
                money = "100.0000",
                order_side = 1,
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/trade/trade

Name Necessary Type Description Default Range
pair string 交易对
account_type integer 1-isolate 257-cross
order_type integer 2-limit
order_side integer 1-buy,2-sell
price string price min 0.00000001
amount string amount min 0.0001
money string price*amount

Response

{}

Name Description
orders_id order id

Cancel

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.timestamp

let param = {
    "orders_id": "4631142976192513" 
};

let strParam = JSON.stringify(param); // 2.params

let strToSign = '' + timestamp + strParam; // 3.signed params

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; 
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.signed

let url = "https://api.bibox.com/v3.1/credit/trade/cancel";

request.post({
        url: url,//path
        method: "POST",//method
        headers: {//5.headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.params
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 

    });

# -*- coding:utf-8 -*-
import hashlib
import hmac
import json
import time
import requests

API_KEY = '900625568558820892a8c833c33ebc8fd2701efe'
SECRET_KEY = 'c708ac3e70d115ec29efbee197330627d7edf842'
BASE_URL = 'https://api.bibox.com'  # 'https://api.bibox.tel' #


def do_sign(body):
    timestamp = int(time.time()) * 1000
    # to_sign = str(timestamp)+json.dumps(body,separators=(',',':'))
    to_sign = str(timestamp) + json.dumps(body)
    sign = hmac.new(SECRET_KEY.encode("utf-8"), to_sign.encode("utf-8"), hashlib.md5).hexdigest()
    print(to_sign)

    headers = {
        'bibox-api-key': API_KEY,
        'bibox-api-sign': sign,
        'bibox-timestamp': str(timestamp)
    }
    return headers


def do_request():
    path = '/v3.1/credit/trade/cancel'
    body = {
         "orders_id": "4631142976192513"
    }
    headers = do_sign(body)
    resp = requests.post(BASE_URL + path, json=body, headers=headers)
    print(resp.text)


if __name__ == '__main__':
    do_request()

using System;
using System.Net.Http;
using System.Text;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace ConsoleProgram
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

    public class Class1
    {

        // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
        static readonly HttpClient client = new HttpClient();

        static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }

        static string HmacMD5(string source, string key)
               {
                   HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(key));
                   byte[] inArray = hmacmd.ComputeHash(Encoding.Default.GetBytes(source));
                   StringBuilder sb = new StringBuilder();

                   for (int i = 0; i < inArray.Length; i++)
                   {
                       sb.Append(inArray[i].ToString("X2"));
                   }

                   hmacmd.Clear();

                   return sb.ToString().ToLower();
               }

        static async Task Main()
        {
          // Call asynchronous network methods in a try/catch block to handle exceptions.
          try
          {
             string uri = "https://api.bibox.com/v3.1/credit/trade/cancel";
             string apikey = "900625568558820892a8c833c33ebc8fd2701efe";
             string secret = "c708ac3e70d115ec29efbee197330627d7edf842";

             string timestamp = GetTimeStamp();
             var myobj = new {
                orders_id = "4631142976192513",
             };

             string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

             string source = timestamp + payload;
             string sign = HmacMD5(source, secret);

             Console.WriteLine(source);
             Console.WriteLine(sign);

             client.DefaultRequestHeaders.Add("bibox-api-key", apikey);
             client.DefaultRequestHeaders.Add("bibox-api-sign", sign);
             client.DefaultRequestHeaders.Add("bibox-timestamp", timestamp);

             HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");

             HttpResponseMessage response = await client.PostAsync(uri, content);
             response.EnsureSuccessStatusCode();
             string responseBody = await response.Content.ReadAsStringAsync();

             Console.WriteLine(responseBody);
          }
          catch(HttpRequestException e)
          {
             Console.WriteLine("\nException Caught!");
             Console.WriteLine("Message :{0} ",e.Message);
          }
        }

    }
}

POST https://api.bibox.com/v3.1/credit/trade/cancel

Name Necessary Type Description Default Range
orders_id true string orderid

Response

{}

WebSocket

Subscribe to Kline data

Example


'use strict'

const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://npush.bibox360.com';


let wsClass = function () {

};

wsClass.prototype._decodeMsg = function (data) {
    let data1 = data.slice(1, data.length);
    zlib.unzip(data1, (err, buffer) => {
        if (err) {
            console.log(err);
        } else {
            try {
                let res = JSON.parse(buffer.toString());
                console.log(new Date(), buffer.toString());
            } catch (e) {
                console.log(e);
            }
        }
    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    console.log(biboxws)
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        ws.send(JSON.stringify({
            sub: 'BTC_USDT_kline_1min',
        }));
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        if (data[0] == '1') {
            that._decodeMsg(data);
        } else if (data[0] == '0') {
            console.log(1, new Date(), JSON.parse(data.slice(1)));
        } else {
            console.log(2, new Date(), data);
        }

    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

# /usr/bin/env python
# -*- coding: UTF-8 -*-

import websocket # websocket-client
import json
import zlib

ws_url = 'wss://npush.bibox360.com'


def stringify(obj):
    return json.dumps(obj, sort_keys=True).replace("\'", "\"").replace(" ", "")


def get_sub_str():
    subdata = {
        'sub': 'BTC_USDT_kline_1min',
    }
    # print(stringify(subdata))
    return stringify(subdata)


def get_unsub_str():
    subdata = {
        'unsub': 'BTC_USDT_kline_1min',
    }
    return stringify(subdata)


def decode_data(message):
    if message[0] == '\x01' or message[0] == 1:
        message = message[1:]
        data = zlib.decompress(message, zlib.MAX_WBITS | 32)
        jmsgs = json.loads(data)
        print(jmsgs)
        print(type(jmsgs))
    elif message[0] == '\x00' or message[0] == 0:
        message = message[1:]
        jmsgs = json.loads(message)
        print(jmsgs)
        print(type(jmsgs))
    else:
        jmsgs = json.loads(message)
        print(jmsgs)
        print(type(jmsgs))


def on_message(ws, message):
    # print(message)
    decode_data(message)


def on_error(ws, error):
    print(error)


def on_close(ws):
    print("### closed ###")


def on_open(ws):
    ws.send(get_sub_str())


def connect():
    websocket.enableTrace(True)
    ws = websocket.WebSocketApp(ws_url,
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close)
    ws.on_open = on_open
    ws.run_forever(ping_interval=30, ping_timeout=5)


if __name__ == "__main__":
    connect()

using System;
using WebSocketSharp;
using System.Net.Http;
using System.Text;
using System.IO.Compression;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Example
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

  public class Program
  {

    public static string Decompress(byte[] bytes)
    {
        MemoryStream msIn = new MemoryStream(bytes, 1, bytes.Length - 1);
        MemoryStream msOut = new MemoryStream();

        GZipStream cprs = new GZipStream(msIn, CompressionMode.Decompress);
        cprs.CopyTo(msOut);
        cprs.Close();

        return Encoding.ASCII.GetString(msOut.ToArray());//转换为普通的字符串
    }

    public static void Main (string[] args)
    {
      string wsuri = "wss://npush.bibox360.com";
      using (var ws = new WebSocket (wsuri)) {
        ws.OnMessage += (sender, e) => {

            Console.WriteLine ("recv: " + e.Data);

            if (e.IsText) {
              Console.WriteLine ("data[0]: {");
            } else if (e.IsBinary) {
                if (e.RawData[0] == 1) {
                    Console.WriteLine ("RawData[0]: 1");
                    string strres = Decompress(e.RawData);
                    Console.WriteLine (strres);
                } else if (e.RawData[0] == 0) {
                    Console.WriteLine ("RawData[0]: 0");
                    string strres = Encoding.ASCII.GetString(e.RawData);
                    Console.WriteLine (strres);
                }
            }

        };

        ws.Connect ();

        var myobj = new {
            sub = "BTC_USDT_kline_1min",
        };

        string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

        ws.Send (payload);

        ConsoleKey key;
        do
      {
            key=Console.ReadKey().Key;
      
      } while (key != ConsoleKey.Q);

      }
    }
  }
}

wss://push.bibox.com

Name Necessary or not Type Description Default value Value range
pair true string trading pair trading pair, BTC_USDT, ETH_USDT
period true string candlestick period 1min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 12hour, day, week
sub true string ${pair} +'_kline_' + ${period}

Response

{
    "topic":"BTC_USDT_kline_1min",
    "t":1,
    "d":[
        [
            "1646705760000",
            "38337.1",
            "38356.0",
            "38303.5",
            "38309.2",
            "2.180836"
        ],
        [
            "1646705820000",
            "38309.1",
            "38356.6",
            "38309.1",
            "38355.3",
            "2.103583"
        ]
    ]
}

[ Start time of a certain period of kline, Opening price, Highest price, Lowest price, Closing price, Volume ]

Subscribe to Market Data

Example


'use strict'

const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://npush.bibox360.com';


let wsClass = function () {

};

wsClass.prototype._decodeMsg = function (data) {
    let data1 = data.slice(1, data.length);
    zlib.unzip(data1, (err, buffer) => {
        if (err) {
            console.log(err);
        } else {
            try {
                let res = JSON.parse(buffer.toString());
                console.log(new Date(), buffer.toString());
            } catch (e) {
                console.log(e);
            }
        }
    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    console.log(biboxws)
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        ws.send(JSON.stringify({
            sub: 'ALL_ALL_market',
        }));
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        if (data[0] == '1') {
            that._decodeMsg(data);
        } else if (data[0] == '0') {
            console.log(1, new Date(), JSON.parse(data.slice(1)));
        } else {
            console.log(2, new Date(), data);
        }

    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

# /usr/bin/env python
# -*- coding: UTF-8 -*-

import websocket # websocket-client
import json
import zlib

ws_url = 'wss://npush.bibox360.com'


def stringify(obj):
    return json.dumps(obj, sort_keys=True).replace("\'", "\"").replace(" ", "")


def get_sub_str():
    subdata = {
        'sub': 'ALL_ALL_market',
    }
    # print(stringify(subdata))
    return stringify(subdata)


def get_unsub_str():
    subdata = {
        'unsub': 'ALL_ALL_market',
    }
    return stringify(subdata)


def decode_data(message):
    if message[0] == '\x01' or message[0] == 1:
        message = message[1:]
        data = zlib.decompress(message, zlib.MAX_WBITS | 32)
        jmsgs = json.loads(data)
        print(jmsgs)
        print(type(jmsgs))
    elif message[0] == '\x00' or message[0] == 0:
        message = message[1:]
        jmsgs = json.loads(message)
        print(jmsgs)
        print(type(jmsgs))
    else:
        jmsgs = json.loads(message)
        print(jmsgs)
        print(type(jmsgs))


def on_message(ws, message):
    # print(message)
    decode_data(message)


def on_error(ws, error):
    print(error)


def on_close(ws):
    print("### closed ###")


def on_open(ws):
    ws.send(get_sub_str())


def connect():
    websocket.enableTrace(True)
    ws = websocket.WebSocketApp(ws_url,
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close)
    ws.on_open = on_open
    ws.run_forever(ping_interval=30, ping_timeout=5)


if __name__ == "__main__":
    connect()

using System;
using WebSocketSharp;
using System.Net.Http;
using System.Text;
using System.IO.Compression;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Example
{
    public class SortContractResolver : DefaultContractResolver
    {
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);

            return properties.OrderBy(x=>x.PropertyName).ToList();
        }
    }

  public class Program
  {

    public static string Decompress(byte[] bytes)
    {
        MemoryStream msIn = new MemoryStream(bytes, 1, bytes.Length - 1);
        MemoryStream msOut = new MemoryStream();

        GZipStream cprs = new GZipStream(msIn, CompressionMode.Decompress);
        cprs.CopyTo(msOut);
        cprs.Close();

        return Encoding.ASCII.GetString(msOut.ToArray());//转换为普通的字符串
    }

    public static void Main (string[] args)
    {
      string wsuri = "wss://npush.bibox360.com";
      using (var ws = new WebSocket (wsuri)) {
        ws.OnMessage += (sender, e) => {

            Console.WriteLine ("recv: " + e.Data);

            if (e.IsText) {
              Console.WriteLine ("data[0]: {");
            } else if (e.IsBinary) {
                if (e.RawData[0] == 1) {
                    Console.WriteLine ("RawData[0]: 1");
                    string strres = Decompress(e.RawData);
                    Console.WriteLine (strres);
                } else if (e.RawData[0] == 0) {
                    Console.WriteLine ("RawData[0]: 0");
                    string strres = Encoding.ASCII.GetString(e.RawData);
                    Console.WriteLine (strres);
                }
            }

        };

        ws.Connect ();

        var myobj = new {
            sub = "ALL_ALL_market",
        };

        string payload = JsonConvert.SerializeObject(myobj, new JsonSerializerSettings { ContractResolver = new SortContractResolver() });

        ws.Send (payload);

        ConsoleKey key;
        do
      {
            key=Console.ReadKey().Key;
      
      } whi