BiONE币万交易所API文档

Introduction介绍 

Welcome to BIONE API document for developers.

This document provides instructions on how to use APIs related to account management, market information, trading functions among others in spot trading.

Market API provides market data that are accessible to the public. Account APIs and trading APIs, which provide functions such as order placement, order cancellation, order inquiry and account information, need identity authentication.

Getting Started 开始

REST, a.k.a Respresntational State Transfer, is an architectural style that defines a set of constraints and properties based on HTTP. REST is known for its clear structure, readability, standardization and scalability. Its advantages are as follows:

  • Each URL represents one web resource in RESTful architecture;
  • Acting as a representation of resources between client and server;
  • Client is enabled to operate server-side resources with 4 HTTP requests - representational state transfer.

Developers are recommended to use REST API to proceed spot trading and withdrawals.

Encrypted Verification of API 接口加密验证

Generate an API Key

Before signing any request, you must apply an access key via BIONE’s official Email ceo@bione.cc. BIONE officials will send the access key and secret after auditing.
After gotten the key, there are two things you must bear in mind:

  • Access Key

  • Secret Key

API access Key and Secret are randomly generated and provided. Please make sure not send secret key to anybody.

Signature

User submitted parameters must be signed except for sign. First, the string to be signed is ordered according to the parameter name (first compare the first letter of all parameter names, in alphabetic order, if you encounter the same first letter, then you move to the second letter, and so on).

sign process

  1. sort all parameters with alphabet order;
  2. join all parameters like this,key1value1key2value2key3value3...keyNvalueN;
  3. use app secret as prefix and suffix like appsecret + keyvalue_result + appsecret
  4. hmac with sha256, like hash_hmac('sha256', message, appSecret, true);
  5. get the sign string with md5(appSecret + hmac_hash_value + appSecret)

Request Process

  The root URL for REST access:https://www.bione.cc

Request

All requests are based on Https protocol. It is required to append accessKey=xxx&sign=xxx for the api required authentication.

Request Process Descriptions

  1. Request parameter: parameter encapsulation based on the port request.

  2. Submitting request parameter: submit the encapsulated parameter request to the server via POST/GET/ or other methods.

  3. Server response: the server will first perform a security validation, then send back the requested data to the client in JSON format.

  4. Data processing: processing server response data.

Success

HTTP status code 200 indicates a successful response and may contain content. If the response contains content, it will appear in the corresponding returned content.

all the response content will be a json text like below.

{
    "code": 1,
    "msg": "success",
    "data": xxx,
}

Common Error Code

  • 1, success

  • 0 or others, failed

if failed, your can get the error message from field "msg"

Pagination

use pagenumber and pagesize.

For example:

GET /orders?pagenumber=1&pagesize=20

Standards and Specification

Timestamp

Unless otherwise specified, all timestamps in APIs are returned in microseconds.

The ACCESS-TIMESTAMP header must be the number of seconds since UTC's time [Unix Epoch][]. Decimal values are allowed. Your timestamp must be within 30 seconds of the API service time, otherwise your request will be considered expired and rejected. If you think there is a large time difference between your server and the API server, then we recommend that you use the time point to check the API server time.

For example,

1524801032573

Numbers

In order to maintain the accuracy of cross-platform, decimal numbers are returned as strings. We suggest that you might be better to convert the number to string when issuing the request to avoid truncation and precision errors. Integers (such as transaction number and sequence) do not need quotation marks.

Rate Limits

When a rate limit is exceeded, a status of 429 Too Many Requests will be returned.

REST API

  • Public interface: We limit the invocation of public interface via IP: up to 6 requests every 2s.

  • Private interface: We limit the invocation of private interface via user ID: up to 6 requests every 2s.

  • Special restrictions on specified interfaces are specified.

Spot API Reference现货API

Spot Market API

1. Access the list of all trading pairs

HTTP Request

    # Request
    GET /api/v2/markets
    # Response
    [
        {
            "market": "eth_usdt",
            "coin_pre": "eth",
            "coin_suf": "usdt",
            "vol": "1417.64830900",
            "change": "4.86000000",
            "quotePrecision": 6,
            "buy_min": "",
            "buy_max": "",
            "sell_min": "",
            "sell_max": ""
        },
        {
            "market": "bcd_usdt",
            "coin_pre": "bcd",
            "coin_suf": "usdt",
            "vol": "388.82555700",
            "change": "1.46000000",
            "quotePrecision": 6,
            "buy_min": "",
            "buy_max": "",
            "sell_min": "",
            "sell_max": ""
        },
        ...
    ]

Response Details

FieldDescirption
marketTrading pair code
coin_sufBase currency
coin_preQuote currency
volVolume
change24h change value
quotePrecisionQuote Precision
buy_minMinimum buy Volume
buy_maxMaximum buy Volume
sell_minMinimum sell Volume
sell_maxMaximum max Volume

