NAV Navbar
php java nodejs python shell
  • Introduction
  • Authentication
  • Signing a Message
  • Time
  • Timestamps
  • Sequence Numbers
  • Time request
  • Accounts
  • Payment methods
  • Orders
  • Products
  • Withdraws
  • Deposit
  • Websockets
  • Introduction

    Welcome to the Abucoins API! You can use our API to access Abucoins API endpoints, which can get information about product, orders and fees.

    If you have any questions, please do not hesitate to contact our experts at [email protected]

    Rest api endpoint url

    https://api.abucoins.com

    Rate limits

    300 requests per 1 minute per IP and Account. When a rate limit is exceeded, a status of 429 will be returned.

    Authentication

    Generating an API Key

    Example class

    #!/bin/bash
    
    key="V0020000000010N2OJGLCRT7K99EAWSBV841PEHZ3IB6QF"
    secret="TRReUTx0ZC1MJX56fEFD7XhlbjBANyQhSChLRVJddTYucG9yRiJhT2NoR2ZOU1R3"
    passphrase="t15hby3cj"
    time=$(date +%s)
    
    #method="POST"
    #path="/deposits/make"
    #body="{\"currency\":\"PLN\",\"method\":\"sepa_pln\"}"
    method="GET"
    path="/accounts"
    body=""
    
    toHash="$time$method$path$body"
    decodedSecret=($(echo "$secret" | base64 --decode | xxd -p -c 256))
    hmac_base64=$(echo -n "$toHash" | openssl dgst -binary -sha256 -mac HMAC -macopt "hexkey:$decodedSecret" |  base64 )
    curl -H "AC-ACCESS-TIMESTAMP:$time" -H "AC-ACCESS-KEY:$key" -H "AC-ACCESS-SIGN:$hmac_base64" -H "AC-ACCESS-PASSPHRASE:$passphrase" -X "$method"  "https://api.abucoins.com$path"
    
    <?php
    class Api
    {
        const API_URL = 'https://api.abucoins.com';
    
        protected $accesskey;
        protected $secret;
        protected $passphrase;
        protected $timestamp;
    
        public function __construct($settings)
        {
            $this->secret = $settings['secret'];
            $this->accesskey = $settings['access_key'];
            $this->passphrase = $settings['passphrase'];
            $this->timestamp = time();
        }
    
        public function jsonRequest($method, $path, $datas)
        {
            $this->timestamp = time();
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
            curl_setopt($ch, CURLOPT_URL, static::API_URL . "$path");
            if ($method == 'POST') {
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($datas));
            }
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json',
                'AC-ACCESS-KEY: ' . $this->accesskey,
                'AC-ACCESS-TIMESTAMP: ' . $this->timestamp,
                'AC-ACCESS-PASSPHRASE: ' . $this->passphrase,
                'AC-ACCESS-SIGN: ' . $this->signature($path, $datas, $this->timestamp, $method),
            ));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $server_output = curl_exec($ch);
            curl_close($ch);
            return json_decode($server_output);
        }
    
        public function signature($request_path = '', $body = '', $timestamp = false, $method = 'GET')
        {
            $body = is_array($body) ? json_encode($body) : $body;
            $timestamp = $timestamp ? $timestamp : time();
            $what = $timestamp . $method . $request_path . $body;
            return base64_encode(hash_hmac("sha256", $what, base64_decode($this->secret), true));
        }
    
    }
    
    $configAbucoins = [
        'secret' => 'M1Y1N0oHZ2RSW7teVE5mbzB7xX0iP0NZS7x6LyVVUE1PsVMqV2hfNEBbUSYuWiQj',
        'access_key' => '10-30DWTDFOC17GE5IVL6ALUQBUN8Y4SF39',
        'passphrase' => '34y42c2bfce'
    ];
    
    $abucoinsApi = new AbucoinsApi($configAbucoins);
    $list = $abucoinsApi->jsonRequest('GET', '/orders', null);
    
    public class Api {
    
        private final String URL = "https://api.abucoins.com";
        private final String accessKey = "10-30DWTDFOC17GE5IVL6ALUQBUN8Y4SF39";
        private final String secret = "M1Y1N0oHZ2RSW7teVE5mbzB7xX0iP0NZS7x6LyVVUE1PsVMqV2hfNEBbUSYuWiQj";
        private final String passphrase = "34y42c2bfce";
        private final String USER_AGENT = "Mozilla/5.0";
    
        public static void main(String[] args) throws Exception {
            Api http = new Api();
            http.sendRequest("GET","/orders","");
        }
    
        private String sendRequest(String method,String path, String body) throws Exception {
            String localUrl;
            if (method.equals("GET"))
                localUrl = URL+path+body;
            else
                localUrl = URL+path;
    
            String timestamp = String.valueOf(System.currentTimeMillis()/1000);
            String sign = createSign(timestamp,method,path,body);
    
            URL url = new URL(localUrl);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod(method);
            con.setRequestProperty("User-Agent", USER_AGENT);
            con.setRequestProperty("AC-ACCESS-KEY", accessKey);
            con.setRequestProperty("AC-ACCESS-SIGN", sign);
            con.setRequestProperty("AC-ACCESS-PASSPHRASE", passphrase);
            con.setRequestProperty("AC-ACCESS-TIMESTAMP", timestamp);
    
            if (method.equals("POST")){
                con.setRequestProperty("Content-type", "application/json");
                con.setDoOutput(true);
                OutputStream os = con.getOutputStream();
                os.write(body.getBytes("UTF-8"));
                os.close();
            }
            int responseCode = con.getResponseCode();
    
            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
    
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();
            return response.toString();
        }
    
        private String createSign(String timestamp, String method, String path, String queryParameters) throws NoSuchAlgorithmException, InvalidKeyException{
            String queryArgs = timestamp + method + path + queryParameters;
            Mac shaMac = Mac.getInstance("HmacSHA256");
            SecretKeySpec keySpec = new SecretKeySpec(Base64.decodeBase64(secret), "HmacSHA256");
            shaMac.init(keySpec);
            final byte[] macData = shaMac.doFinal(queryArgs.getBytes());
            return Base64.encodeBase64String(macData);
        }
    }
    
    const rp = require('request-promise');
    const crypto = require('crypto');
    
    const TIMEOUT = 5000;
    
    class Abucoins {
        constructor() {
            this.endpoint = 'https://api.abucoins.com';
            this.credentials = {
                key: '10-30DWTDFOC17GE5IVL6ALUQBUN8Y4SF39',
                secret: 'M1Y1N0oHZ2RSW7teVE5mbzB7xX0iP0NZS7x6LyVVUE1PsVMqV2hfNEBbUSYuWiQj',
                passphrase: '34y42c2bfce',
            }
        }
    
        _jsonRequest(options) {
            options.timeout = TIMEOUT;
            options.json = true;
    
            return rp(options);
        }
    
        _getHeaders(sign, timestamp) {
            return {
                'AC-ACCESS-KEY': this.credentials.key,
                'AC-ACCESS-SIGN': sign,
                'AC-ACCESS-TIMESTAMP': timestamp,
                'AC-ACCESS-PASSPHRASE': this.credentials.passphrase,
            };
        }
    
        signAndRequest(method, path, body = {}) {
            const timestamp = Math.floor(new Date() / 1000);
            let options = {
                uri: `${this.endpoint}${path}`,
                method: method,
                body: body,
            };
            let string = timestamp + method + path;
            if (Object.keys(body).length > 0) {
                string += JSON.stringify(body);
            }
            const sign = crypto.createHmac('sha256', Buffer.from(this.credentials.secret, 'base64'))
                .update(string)
                .digest('base64');
            options.headers = this._getHeaders(sign, timestamp);
    
            return this._jsonRequest(options);
        }
    }
    
    let abucoins = new Abucoins();
    let orders = abucoins.signAndRequest('GET', `/orders`);
    
    orders.then((list) => {
        // console.log(list);
    });
    
    # Requires python-requests. Install with pip: pip install requests
    
    import json, hmac, hashlib, time, requests, base64
    from requests.auth import AuthBase
    
    class AbuCoins(AuthBase):
        def __init__(self, api_key, secret_key, passphrase):
            self.api_key = api_key
            self.secret_key = secret_key
            self.passphrase = passphrase
    
        def __call__(self, request):
            timestamp = str(int(time.time())) # eg. 1512516837
            # timestamp = eg. 1512516837
            # request.method = eg. POST
            # request.path_url = eg. /orders
            message = timestamp + request.method + request.path_url
            if request.body: # if present
                message = message + request.body.decode() # decode raw bytes
    
            hmac_key = base64.b64decode(self.secret_key)
            signature = hmac.new(hmac_key, message.encode('utf-8'), hashlib.sha256)
            signature_base64 = base64.b64encode(signature.digest())
    
            request.headers.update({
                'AC-ACCESS-KEY': self.api_key,
                'AC-ACCESS-PASSPHRASE': self.passphrase,
                'AC-ACCESS-SIGN': signature_base64,
                'AC-ACCESS-TIMESTAMP' : timestamp,
                })
            return request
    
    
    abucoins_api = 'https://api.abucoins.com'
    abucoins_passphrase = '34y42c2bfce'
    abucoins_key = '10-30DWTDFOC17GE5IVL6ALUQBUN8Y4SF39'
    abucoins_secret = 'M1Y1N0oHZ2RSW7teVE5mbzB7xX0iP0NZS7x6LyVVUE1PsVMqV2hfNEBbUSYuWiQj'
    
    authenticator = AbuCoins(api_key = abucoins_key, secret_key = abucoins_secret, passphrase = abucoins_passphrase)
    
    response = requests.get(abucoins_api + '/orders', auth = authenticator)
    print(response.json())
    

    Abucoins expects for the API key to be included in all API requests to the server in a header that looks like the following:

    AC-ACCESS-KEY: Api key

    AC-ACCESS-SIGN: Sign of message (see Signing a Message)

    AC-ACCESS-TIMESTAMP: Current timestamp

    AC-ACCESS-PASSPHRASE

    Error codes

    Message The most popular reason
    INVALID TIMESTAMP Timestamp not provided
    Your server time is not synced
    Your timestamp is in miliseconds
    INVALID PASSPHRASE Invalid or not provided passphrase
    ACCESS DENIED Invalid or not provided api key
    PERMISSION DENIED Provided key has not permission to the method
    INVALID SIGN Message checksum is not calculated correctly or not provided

    Signing a Message

    AC-ACCESS-SIGN header is generated by creating a sha256 HMAC using the secret key(need to be base64-decoded) on the prehash string concatenation timestamp(in seconds) + method(GET/POST/DELETE) + requestPath(including query string like /producs/BTC-USD/book?level=2) + body and base64-encode the output. The timestamp value is the same as the AC-ACCESS-TIMESTAMP header.

    $string = $timestamp . $method . $request_path . $body;
    $sign = base64_encode(hash_hmac("sha256", $string, base64_decode($secret), true));
    

    Sign a Message test cases

    You can test your sign message function using parameters provided below

    GET/DELETE:

    INPUT:

    TIMESTAMP: (string)"1519813799"

    METHOD: (string)"GET"

    REQUEST: (string)"/orders?status=done"

    BODY: (string)""

    SECRET: (string)"dCg0QUtPGmovN2IlbDpuSVVyezhhNLtIc3hwKTBTRnUxbV4HLWV8TiNDSkVSTUQ/"

    OUTPUT:

    SIGN: (string)"AoKOScnhPzALp1rWPk8uszVryQwdq4S0lYcgqZGELOU="

    POST:

    INPUT:

    TIMESTAMP: (string)"1519813882"

    METHOD: (string)"POST"

    REQUEST: (string)"/deposits/make"

    BODY: (string)"{"currency":"PLN","method":"sepa_pln"}"

    SECRET: (string)"dCg0QUtPGmovN2IlbDpuSVVyezhhNLtIc3hwKTBTRnUxbV4HLWV8TiNDSkVSTUQ/"

    OUTPUT:

    SIGN: (string)"inTCZ11YwOO2x6vrVf8mvkdHKPqk1inqjCv7EiTq8rg="

    Time

    The AC-ACCESS-TIMESTAMP header must be number of seconds since Unix Epoch in UTC. Only decimal values are allowed.

    Your timestamp must be maximum 30 seconds before or 30 seconds after api time. Otherwise your request will be rejected.

    Timestamps

    2014-11-06T10:34:47Z
    

    All timestamps from API are returned in ISO 8601.

    Sequence Numbers

    Most feed messages contain a sequence number. Sequence numbers are increasing integer values for each product with every new message being exactly 1 sequence number than the one before it.

    Time request

    Example response

    {
      "iso":"2017-10-10T11:16:50Z",
      "epoch":1507634210
    }
    

    Return current server time.

    HTTP Request

    GET /time

    Accounts

    List Accounts

    Example response

    [
        {
            "id": "3-BTC",
            "currency": "BTC",
            "balance": 13.38603805,
            "balance_btc": 13.38603805,
            "available": 13.38589212,
            "available_btc": 13.38589212,
            "hold": 0.00014593,
            "profile_id": 3
        },
        {
            "id": "3-ETH",
            "currency": "ETH",
            "balance": 133.48685448,
            "balance_btc": 9.38012126,
            "available": 133.48685448,
            "available_btc": 9.38012126,
            "hold": 0,
            "profile_id": 3
        }
    ]
    

    Get a list of trading accounts.

    HTTP Request

    GET /accounts

    Accounts fields

    Field Description
    id account id
    currency the currency of the account
    balance the funds in the account
    balance_btc the funds in the account (estimated in BTC)
    available funds available to withdraw or trade
    available_btc funds available to withdraw or trade (estimated in BTC)
    hold funds on hold (not available for use)
    profile_id profile id

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission

    Get an Account

    Example response

    {
      "id":"1-PLN",
      "currency":"PLN",
      "balance":"103465.35499050",
      "available":"103465.35499050",
      "hold":"0.00000000",
      "profile_id":"1"
    }
    

    Information for a single account. Use this endpoint when you know the account_id.

    HTTP Request

    GET /accounts/<account-id>

    Field Description
    id account id
    currency the currency of the account
    balance the funds in the account
    available funds available to withdraw or trade
    hold funds on hold (not available for use)
    profile_id profile id

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Wrong account id invalid id of the account

    Payment methods

    List Payment Methods

    Example response

    [
        {
            "id": "bitcoin",
            "type": "bitcoin",
            "name": "Bitcoin",
            "currency": "BTC",
            "allow_buy": true,
            "allow_sell": true,
            "allow_deposit": true,
            "allow_withdraw": true,
            "limits": {
                "buy": 10000,
                "sell": 10000,
                "deposit": 9223372036854775807,
                "withdraw": 1
            }
        },
        {
            "id": "sepa_pln",
            "type": "sepa_pln",
            "name": "PLN",
            "currency": "PLN",
            "allow_buy": true,
            "allow_sell": true,
            "allow_deposit": true,
            "allow_withdraw": true,
            "limits": {
                "buy": 10000,
                "sell": 10000,
                "deposit": 9223372036854775807,
                "withdraw": 9223372036854775807
            }
        }
    ]    
    

    Get a list of your payment methods.

    HTTP Request

    GET /payment-methods

    Response fields

    Field Description
    id identifier of the method
    type type of the method
    name: name of the method
    currency currency symbol
    allow_buy allowed buy flag
    allow_sell allowed sell flag
    allow_deposit allowed deposit flag
    allow_withdraw allowed withdraw flag
    limits global limits

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "payment" permission

    Orders

    List Orders

    Example response

    [
        {
            "id": "7786713",
            "price": "0.05367433",
            "size": "0.10451686",
            "product_id": "ZEC-BTC",
            "side": "buy",
            "type": "limit",
            "time_in_force": "GTC",
            "post_only": false,
            "created_at": "2017-09-03T03:33:17Z",
            "filled_size": "0.00000000",
            "status": "closed",
            "settled": false
        },
        {
            "id": "7786713",
            "price": "0.05367433",
            "size": "0.10451686",
            "product_id": "ZEC-BTC",
            "side": "buy",
            "type": "limit",
            "time_in_force": "GTC",
            "post_only": false,
            "created_at": "2017-09-03T03:33:17Z",
            "filled_size": "0.00000000",
            "status": "closed",
            "settled": false
        }
    ]
    

    List your current orders.

    HTTP Request

    GET /orders

    QUERY PARAMETERS

    Field Default Description
    status [open, done] Limit list of orders to these statuses
    product_id ex. ETH-BTC Get orders for the specified market

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request
    Wrong status You provided status param which is not "open" or "done"

    Get an Order

    Example response

    {
        "id": "7786714",
        "price": "0.05363803",
        "size": "0.91353089",
        "product_id": "ZEC-BTC",
        "side": "buy",
        "type": "limit",
        "time_in_force": "GTC",
        "post_only": false,
        "created_at": "2017-09-03T03:33:17Z",
        "filled_size": "0.00000000",
        "status": "closed",
        "settled": false
    }
    

    Get a single order by order id.

    HTTP Request

    GET /orders/<order-id>

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Order not found you provided wrong order id or order id which is not connected with your account

    Create an Order

    Create new order

    HTTP Request

    POST /orders

    Example request

    JSONObject body = new JSONObject();
    body.put("cancel_after", "min");        
    body.put("price", "0.035582569");        
    body.put("product_id", "ZEC-BTC");        
    body.put("side", "buy");     
    body.put( "size", "17.3124");
    body.put("time_in_force", "GTT");
    body.put("type", "limit");
    http.sendRequest("POST","/orders",body);
    
    let order = {
      "cancel_after" => "min",
      "price" => "0.035582569",
      "product_id" => "ZEC-BTC",
      "side" => "buy",
      "size" => "17.3124",
      "time_in_force" => "GTT",
      "type" => "limit"
    }
    
    let response = abucoins.signAndRequest('POST', `/orders`, order);
    
    $order = {
      "cancel_after" => "min",
      "price" => "0.035582569",
      "product_id" => "ZEC-BTC",
      "side" => "buy",
      "size" => "17.3124",
      "time_in_force" => "GTT",
      "type" => "limit"
    }
    
    $result = $abucoinsApi->jsonRequest('POST', '/orders', $order);
    print_r($result);
    
    order = {
      "cancel_after" : "min",
      "price" : "0.035582569",
      "product_id" : "ZEC-BTC",
      "side" : "buy",
      "size" : "17.3124",
      "time_in_force" : "GTT",
      "type" : "limit"
    }
    
    response = requests.post(abucoins_api + '/orders', json = order, auth = authenticator)
    print(response.json())
    

    Example response

    {
      "product_id":"ZEC-BTC",
      "used":"17.3124",
      "size":"17.3124",
      "price":"0.035582569",
      "id":"4217215",
      "side":"buy",
      "type":"limit",
      "time_in_force":"GTT",
      "post_only":false,
      "created_at":"2017-11-15T12:41:58Z",
      "filled_size":"17.3124",
      "fill_fees":"0",
      "executed_value":"0.61601967",
      "status":"done",
      "settled":true,
      "hidden":false
    }
    

    Order fields

    Base parameters

    Field Default Description
    type limit [optional] limit or market
    side buy or sell
    product_id Product id (ex. ZEC-BTC)
    stp default stp is off [optional] Self-trade prevention flag (co)
    hidden false [optional]* Hide your offer

    * A hidden order is an order which does not appear in the order book. If you place a hidden order, you will always pay the taker fee. If you place a limit order that hits a hidden order, you will always pay the maker fee.

    Limit order parameters

    Field Default Description
    price price per one asset
    size amount of assets to buy or sell
    time_in_force GTC [optional] GTC, GTT, IOC or FOK
    cancel_after [optional]* min, hour, day
    post_only [optional]** create order only if maker - true, false

    * Requires only with GTT
    ** Invalid when time_in_force is IOC or FOK

    Market order parameters

    Field Default Description
    size [optional]* Desired amount in BTC
    funds [optional]* Desired amount of quote currency to use

    * One of size or funds is required.

    Funds will limit how much of your quote currency account balance is used and size will limit the asset amount transacted.

    Response fields

    Field Type Description
    product_id string Product id ex. BTC-USD
    used string [deprecated] executed value of amount
    size string Order size
    price string Order price
    id string Offer id
    side string Offer side (buy or sell)
    type string Offer type (limit, market)
    time_in_force string Offer time in force param (GTC, GTT, IOC, FOK)
    post_only bool Post only param (true or false)
    created_at string Order time
    filled_size string Realized amount
    fill_fees string Charged fees
    executed_value string Sum of all executed values (amount * price)
    status string Order status (pending, open, done, rejected)
    reject_reason string [optional] Reason of order reject
    settled bool True if order is fully executed
    hidden bool True if your order is hide on the orderbook
    stp string Self trading prevention flag ('' or 'co')

    Time in force

    Time in force policies provide guarantees about the lifetime of an order.

    GTC (Good Till Canceled) orders remain open on the book until canceled(default).
    GTT (Good Till Time) orders remain open on the book until canceled or the allotted cancel_after is depleted on the matching engine. GTT orders are guaranteed to cancel before any other order is processed after the cancel_after timestamp which is returned by the API. A day is considered 24 hours.
    IOC Immediate or cancel orders instantly cancel the remaining size of the limit order instead of opening it on the book.
    FOK Fill or kill orders are rejected if the entire size cannot be matched.

    Self-trade prevention

    Self-trading is default set to off. To change the self-trade behavior, specify the stp flag.

    Flag Description
    default Orders from single user are possible to match
    'co' Cancel oldest - cancel older order

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "trade" permission
    Wrong type order has wrong type. Allowed: limit, market
    Wrong price format price should be decimal value provided as text
    Wrong size format size should be decimal value provided as text
    Wrong funds format funds should be decimal value provided as text
    Wrong side side is not provided or not allowed
    Invalid post_only param post_only param is not true or false or order type is not limit
    Invalid time_in_force param time_in_force param is not valid or order type is not limit
    Invalid stp param stp param is provided but different like 'co'
    Wrong market market doesn't exist or is suspended
    Wrong operation side param is not valid or cancel_after provided but order type is not 'limit'
    Wrong format of cancel_after parameter cancel_after provided but not valid
    Invalid time_in_force or cancel_after param time_in_force provided but cancel_after is not provided or invalid
    Wrong funds precision funds has incorrect precision. See: quote_increment field in /products endpoint
    Wrong price precision price has incorrect precision. See: quote_increment field in /products endpoint
    Total price is too small(min: XXX) Order size (price*amount) is too small
    Amount is too small(min: XXX) Order amount is too small
    Insufficient funds You has not enought funds to make an order
    Technical error Temporary system pause

    Delete an single order

    Example response

    ["12344534"]
    

    Delete a single order by order id.

    HTTP Request

    DELETE /orders/<order-id>

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "trade" permission

    Delete all orders

    Example response

    ["12344534","12344536"]
    

    Delete all orders

    HTTP Request

    DELETE /orders

    QUERY PARAMETERS

    Field Default Description
    product_id ex. ZEC-BTC Optional parameter with product id

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "trade" permission

    List Fills

    Example response

    [
      {
        "trade_id":"785705",
        "product_id":"BTC-PLN",
        "price":"14734.55000000",
        "size":"100.00000000",
        "order_id":"4196245",
        "created_at":"2017-09-28T13:08:43Z",
        "liquidity":"T",
        "fee": "1231.22344285",
        "side":"sell"
      },
      {
        "trade_id":"785704",
        "product_id":"BTC-PLN",
        "price":"14734.55000000",
        "size":"0.01000000",
        "order_id":"4196245",
        "created_at":"2017-09-28T13:08:43Z",
        "liquidity":"T",
        "fee": "0.01742231",
        "side":"sell"
      }
    ]
    

    Get a list of recent fills.

    HTTP Request

    GET /fills

    Response fields

    Field Description
    trade_id identifier of the last trade
    product_id product identifier
    price trade price
    size: trade size
    order_id identifier of order
    created_at time in UTC
    liquidity indicates if the fill was the result of a liquidity provider (maker) or liquidity taker. M indicates Maker and T indicates Taker
    fee indicates the fees charged for this individual fill
    side user side(buy or sell)

    Pagination

    Parameter Default Description
    before Request page before (newer) this pagination id.
    after Request page after (older) this pagination id.
    limit 100 Number of results per request. Maximum 1000. (default 100)

    before and after cursors are available via response headers ac-before and ac-after. Your requests should use these cursor values when making requests for pages after the initial request.

    To get older information you would request pages after the initial page. To get information newer, you would request pages before the first page.

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request

    Products

    List Products

    Example response

    [
        {
            "id": "ETH-BTC",
            "base_currency": "ETH",
            "quote_currency": "BTC",
            "base_min_size": "0.0010",
            "base_max_size": "100000.00000000",
            "quote_increment": "0.00000001",
            "display_name": "ETH/BTC"
        },
        {
            "id": "LTC-BTC",
            "base_currency": "LTC",
            "quote_currency": "BTC",
            "base_min_size": "0.0010",
            "base_max_size": "100000.00000000",
            "quote_increment": "0.00000001",
            "display_name": "LTC/BTC"
        },
        {
            "id": "ETC-BTC",
            "base_currency": "ETC",
            "quote_currency": "BTC",
            "base_min_size": "0.0010",
            "base_max_size": "100000.00000000",
            "quote_increment": "0.00000001",
            "display_name": "ETC/BTC"
        }
    ]
    

    Get a list of available currency pairs for trading.

    The base_min_size and base_max_size fields define the min and max order size. The quote_increment field specifies the min order price as well as the price increment. The order price must be a multiple of this increment (i.e. if the increment is 0.01, order prices of 0.001 or 0.021 would be rejected).

    HTTP Request

    GET /products

    Response fields:

    Field Description
    id identifier of market
    base_currency which currency is buying/selling
    quote_currency price currency of base_currency
    base_min_size minimum order size
    base_max_size maximum order size
    quote_increment the order price must be a multiple of this increment

    Product

    Example response

    {
      "id": "ETH-BTC",
      "base_currency": "ETH",
      "quote_currency": "BTC",
      "base_min_size": "0.0010",
      "base_max_size": "100000.00000000",
      "quote_increment": "0.00000001",
      "display_name": "ETH/BTC"
    }
    

    Get a specific market product.

    HTTP Request

    GET /products/<product-id>

    product-id is market pair like BTC-USD, ETH-BTC etc.

    Response fields:

    Field Description
    id identifier of market
    base_currency which currency is buying/selling
    quote_currency price currency of base_currency
    base_min_size minimum order size
    base_max_size maximum order size
    quote_increment the order price must be a multiple of this increment

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists

    Get Product Order Book

    Example response

    {
        "asks": [
          [ price, size, num-orders ],
          ["14160.13374000", "0.15994651", 1]
          ...
        ],
        "bids": [
           [ price, size, num-orders ],
           ["14140.00000000", "0.19970339", 1]
           ...
        ],
        "sequence": 1431
    }
    

    Example response for /products/BTC-PLN/book?level=2

    {
        "bids": [
            [ price, size, num-orders ],
        ],
        "asks": [
            [ price, size, num-orders ],
        ],
        "sequence": 1431
    }
    

    Return product orderbook

    HTTP Request

    GET /products/<product-id>/book

    By default, full agregated order book is returned. This is equivalent to a book depth of 0 level.

    Aggregated levels return only one size for each active price.

    Levels:

    GET /products/<product-id>/book?level=2

    Level Description
    0 fully agregated order book
    1 best ask and bid
    2 top 50 asks and bids

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists

    Get Products Tickers

    Example response

    [
        {
            "product_id":"ETH-BTC",
            "trade_id":"1825814",
            "price":"0.11675",
            "size":"0.0856531",
            "bid":"0.11509600",
            "ask":"0.11675000",
            "volume":"48.42677187",
            "time":"2018-02-01T18:07:15Z"
        },{
            "product_id":"LTC-BTC",
            "trade_id":"1825807",
            "price":"0.0160394",
            "size":"0.06234647",
            "bid":"0.01587335",
            "ask":"0.01600233",
            "volume":"92.89176989",
            "time":"2018-02-01T18:07:15Z"
        }
    ]
    

    Snapshot information about the last trade (tick) in each product, best bid/ask and 24h volume.

    HTTP Request

    GET /products/ticker

    Response fields

    Field Description
    product_id identifier of the market
    trade_id identifier of the last trade
    price last price
    size: size of the last trade
    bid the best bid
    ask the best ask
    volume 24 hour volume
    time time in UTC

    Error codes

    Message The most popular reason
    NotFound all markets down

    Get Product Ticker

    Example response

    {
        "trade_id": "553612",
        "price": "14160.85",
        "size": "0.00053",
        "bid": "14140.00000000",
        "ask": "14181.70000000",
        "volume": "1.09596639",
        "time": "2017-09-21T10:26:58Z"
    }
    

    Snapshot information about the last trade (tick), best bid/ask and 24h volume.

    HTTP Request

    GET /products/<product-id>/ticker

    Response fields

    Field Description
    trade_id identifier of the last trade
    price last price
    size: size of the last trade
    bid the best bid
    ask the best ask
    volume 24 hour volume
    time time in UTC

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists

    Get Trades

    Example response

    [
        {
            "time": "2017-09-21T12:33:03Z",
            "trade_id": "553794",
            "price": "14167.99328000",
            "size": "0.00035000",
            "side": "buy"
        },
        {
            "time": "2017-09-21T12:32:34Z",
            "trade_id": "553780",
            "price": "14163.96328000",
            "size": "0.00050000",
            "side": "buy"
        }
    ]    
    

    List the latest 100 trades for a product.

    Response fields:

    Field Description
    time time in UTC
    trade_id identifier of the last trade
    price last price
    size: size of the last trade
    side maker order side(sell or buy)

    HTTP Request

    GET /products/<product-id>/trades

    Pagination

    100 BTC-USD trades older than trade id: 1742024

    GET /products/BTC-USD/trades?limit=100&after=1742024
    

    100 BTC-USD trades newer than trade id: 1742024

    GET /products/BTC-USD/trades?limit=100&before=1742024
    
    Parameter Default Description
    before Request page before (newer) this pagination id.
    after Request page after (older) this pagination id.
    limit 100 Number of results per request. Maximum 1000. (default 100)

    before and after cursors are available via response headers ac-before and ac-after. Your requests should use these cursor values when making requests for pages after the initial request.

    To get older information you would request pages after the initial page. To get information newer, you would request pages before the first page.

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request

    Get Historic Rates

    Example response

    [
        [ time, low, high, open, close, volume ],
        [
            "1505984400",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "0.001"
        ],
        [
            "1505984460",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "0.00052"
        ],
        [
            "1505984520",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "0.00068"
        ]
    ]
    

    List the latest trades for a product.

    HTTP Request

    GET /products/<product-id>/candles?granularity=[granularity]&start=[UTC time of start]&end=[UTC time of end]

    QUERY PARAMETERS

    Param Description
    start Start time in ISO 8601 ex: 2018-01-22T09:44:59.000Z
    end End time in ISO 8601 ex: 2018-01-23T09:44:59.000Z
    granularity Desired timeslice in seconds

    Minimum start time is 30 days before current time.

    RESPONSE FIELDS

    Each bucket is an array of the following information:

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists
    Invalid granularity granularity param is not number or less than 0

    Global stats

    Example response

    [
      {
        "product_id":"BTC-PLN",
        "last":"14734.55000000",
        "open":"14734.55000000",
        "high":"0.00000000",
        "low":"0.00000000",
        "volume":"1.00000000",
        "volume_BTC":"1.00000000",
        "volume_USD":"4086.69",
        "volume_7d":"0.00000000",
        "volume_30d":"149.45718835",
        "change":"0.00"
      },
      {
        "product_id":"BTC-USD",
        "last":"4086.69000000",
        "open":"4086.69000000",
        "high":"0.00000000",
        "low":"0.00000000",
        "volume":"1.00000000",
        "volume_BTC":"1.00000000",
        "volume_USD":"4086.69",
        "volume_7d":"0.00000000",
        "volume_30d":"53.95784974",
        "change":"0.00"
      }
    ]
    

    List of the all products with stats.

    HTTP Request

    GET /products/stats

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists

    Product stats

    Example response

    {
      "last":"14734.55000000",
      "open":"14734.55000000",
      "high":"0.00000000",
      "low":"0.00000000",
      "volume":"1.00000000"
    }
    

    Product stats

    HTTP Request

    GET /products/<product-id>/stats

    Withdraws

    Crypto withdraws

    HTTP Request

    POST /withdrawals/crypto

    Make withdraw

    Example request

    {
        "amount": 10.00,
        "currency": "BTC",
        "method": "bitcoin",
        "address": "0x5ad5769cd04681FeD900BCE3DDc877B50E83d469"
    }
    

    Example response

    {
        "status": 0,
        "message": "Your transaction is pending. Please confirm it via email.",
        "payoutId": "65",
        "balance": [
            {
                "type": "PLN",
                "balance": "2999990.00000000",
                "locked": "0.00000000"
            },
            {
                "type": "BTC",
                "balance": "13.38589212",
                "locked": "0.00014593"
            }
        ]
    }
    

    HTTP Request

    POST /withdrawals/make

    QUERY PARAMETERS

    Base parameters:

    Field Description
    amount The amount to withdraw
    currency The type of currency
    method Payment method (see Payment methods)

    Crypto parameters:

    Field Description
    address A crypto address of the recipient
    tag Tag/PaymentId/Memo of the recipient

    FIAT parameters:

    Field Description
    accountNumber Account number/IBAN
    firstName Recipient first name
    lastName Recipient last name
    companyName Recipient company name

    Response fields

    Field Description
    status 0 if request is correct, other values if is incorrect
    message response message
    payoutId: id of payout
    balance balance on each account after request

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "payment" permission
    Invalid withdraw method invalid method param
    We can't process your withdraw because your Limits are too low(XXXBTC/day). Please increase your verification level! User limits are to low
    Withdraws locked to YYYY-MM-DD due to password change. Your account is locked due to password change
    Invalid withdraw address. Withdraw address is not valid
    You can't use this address. Withdraw address is other user account
    Invalid withdraw tag. Tag is invalid
    Minimum withdraw amount is XXX Amount to withdraw is too low
    Technical error Temporary system pause

    Withdraws history

    Gets an information about withdraws history

    Example request

    HTTP Request

    GET /withdrawals/history

    QUERY PARAMETERS

    Parameter Default Description
    before Request page before (newer) this pagination id.
    after Request page after (older) this pagination id.
    limit 100 Number of results per request. Maximum 1000. (default 100)

    Response fields

    Field Description
    withdraw_id Withdraw transaction ID
    currency Withdraw currency
    date: Date of withdraw
    amount Withdraw amount
    fee Withdraw fee
    status Withdraw status
    url blockchain explorer url (null if not available)

    Withdraws statuses

    Field Description
    awaiting-email-confirmation Withdraw is waiting for email confirmation
    pending Withdraw is pending
    complete Withdraw is completed

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request

    Deposit

    Crypto deposit

    HTTP Request

    POST /deposits/crypto

    Make deposit

    Gets an information about deposit address

    Example request

    JSONObject body = new JSONObject();
    body.put("currency", "XEM");        
    body.put("method", "nem");
    http.sendRequest("POST","/deposits/make",body);
    
    #!/bin/bash
    
    key="V0020000000010N2OJGLCRT7K99EAWSBV841PEHZ3IB6QF"
    secret="TRReUTx0ZC1MJX56fEFD7XhlbjBANyQhSChLRVJddTYucG9yRiJhT2NoR2ZOU1R3"
    passphrase="t15hby3cj"
    time=$(date +%s)
    
    method="POST"
    path="/deposits/make"
    body="{\"currency\":\"PLN\",\"method\":\"sepa_pln\"}"
    
    toHash="$time$method$path$body"
    decodedSecret=($(echo "$secret" | base64 --decode | xxd -p -c 256))
    hmac_base64=$(echo -n "$toHash" | openssl dgst -binary -sha256 -mac HMAC -macopt "hexkey:$decodedSecret" |  base64 )
    curl -H "AC-ACCESS-TIMESTAMP:$time" -H "AC-ACCESS-KEY:$key" -H "AC-ACCESS-SIGN:$hmac_base64" -H "AC-ACCESS-PASSPHRASE:$passphrase" -X "$method"  "https://api.abucoins.com$path"
    
    <?php
    $deposit = {
      "currency" => "XEM",
      "method" => "nem"
    }
    
    $result = $abucoinsApi->jsonRequest('POST', '/deposits/make', $deposit);
    print_r($result);
    
    deposit = {
      "currency" : "XEM",
      "method" : "nem"
    }
    
    response = requests.post(abucoins_api + '/deposits/make', json = deposit, auth = authenticator)
    print(response.json())
    
    let deposit = {
      "currency" : "XEM",
      "method" : "nem"
    }
    
    let response = abucoins.signAndRequest('POST', `/deposits/make`, deposit);
    

    Example response

    {
        "address": "NCYFDRHBAHYRWMZFRDAOXQ2KUGLD5AHHFC2J",
        "tag": "54b5fc2ae75afd20fd1514f8b5f6389dfb3f0"
    }
    

    HTTP Request

    POST /deposits/make

    QUERY PARAMETERS

    Field Description
    currency The type of currency
    method Payment method (see Payment methods)

    Response fields

    Field Description
    addres Cryptocurency address
    tag Cryptocurency tag
    accountNumber: Bank account number
    swift Bank SWIFT
    name Bank transfer recipient name
    address Bank transfer recipient address
    title Bank transfer title/details

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "trade" permission
    Invalid deposit method invalid deposit param

    Deposit history

    Gets an information about deposit history

    Example request

    HTTP Request

    GET /deposits/history

    QUERY PARAMETERS

    Parameter Default Description
    before Request page before (newer) this pagination id.
    after Request page after (older) this pagination id.
    limit 100 Number of results per request. Maximum 1000. (default 100)

    Response fields

    Field Description
    deposit_id Deposit transaction ID
    currency Deposit currency
    date: Date of deposit
    amount Deposit amount
    fee Deposit fee
    status Deposit status
    url blockchain explorer url (null if not available)

    Deposit statuses

    Field Description
    awaiting-email-confirmation Deposit wait for email confirmation
    pending Deposit is pending
    complete Deposit is completed

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request

    Websockets

    The websocket feed provides real-time market data updates for orders and trades.

    wss://ws.abucoins.com

    Overview

    The fastest insight into order flow as well as trades is provided by real-time market data updates. If you want to build real-time order books and track trades, you should read the message stream and use relevant messages for your needs.

    Our websocket feed is publicly available for all users.

    Protocol overview

    {
        "type": "error",
        "message": "error message",
        /* ... */
    }
    

    We use a bidirectional protocol encoding all messages as JSON objects. All messages are characterized with a type attribute which can be used for handling them appropriately.

    We would like to emphasize that new message types may be added at any point in the future. Messages which are not supported by clients should be ignored.

    Error messages: the majority of failure cases will trigger an error message (type "error") to be sent. This can help you in implementing a client or debugging.

    Subscribe

    Example subscribe request

    {
        "type": "subscribe",
        "product_ids": [
            "ETH-USD",
            "ETH-EUR"
        ],
        "channels": [
            "level3",
            "heartbeat",
            {
                "name": "ticker",
                "product_ids": [
                    "ETH-BTC",
                    "ETH-USD"
                ]
            }
        ]
    }
    

    In order to start receiving feed messages you will have to send a message to the server indicating which channels and products feeds you wish to receive. Because this message is obligatory, you will be disconnected if subscribe hasn't been received within 5 seconds.

    You can use 2 methods of specifying products IDs to listen for within every channel.

    After subscribe message is received, the server will return subscriptions message listing all channels you have subscribed.

    Following subscribe messages will add you to subscriptions list. If you are already subscribed to a channel without previous authentication, you will remain in the unauthenticated channel.

    In case you wish to unsubscribe from a channel or product, please send an unsubscribe message which structure is corresponding to subscribe messages. You can also provide no product ids for a channel at all. In this case you will be unsubscribed from that channel completely.

    You will receive subscription message in return to unsubscribe message.

    Sequence Numbers

    Majority of feed messages have a sequence number. Those numbers are rising integer values for each product. Each new message is exactly one sequence number higher than the one before it. In case you wish to check sequence numbers, you will have to record every channel for a single product. You can also reset sequence number in which case it will start again from 0. If sequence number you receive is lesser then preceding one, you will have to restart the subscription.

    Channels

    Heartbeat

    // Request
    {
        "type": "subscribe",
        "channels": [{ "name": "heartbeat", "product_ids": ["BTC-USD"] }]
    }
    
    // Heartbeat message
    {
      "type":"heartbeat",
      "time":"2018-02-19T17:47:17Z",
      "product_id":"BTC-USD",
      "sequence":7592,
      "last_trade_id":"1938575"
    }
    

    If you subscribe to the heartbeat channel, you will receive heartbeat messages once a second. These messages include sequence numbers as well last trade IDs. You can use them to confirm that no messages were missed.

    ticker

    {
        "type": "ticker",
        "trade_id": 20153558,
        "sequence": 3262786978,
        "time": "2017-09-02T17:05:49.250000Z",
        "product_id": "BTC-USD",
        "price": "4388.01000000",
        "last_size": "0.03000000",
        "best_bid": "4388",
        "best_ask": "4388.01"
    }
    

    Each time a match occurs, the ticker channel will provide a real time price update. Updates are batched in case of cascading matches in order to greatly reduce bandwidth requirements.

    level3

    {
        "type": "snapshot",
        "product_id": "BTC-EUR",
        "bids": [["1", "2"]],
        "asks": [["2", "3"]]
    }
    

    The simplest way of keeping a snapshot of the order book is by using the level3 channel. With guaranteed delivery of all updates, it notably reduces overhead required when consuming the full channel.

    After you subscribe to this channel, you will receive a message with the type snapshot and the corresponding product_id. Bids and asks are arrays of [price,size] tuples representing complete order book.

    l3update response

    {
        "type": "l3update",
        "product_id": "BTC-EUR",
        "changes": [
            ["buy", "1", "3"],
            ["sell", "3", "1"],
            ["sell", "2", "2"],
            ["sell", "4", "0"]
        ]
    }
    

    Following updates will be characterized with type l3update. The changes property of l3updates is an array with [side, price, size] tuples. We would like to emphasize that size is the updated size at corresponding price level.

    matches

    match response

    {
      "type":"match",
      "time":"2018-02-20T15:36:15Z",
      "product_id":"BTC-PLN",
      "sequence":668529,
      "trade_id":"1941271",
      "maker_order_id":"277417306",
      "taker_order_id":"277443754",
      "size":0.00093456,
      "price":38892.84,
      "side":"buy"
    }
    

    If your only interest are match messages, you can proceed with subscribing to matches channel. This is convenient when you are receiving remaining feed through level3 channel.

    There is possibility of dropping messages from this channel. You can track last trade id and fetch trades missed from REST API by using the heartbeat channel.

    full

    Real-time updates on orders and trades are contributed by the full channel. They can be used on level3 order book snapshot so you can keep accurate and up-to-date copy of the exchange order book.

    The only way of updating order book is through l3update. You don?t need to update order book with open, done and match messages.

    Open

    open response

    {
      "type":"open",
      "time":"2018-02-20T14:59:45Z",
      "product_id":"BTC-PLN",
      "sequence":648769,
      "order_id":"277370816",
      "price":39023.26,
      "remaining_size":2.19829673,
      "side":"sell"
    }
    

    The order has now been opened on the order book. You will receive this message only in case when orders are not fully filled instantly. Value of unfilled order going on the book will be represented by remaining_size.

    If your order has been filled directly, you won?t receive open message. Because market orders are filled instantly, you won?t receive open message in this case as well.

    Done

    done response

    {
      "type":"done",
      "time":"2018-02-20T14:59:45Z",
      "product_id":"BTC-PLN",
      "sequence":648771,
      "price":"39034.08000000",
      "order_id":"277370262",
      "reason":"canceled",
      "side":"sell",
      "remaining_size":0.503343
    }
    

    Your order has been removed from order book. You will receive this message if your order was canceled or filled. If you received done message for particular order_id, there won?t be any more messages for it. Value of unfilled order going on the book is stated by remaining_size, if order was filled, this value will be 0.

    To avoid self-trading, we will send a done message for received orders which have been fully filled or canceled. Such orders won?t trigger sending an open message. If you are maintaining real-time order book and you receive done message for an order which is not on the book, please ignore it.

    Match

    match response

    {
        "type": "match",
        "trade_id": 10,
        "sequence": 50,
        "maker_order_id": "5234543",
        "taker_order_id": "5323234",
        "time": "2014-11-07T08:19:27Z",
        "product_id": "BTC-USD",
        "size": "5.23512",
        "price": "400.23",
        "side": "sell"
    }
    

    A trade took place between two orders. It is the taker order which is being completing instantly after being received while maker order rests on the order book. Maker order side is indicated by the side field. In case of side being sell, this marks maker as sell order and the match is recognized as an up-tick. In the opposite case ? buy side match is considered as a down-tick.