2. Access the depth table of trading pairs

HTTP Request

    # Request
    GET /api/v2/depth?market=xxxx
    # Response
    {
        "asks":[
            [
                "10463.3399",
                "0.0025"
            ],
            ...
        ],
        "bids":[
            [
                "7300.2456",
                "0.0022"
            ],
            ...
        ]
    }

Response Details

FieldDescription
asksdepth of sellers
bidsdepth of buyers

Request Paramters

NameTypeRequitedDescription
marketStringYTrading Pair, e.g. ltc_btc

3. Access the ticker of a trading pair

HTTP Request

The snapshot of the latest price, the highest bid price, the lowest ask price and 24-hour trading volume.
    # Request
    GET /api/v2/ticker/:market
    # Response
    [
        "symbol": "eth_usdt",
        "buy": "0.00000000",
        "sell": "0.00000000",
        "high": "145.01000000",
        "low": "129.19000000",
        "last": "145.01000000",
        "vol": "1418.15673100",
        "change": "4.87000000"
    ]

Response Details (from the top down)

FieldDescription
symboltrade pair
buybuy
sellsell
high24hr Highest
low24hr Lowest
lastlatest price
vol24h Vol
change24h change

Request Parameter

NameTypeRequiredDescription
marketStringYTrading Pair, e.g. btc_usdt

4. Access the market trading records of a trading pair

The request supports pagination.

HTTP Request

    # Request
    GET /api/v2/deal/:market?pagenumber=1&pagesize=10
    # Response
    [
        [
           "amount": "0.11590600",
           "date": 1550544363,
           "price": "145.00000000",
           "type": 1
        ],
        [
            "amount": "0.11590600",
            "date": 1550544363,
            "price": "145.00000000",
            "type": 2
        ]
    ]

Response Description (In order)

FieldDescription
amountvolume
datetimstamp
priceExecution Price
typemaker side(1:buy, 2:sell)

Request Paramters

NameTypeRequiredDescription
marketStringYTrading pair, e.g. btc_usdt
**Explanation**

+ Side indicates that the direction of the order the maker places. Maker refers to a trader who places orders in the market, a marker is a passive transaction party

+ Buy suggests price fall, because the maker places a buy order and the order is executed, the price falls; in contrary, sell suggests price rise, because the maker places a sell order and the order is executed, the price rises.

5. Access Candlestick chart

HTTP Request

    # Request
    GET  /api/v2/kline/:market?type=1min&start=start_time&end=end_time
    # Response
    {
        [ 1550504940000, 0.888547, 138.23, 138.24, 138.23, 138.24 ]
        ...
    }

Response Details (in order)

FieldDescription
Start timestamp1415398768
volume0.888547
Opening price138.23
The lowest price138.23
The highest price138.24
Closing price138.24

Request parameters

NameTypeRequiredDescription
marketStringYTrading pair, e.g.eth_usdt
typeStringYCandlestick chart period type, e.g.1min/15min/30min/1hour/1day/1week
startStringYtimestamp
endStringYtimestamp

6. Access Server Time

Access API server time. This interface does not require ID authentication.

HTTP Request

    # Request
    
    GET /api/v2/public/time
    # Reponse

    {
        "timestamp": 1524801032
    }

Response Description

FieldDescription
timestampserver time expressed in millisecond

It is an API for accessing all the available trading pairs and their trading parameters.

Spot Account API 现货账号API

1. Access account information

Access the list of balance, inquiry of coin balances, freezing status and available fund in spot account.

HTTP Request

    # Request
    GET /api/v2/account/assets
    # Response
    [
        {
            "coin": "btc",
            "available": "0.02809200",
            "freeze": "0.00000000",
            "balance": 0.028092
        },
        {
           "coin": "ltc",
           "available": "0.00000000",
           "freeze": "0.00000000",
           "balance": 0
        }
    ]

Response Details

FieldDescription
coinCoin symbol
availableAvaliable Fund
freezeFrozen fund
balanceNumber of coins in balance

2. Order Placement

create order for market.

HTTP Request

    # Request

    POST /api/v2/order/create?accessKey=your_access_key&sign=your_sign_str&market=fund_usdt&unitPrice=0.000300&type=1&number=100
    # Response

    {
        "orderSn": "HB1234567",
        "order_id": 123456
    }

   Response Details

+ order_id: Order ID
+ orderSn: Order Sn number

Request Paramters

NameTypeRequiredDescription
marketStringYTrading pair, e.g.btc_usdt
typeStringN1 or 2(1:buy, 2:sell)
numberStringNdelivered when a limit order or selling market order if placed,representing the number of coins for trading
unitPriceStringNdelivered when a limit order is placed, representing the price of the pair

3. Cancel all orders

Cancel multi unfilled orders of the target trading pair.

HTTP Request

    # Request
    DELETE /api/v2/order/batchcancel?market=eth_usdt&orderids=1,2,3&accessKey=your_access_key&sign=your_sign_str
    # Response

    { ...}

Request Paramters

NameParamtersTypeDescription
marketStringYTrading pairs, e.g. btc_usdt
orderidsStringYall order id,separate with comma

4. Cancel a specified order

Cancel a specified order by order ID

HTTP Request

    # Request
    GET /api/v2/order/cancel
    # Response
    {...}

Request Paramters

NameTypeRequiredDescription
marketStringYTrading Pair, e.g. btc_usdt
orderidStringYThe ID of an unfilled order specified need to be cancelled

5. Search orders

Check all the orders by order status.

HTTP Request The request supports pagination. You can refre to the Pagination above.

    # Request
    GET /api/v2/orders?market=fund_usdt&status=xxx&accessKey=your_access_key&sign=your_sign_str
    # Response
    {
        "id": 6188977,
        "userid": 12,
        "order_number": "I218573604654579",
        "market": "fund_usdt",
        "market_type": 1,
        "type": 1,
        "price": "0.00030000",
        "num": "100.00000000",
        "deal": "0.00000000",
        "mum": "0.03000000",
        "fee": null,
        "nature": "",
        "sort": null,
        "addtime": 1550457360,
        "endtime": null,
        "status": 3
    }

Response Details

FieldDescription
idOrder ID
useridUser ID
order_numberorder sn number
marketTrading pair, e.g.btc_usdt
market_typeignore this field currently. keep for future.
typemaker side(1:buy, 2:sell)
pricePrice set for the order
numVolume of coins in the order placed
dealdeal volume of the order
mumtotal amount
addtimecreate time for the order
statusOrder Status(1: wait for deal, 2: already deal. 3: canceled

Request Paramters

NameTypeRequiredDescription
marketStringYTrading pair, e.g.btc_usdt
statusStringYOrder Status(1: wait for deal, 2: already deal. 3: canceled

6. Order inquiry by Order ID

Inquiry of a specified order by order ID

HTTP Request

    # Request
    GET /api/v2/order/query?orderid=your_order_id&market=your_market&accessKey=your_access_key&sign=your_sign_str
    # Response 
    {
       "id": 6188675,
       "userid": 12,
       "order_number": "I218564861103484",
       "market": "fund_usdt",
       "market_type": 1,
       "type": 1,
       "price": "0.00030000",
       "num": "100.00000000",
       "deal": "0.00000000",
       "mum": "0.03000000",
       "fee": null,
       "nature": "",
       "sort": null,
       "addtime": 1550456486,
       "endtime": null,
       "status": 3
    }

Response Details

FieldDescription
averagePriceaverage price for the filled orders; 0 for the unfilled orders
marketTrading pair, e.g.btc_usdt
createDateTimestamp upon the placement of the order
filledVolumethe volume of the filled orders
fundsthe amount of the filled
orderIdOrder ID
pricePrice set for the order
sideOrder direction
statusOrder Status
volumeVolume of coins in the order placed

Request Paramters

NameTypeRequiredDescription
marketStringYTrading pair, e.g.btc_usdt
orderidStringYOrder Id

7. Access the account statement

Access the statement of a spot account

HTTP Request

    # Request
    GET /api/v2/account/bill/:currencyCode?accessKey=your_access_key&sign=your_sign_str
    # Response
    {
       "id": 19010805,
       "userid": 12,
       "order_number": "I111863328528718",
       "market": "cjz_eth",
       "operation": 2,
       "type": 2,
       "currency_abbr": "eth",
       "currency_total": "0.01490000",
       "c_before_normal": "2.41457859",
       "c_before_bfreeze": "0.00000000",
       "c_before_total": "2.41457859",
       "c_after_normal": "2.39967859",
       "c_after_bfreeze": "0.01490000",
       "c_after_total": "2.41457859",
       "fee": "0.00000000",
       "log_id": "4996256",
       "move": "",
       "addtime": 1547186332,
       "status": 1
    }

Response Details

FieldDescription
idStatement ID
useridUser ID
currency_totalVolume of coins traded on the statement
c_before_normalStatement balance
createdDateTimestamp on the statement taking place
detailsStatement Details
order_numberOrder SN
productIdProduct ID
typeTransaction Type

Request Paramters

NameTypeRequiredDescription
codeStringYTrading pair, e.g.btc_usdt

8. Withdrawal

Withdraw to your wallet address.

HTTP Request

    # Request
    GET /api/v2/account/withdraw?coin=your_coin_name&num=your_withdraw_num&addr=your_coin_address&accessKey=your_access_key&sign=your_sign_str
    # Response
    { ... }

Request Parameters

NameTypeRequiredDescription
coinStringYName of coin to be withdrawn, e.g.BTC
numStringYWithdraw amount
addrStringYWithdraw address
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

比特量化

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值