NAV Navbar
Crypto.com Spot API v2.1 for Exchange

javascript python c# java

Introduction

Welcome to the Crypto.com Spot Exchange V2.1 API for Exchange reference documentation.

The Crypto.com Exchange provides developers with a REST and websocket API.

The majority of API calls are available across both mediums in the same request and response formats, allowing smooth transition and a reduced learning curve between the two platforms.

Where applicable, all API calls come with detailed information on both the request and response parameters, all in a simple JSON format, as well as sample requests and code snippets in JavaScript, Python, C#, and Java which can be viewed on the right.

Effective from 2022-11-01, the Spot Exchange API V2.1 will replace the Spot Exchange V2 with breaking changes. See Change Logs and Breaking Change Schedule for details.

Change Logs

Breaking Change Schedule

Effective from 2022-11-10 (UAT), TBD (PROD)

Method Breaking Change
  • public/get-instruments
  • Breaking Change: base_currency, quote_currency will return USD to mean USD Bundle, instead of USD_Stable_Coin
  • Recommendation: Please test in UAT ASAP before the change goes live.
  • private/get-account-summary
  • user.balance
  • Breaking Change: currency will return USD to mean USD Bundle, instead of USD_Stable_Coin
  • Recommendation: Please test in UAT ASAP before the change goes live.
  • private/get-order-history
  • private/get-order-list
  • private/get-open-orders
  • private/get-order-detail
  • private/get-trades
  • user.order.{instrument_name}
  • user.trade.{instrument_name}
  • Breaking Change: fee_currency will return USD to mean USD Bundle, instead of USD_Stable_Coin
  • Recommendation: Please test in UAT ASAP before the change goes live.

Effective from 2022-06-04 (UAT), 2022-11-01 (PROD)

Method Breaking Change
  • private/deriv/*
  • Breaking Change: Multiple wallets has been merged into unified wallet, such that all entitled account can participte in (1) spot trading (2) margin trading (3) derivative trading. Therefore private/deriv/* methods are no longer needed.
  • Alternative: Not Required
  • private/subaccount/*
  • Breaking Change: Subaccount Transfeer has been revamped in new Exchange as a result of unified wallet therefore existing APIs are no longer compatible.
  • Alternative: Effective from 2022-11-01, please use Exchange API v1 to manage sub-account transfer.
  • private/margin/*
  • Breaking Change: Margin trading has been revamped in new Exchange, such that it follows (1) Auto-borrowing Policy (2) Smart Cross Margin Policy.
  • Alternative: Effective from 2022-11-01, please use Exchange API v1 to create and manage Margin Order.
  • private/create-order-list
  • private/cancel-order-list
  • Breaking Change: These methods no longer support OCO orders in favour of new Exchange's implementation.
  • Alternative: Effective from 2022-11-01, Please use Exchange API v1 to create and manage OCO Order.
  • private/get-order-list
  • Breaking Change: This method is OCO-specifc and is removed, has been removed in favour of new Exchange's implementation.
  • Alternative: Effective from 2022-11-01, Please use Exchange API v1 to create and manage OCO Order.
  • private/create-order
  • Breaking Change: client_oid has become a unique field. Sending the duplicate client_oid will be rejected.
  • Alternative: Any unique id such as UUID or Timestamp in Nanoseconds can be possibly accepted.
  • private/get-open-orders
  • private/get-order-history
  • private/get-trades
  • Breaking Change: page parameter for all endpoints has become forward-only, such that it must be "page": 0 for the first call, "page": 1 for the next call, so far so forth.
  • Alternative: While Spot API query methods are still available, please consider using Exchange API v1 to query for orders and trades with more features and options.
  • private/get-order-history
  • Breaking Change: the query will return only historical order.
  • Alternative: Please call private/get-open-orders for open orders.
  • public/get-ticker
  • public/get-book
  • book.{instrument_name}.{depth}
  • public/get-trades
  • trade.{instrument_name}
  • public/get-candlestick
  • candlestick.{time_frame}.{instrument_name}
  • Breaking Change: numbers are enclosed with double quote e.g. "123.45" for consistency.
  • Alternative: While Spot API market data is still available, please consider using Exchange API v1 with more features and options for market data subscription.
  • candlestick.{instrument_name}.{depth}
  • Breaking Change: Replaced by candlestick.{time_frame}.{instrument_name}
  • Alternative: While Spot API market data is still available, please consider using Exchange API v1 with more features and options for market data subscription.
  • public/get-book
  • book.{instrument_name}.{depth}
  • Breaking Change: depth support is changed from "up to 150" to "up to 50".
  • Alternative: While Spot API market data is still available, please consider using Exchange API v1 with more features and options for market data subscription.
  • book.{instrument_name}.{depth}
  • Breaking Change: book_subscription_type enum is renamed from SNAPSHOT_AND_UPDATES to SNAPSHOT_AND_UPDATE
  • Alternative: While Spot API market data is still available, please consider using Exchange API v1 with more features and options for market data subscription.

Generating the API Key

Before sending any requests, you'll need to generate a new API key.

This can be done in the Exchange website under User Center - API.

After generating the key, there are two things you need to carefully note down:

API Key and Secret are randomly generated by the system and can not be modified. Default settings will be set to "Can Read" only, and you have the option of adding or removing certain permissions for your API Key via Web UI.

You can optionally specify a whitelist of IP addresses when generating the API Key.

If specified, the API can only be used from the whitelisted IP addresses.

Rate Limits

REST API

For authenticated calls, rate limits are per API method, per API key:

Method Limit
private/create-order
private/cancel-order
private/cancel-all-orders
15 requests per 100ms each
private/get-order-detail 30 requests per 100ms
private/get-trades 1 requests per second
private/get-order-history 1 requests per second
All others 3 requests per 100ms each

For public market data calls, rate limits are per API method, per IP address:

Method Limit
public/get-book
public/get-ticker
public/get-trades
100 requests per second each

Websocket

Websocket Limit
User API 150 requests per second
Market Data 100 requests per second

private/get-trades and private/get-order-history is rate limited at 5 requests per second on the Websocket

Important Note

We recommend adding a 1-second sleep after establishing the websocket connection, and before requests are sent.

This will avoid occurrences of rate-limit (`TOO_MANY_REQUESTS`) errors, as the websocket rate limits are pro-rated based on the calendar-second that the websocket connection was opened.

REST API Root Endpoint

Documentation for the old REST API V1 can be found here.

UAT Sandbox

REST API v2

https://uat-api.3ona.co/v2/{method}

Production (Effective: 2022-11-01)

https://api.crypto.com/v2/{method}

Websocket Root Endpoints

The Websocket is available across two servers -- the User API Websocket (for authenticated requests and subscriptions), and Market Data Websocket:

UAT Sandbox

Websocket (User API and Subscriptions)

wss://uat-stream.3ona.co/v2/user

Websocket (Market Data Subscriptions)

wss://uat-stream.3ona.co/v2/market

Production (Effective: 2022-11-01)

Websocket (User API and Subscriptions)

wss://stream.crypto.com/v2/user

Websocket (Market Data Subscriptions)

wss://stream.crypto.com/v2/market

Common API Reference

Most of the APIs for REST and Websockets are shared, and follow the same request format and response, allowing users to easily switch between the two methods.

The Applies To section under each API allows you to see which platform supports the API.

Naming Conventions

Request Format

The following information applies to both REST API and websockets commands:

Name Type Required Description
id long N Request Identifier
Range: 0 to 9,223,372,036,854,775,807
Response message will contain the same id
method string Y The method to be invoked
params object N Parameters for the methods
api_key string Depends API key. See Digital Signature section
sig string Depends Digital signature. See Digital Signature section
nonce long Y Current timestamp (milliseconds since the Unix epoch)

Digital Signature

const crypto = require("crypto-js");

const signRequest = (request_body, api_key, secret) => {
  const { id, method, params, nonce } = request_body;

  function isObject(obj) { return obj !== undefined && obj !== null && obj.constructor == Object; }
  function isArray(obj) { return obj !== undefined && obj !== null && obj.constructor == Array; }
  function arrayToString(obj) { return obj.reduce((a,b) => { return a + (isObject(b) ? objectToString(b) : (isArray(b) ? arrayToString(b) : b)); }, ""); }
  function objectToString(obj) { return (obj == null ? "" : Object.keys(obj).sort().reduce((a, b) => { return a + b + (isArray(obj[b]) ? arrayToString(obj[b]) : (isObject(obj[b]) ? objectToString(obj[b]) : obj[b])); }, "")); }

  const paramsString = objectToString(params);

  console.log(paramsString);

  const sigPayload = method + id + api_key + paramsString + nonce;
  request_body.sig = crypto.HmacSHA256(sigPayload, secret).toString(crypto.enc.Hex);
};

const apiKey = "token"; /* User API Key */
const apiSecret = "secretKey"; /* User API Secret */

let request = {
  id: 11,
  method: "private/get-order-detail",
  api_key: API_KEY,
  params: {
    order_id: 53287421324
  },
  nonce: 1587846358253,
};

const requestBody = JSON.stringify(signRequest(request, apiKey, apiSecret)));
import hmac
import hashlib
import time

API_KEY = "API_KEY"
SECRET_KEY = "SECRET_KEY"

req = {
    "id": 14,
    "method": "private/create-order-list",
    "api_key": API_KEY,
    "params": {
        "contingency_type": "LIST",
        "order_list": [
            {
                "instrument_name": "ONE_USDT",
                "side": "BUY",
                "type": "LIMIT",
                "price": "0.24",
                "quantity": "1.0"
            },
            {
                "instrument_name": "ONE_USDT",
                "side": "BUY",
                "type": "STOP_LIMIT",
                "price": "0.27",
                "quantity": "1.0",
                "trigger_price": "0.26"
            }
        ]
    },
    "nonce": int(time.time() * 1000)
}

# First ensure the params are alphabetically sorted by key
param_str = ""

MAX_LEVEL = 3


def params_to_str(obj, level):
    if level >= MAX_LEVEL:
        return str(obj)

    return_str = ""
    for key in sorted(obj):
        return_str += key
        if obj[key] is None:
            return_str += 'null'
        elif isinstance(obj[key], list):
            for subObj in obj[key]:
                return_str += params_to_str(subObj, ++level)
        else:
            return_str += str(obj[key])
    return return_str


if "params" in req:
    param_str = params_to_str(req['params'], 0)

payload_str = req['method'] + str(req['id']) + req['api_key'] + param_str + str(req['nonce'])

req['sig'] = hmac.new(
    bytes(str(SECRET_KEY), 'utf-8'),
    msg=bytes(payload_str, 'utf-8'),
    digestmod=hashlib.sha256
).hexdigest()

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Net.WebSockets;

private const string API_KEY = "YOUR_API_KEY";
private const string API_SECRET = "YOUR_API_SECRET";

private static string GetSign (Dictionary Request)
{
    Dictionary Params = Request.Params;

    // Ensure the params are alphabetically sorted by key
    string ParamString = string.Join("", Params.Keys.OrderBy(key => key).Select(key => key + Params[key]));

    string SigPayload = Request.method + Request.id + API_KEY + ParamString + Request.nonce;

    var hash = new HMACSHA256(API_SECRET);
    var ComputedHash = hash.ComputeHash(SigPayload);
    return ToHex(ComputedHash, false);
}
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ApiRequestJson {
  private Long id;
  private String method;
  private Map<String, Object> params;
  private String sig;

  @JsonProperty("api_key")
  private String apiKey;

  private Long nonce;
}

//------------

import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Hex;

public class SigningUtil {

  private static final String HMAC_SHA256 = "HmacSHA256";
  private static final int MAX_LEVEL = 3;

  public static boolean verifySignature(ApiRequestJson apiRequestJson, String secret) {
    try {
      return genSignature(apiRequestJson, secret).equalsIgnoreCase(apiRequestJson.getSig());
    } catch (Exception e) {
      return false;
    }
  }

  @SuppressWarnings("unchecked")
  public static String getParamString(final Object paramObject) {
    StringBuilder sb = new StringBuilder();
    appendParamString(sb, paramObject, 0);
    return sb.toString();
  }


  @SuppressWarnings("unchecked")
  private static void appendParamString(final StringBuilder paramsStringBuilder, final Object paramObject, final int level) {
    if (level >= MAX_LEVEL) {
      paramsStringBuilder.append(paramObject.toString());
      return;
    }

    if (paramObject instanceof Map) {
      TreeMap<String, Object> params = new TreeMap<>((Map) paramObject);
      for (Map.Entry<String, Object> entry : params.entrySet()) {
        if (entry.getValue() instanceof Double) {
          paramsStringBuilder
              .append(entry.getKey())
              .append((new BigDecimal(entry.getValue().toString()))
                  .stripTrailingZeros()
                  .toPlainString());
        } else if (entry.getValue() instanceof List || entry.getValue() instanceof Map) {
          paramsStringBuilder
              .append(entry.getKey());
          appendParamString(paramsStringBuilder, entry.getValue(), level + 1);
        } else {
          paramsStringBuilder
              .append(entry.getKey())
              .append(entry.getValue());
        }
      }
    } else if (paramObject instanceof List) {
      List list = (List) paramObject;
      for (Object o : list) {
        appendParamString(paramsStringBuilder, o, level + 1);
      }
    } else {
      paramsStringBuilder.append(paramObject.toString());
    }
  }

  public static String genSignature(ApiRequestJson apiRequestJson, String secret)
      throws NoSuchAlgorithmException, InvalidKeyException {
    final byte[] byteKey = secret.getBytes(StandardCharsets.UTF_8);
    Mac mac = Mac.getInstance(HMAC_SHA256);
    SecretKeySpec keySpec = new SecretKeySpec(byteKey, HMAC_SHA256);
    mac.init(keySpec);

    String paramsString = "";

    if (apiRequestJson.getParams() != null) {
      paramsString += getParamString(apiRequestJson.getParams());
    }

    String sigPayload =
        apiRequestJson.getMethod()
            + apiRequestJson.getId()
            + apiRequestJson.getApiKey()
            + paramsString
            + (apiRequestJson.getNonce() == null ? "" : apiRequestJson.getNonce());

    byte[] macData = mac.doFinal(sigPayload.getBytes(StandardCharsets.UTF_8));

    return Hex.encodeHexString(macData);
  }

  public static ApiRequestJson sign(ApiRequestJson apiRequestJson, String secret)
      throws InvalidKeyException, NoSuchAlgorithmException {
    apiRequestJson.setSig(genSignature(apiRequestJson, secret));

    return apiRequestJson;
  }

  public static void main(String[] argv) throws InvalidKeyException, NoSuchAlgorithmException {
    ApiRequestJson apiRequestJson = ApiRequestJson.builder()
            .id(11L)
            .apiKey("token")
            .method("public/auth")
            .nonce(1589594102779L)
            .build();

    System.out.println(genSignature(apiRequestJson, "secretKey"));

    System.out.println(sign(apiRequestJson, "secretKey"));

  }
}

For REST API, only the private methods require a Digital Signature (as "sig") and API key (as "api_key") to be passed in. These private endpoints are only accessible by authenticated users.

For Websocket (User API), the public/auth command has to be invoked ONCE per session, with the Digital Signature (as "sig") and API key (as "api_key") as part of the request. Once authenticated, you will gain access to user-specific commands, and no longer need to use the pass in the Digital Signature and API key anymore for the duration of the session.

The authentication is based on the pairing of the API Key, along with the HMAC-SHA256 hash of the request parameters using the API Secret as the cryptographic key.

The algorithm for generating the HMAC-SHA256 signature is as follows:

Digital Signature Issues

Based on the language, and the way data-types are handled, the digital signature may be incorrectly calculated for certain values.

One known case is if parameters contain numbers, and the value passed in is a whole numbers that still has decimal suffixes, e.g. 8000.000 instead of 8000.

When the JSON request is sent to the server, the client (when parsing as JSON) may cast the number 8000.000 as 8000 automatically, which is what the server would see.

However, the digital signature may have been calculated using 8000.000 in the payload, which would result in a digital signature mismatch.

If this scenario happens in your case, there are three options:

Response Format

Name Type Description
id long Original request identifier
method string Method invoked
result object Result object
code int 0 for success, see below for full list
message string (optional) For server or error messages
original string (optional) Original request as a string, for error cases
detail_code string Detail Response Code. Please refer to Exchange v1 API for the list of values.
detail_message string Detail Message (if any).

Response and Reason Codes

These codes are shared by both the response, and the reason field for rejected orders.

Code HTTP Status Message Code Description
0 200 -- Success
10000 200 PARTIAL_SUCCESS Batch request processed successfully and some requests succeeded (E.g. Some orders created when creating a list of orders)

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10001 500 SYS_ERROR Malformed request, (E.g. not using application/json for REST)

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10002 401 UNAUTHORIZED Not authenticated, or key/signature incorrect

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10003 401 IP_ILLEGAL IP address not whitelisted

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10004 400 BAD_REQUEST Missing required fields

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10005 401 USER_TIER_INVALID Disallowed based on user tier

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10006 429 TOO_MANY_REQUESTS Requests have exceeded rate limits

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10007 400 INVALID_NONCE Nonce value differs by more than 30 seconds from server

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10008 400 METHOD_NOT_FOUND Invalid method specified

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10009 400 INVALID_DATE_RANGE Invalid date range

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
10010 200 FAIL Batch request processed successfully but all requests failed (E.g. No orders created when creating a list of orders)

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
20001 400 DUPLICATE_RECORD Duplicated record

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
20002 400 NEGATIVE_BALANCE Insufficient balance

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30003 400 SYMBOL_NOT_FOUND Invalid instrument_name specified

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30004 400 SIDE_NOT_SUPPORTED Invalid side specified

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30005 400 ORDERTYPE_NOT_SUPPORTED Invalid type specified

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30006 400 MIN_PRICE_VIOLATED Price is lower than the minimum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30007 400 MAX_PRICE_VIOLATED Price is higher than the maximum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30008 400 MIN_QUANTITY_VIOLATED Quantity is lower than the minimum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30009 400 MAX_QUANTITY_VIOLATED Quantity is higher than the maximum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30010 400 MISSING_ARGUMENT Required argument is blank or missing

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30013 400 INVALID_PRICE_PRECISION Too many decimal places for Price

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30014 400 INVALID_QUANTITY_PRECISION Too many decimal places for Quantity

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30015 400 REJECTION_FOR_EXEC_INST_POST_ONLY The order is sent with "exec_inst=POST_ONLY", meanwhile, it can not be placed as resting active maker order

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30016 400 MIN_NOTIONAL_VIOLATED The notional amount is less than the minimum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30017 400 MAX_NOTIONAL_VIOLATED The notional amount exceeds the maximum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30023 400 MIN_AMOUNT_VIOLATED Amount is lower than the minimum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30024 400 MAX_AMOUNT_VIOLATED Amount is higher than the maximum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
30025 400 AMOUNT_PRECISION_OVERFLOW Amount precision exceeds the maximum

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
40001 400 MG_INVALID_ACCOUNT_STATUS Operation has failed due to your account's status. Please try again later.

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
40002 400 MG_TRANSFER_ACTIVE_LOAN Transfer has failed due to holding an active loan. Please repay your loan and try again later.

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
40003 400 MG_INVALID_LOAN_CURRENCY Currency is not same as loan currency of active loan

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
40004 400 MG_INVALID_REPAY_AMOUNT Only supporting full repayment of all margin loans

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
40005 400 MG_NO_ACTIVE_LOAN No active loan

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
40006 400 MG_BLOCKED_BORROW Borrow has been suspended. Please try again later.

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
40007 400 MG_BLOCKED_NEW_ORDER Placing new order has been suspended. Please try again later.

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
50001 400 DW_CREDIT_LINE_NOT_MAINTAINED Please ensure your credit line is maintained and try again later.

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
5000008 400 SYSTEM_BUSY System is currently busy, please try later.

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
5000012 400 CURRENCY_CLOSED Currency is closed

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
5000013 400 BAD_PARAMETER Bad parameter(s)

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.
5000808 403 WITHDRAWAL_FORBIDDEN_
TEMPORARILY_UNAVAILABLE
Withdrawal temporarily unavailable

Please refer to detail_code and detail_message for additional information. Please refer to Exchange v1 API for the list of values.

Websocket Termination Codes

Code Description
1000 Normal disconnection by server, usually when the heartbeat isn't handled properly
1006 Abnormal disconnection
1013 Server restarting -- try again later

Error Response Format

Due to the asynchronous nature of websocket requests, a robust and consistent error response is crucial in order to match the response with the request.

To ensure API consistency for websocket error responses, if the id and method is omitted in the original request, id will have a value of -1 and method will have a value of ERROR.

The original request will be returned as an escaped string in the original field.

public/auth

Request Sample

{
  "id": 11,
  "method": "public/auth",
  "api_key": "api_key",
  "sig": "d0267b151db609885bad2e4f8ad07610f7913e166c35adaf5697d59a64e3755a",
  "nonce": :1587846358253
}

Response Sample

{
  "id":11,
  "method":"public/auth",
  "code":0
}

To access user-specific websocket methods, public/auth has to be invoked with a valid API key and Digital Signature (refer to the Digital Signature section).

REST API calls do NOT need to do this.

Important Note

We recommend adding a 1-second sleep after establishing the websocket connection, and before requests are sent.

This will avoid occurrences of rate-limit (`TOO_MANY_REQUESTS`) errors, as the websocket rate limits are pro-rated based on the calendar-second that the websocket connection was opened.

Request Params

Name Type Description
api_key string API key
sig string Digital Signature (see Digital Signature section)

Applies To:

Websocket (User API)

public/get-instruments

Note

This API is deprecated. Please use v1 get-instrument.

Request Sample

{
  "id":11,
  "method":"public/get-instruments",
  "nonce":1506584998239
}

Response Sample

{
  "id": -1,
  "method": "public/get-instruments",
  "code": 0,
  "result": {
    "instruments": [
      {
        "instrument_name": "RSR_USDT",
        "quote_currency": "USDT",
        "base_currency": "RSR",
        "price_decimals": 7,
        "quantity_decimals": 0,
        "margin_trading_enabled": true,
        "margin_trading_enabled_5x": true,
        "margin_trading_enabled_10x": true,
        "max_quantity": "1000000000",
        "min_quantity": "10",
        "max_price": "1000",
        "min_price": "0.0000001",
        "last_update_date": 1666261193053,
        "quantity_tick_size": "10",
        "price_tick_size": "0.0000001"
      },
      {
        "instrument_name": "MANA_USDT",
        "quote_currency": "USDT",
        "base_currency": "MANA",
        "price_decimals": 7,
        "quantity_decimals": 0,
        "margin_trading_enabled": true,
        "margin_trading_enabled_5x": true,
        "margin_trading_enabled_10x": true,
        "max_quantity": "1000000000",
        "min_quantity": "10",
        "max_price": "1000",
        "min_price": "0.0000001",
        "last_update_date": 1666261193053,
        "quantity_tick_size": "10",
        "price_tick_size": "0.0000001"
      }
    ]
  }
}

Provides information on all supported instruments (e.g. BTC_USDT)

For the websocket, as a public function, it can be called without authentication.

Applies To

REST Websocket (User API)

REST Method

GET

Response Attributes

An array of instruments, consisting of:

Name Type Description
instrument_name string e.g. BTC_USDT
quote_currency string e.g. USDT
base_currency string e.g. BTC
price_decimals integer Maximum decimal places for specifying price
quantity_decimals integer Maximum decimal places for specifying quantity
margin_trading_enabled boolean always false
margin_trading_enabled_5x boolean always false
margin_trading_enabled_10x boolean always false
max_quantity string Maximum quantity
min_quantity string Minimum quantity
max_price string Maximum price
min_price string Minimum price
last_update_date Number Instrument last update time (Unix timestamp)
quantity_tick_size string Quantity tick size
price_tick_size string Price tick size

public/get-book

Request Sample

https://{URL}/v2/public/get-book?instrument_name=BTC_USDT&depth=10

Response Sample

{
  "code":0,
  "method":"public/get-book",
  "result": {
    "depth": 10,
    "data": [{
      "asks": [
        ["50126.000000", "0.400000", "0"],
        ["50130.000000", "1.279000", "0"],
        ["50136.000000", "1.279000", "0"],
        ["50137.000000", "0.800000", "0"],
        ["50142.000000", "1.279000", "0"],
        ["50148.000000", "2.892900", "0"],
        ["50154.000000", "1.279000", "0"],
        ["50160.000000", "1.133000", "0"],
        ["50166.000000", "3.090700", "0"],
        ["50172.000000", "1.279000", "0"]
      ],
      "bids": [
        ["50113.500000", "0.400000", "0"],
        ["50113.000000", "0.051800", "0"],
        ["50112.000000", "1.455300", "0"],
        ["50106.000000", "1.174800", "0"],
        ["50100.500000", "0.800000", "0"],
        ["50100.000000", "1.455300", "0"],
        ["50097.500000", "0.048000", "0"],
        ["50097.000000", "0.148000", "0"],
        ["50096.500000", "0.399200", "0"],
        ["50095.000000", "0.399200", "0"]
      ]
    }],
    "instrument_name": "BTC_USDT"
  }
}

Fetches the public order book for a particular instrument and depth

Request Params

Name Type Required Description
instrument_name string Y e.g. BTC_USDT, ETH_CRO, etc.
depth string N Number of bids and asks to return (up to 50)

Applies To

REST

REST Method

GET

Response Attributes

Name Type Description
instrument_name string e.g. BTC_USDT, ETH_CRO, etc.
depth string Number of bids and asks to return (up to 50)
data array See below

data consists of:

Name Type Description
bids array Bids array: [0] = Price, [1] = Quantity, [2] = Number of Orders
asks array Asks array: [0] = Price, [1] = Quantity, [2] = Number of Orders
t long Timestamp of the data

Note: Known issue: Number of Orders currently returns 0

public/get-candlestick

Request Sample

https://{URL}/v2/public/get-candlestick?instrument_name=BTC_USDT&timeframe=5m

Response Sample

{
  "code":0,
  "method":"public/get-candlestick",
  "result":{
    "instrument_name":"BTC_USDT",
    "interval":"5m",
    "data":[
      {"t":1596944700000,"o":11752.38,"h":11754.77,"l":11746.65,"c":11753.64,"v":3.694583},
      {"t":1596945000000,"o":11753.63,"h":11754.77,"l":11739.83,"c":11746.17,"v":2.073019},
      {"t":1596945300000,"o":11746.16,"h":11753.24,"l":11738.1,"c":11740.65,"v":0.867247},
      ...
    ]
  }
}

Retrieves candlesticks (k-line data history) over a given period for an instrument (e.g. BTC_USDT)

period can be:

Applies To

REST

Response Attributes

Name Type Description
instrument_name string e.g. ETH_CRO, BTC_USDT
interval string The period (e.g. 5m)
data array See below

data consists of:

Name Type Description
t long End time of candlestick (Unix timestamp)
o number Open
h number High
l number Low
c number Close
v number Volume

public/get-ticker

Request Sample

https://{URL}/v2/public/get-ticker?instrument_name=BTC_USDT

Response Sample

{
  "id": -1,
  "method": "public/get-tickers",
  "code": 0,
  "result": {
    "data": [{
      "h": "51790.00",        // Price of the 24h highest trade
      "l": "47895.50",        // Price of the 24h lowest trade, null if there weren't any trades
      "a": "51174.500000",    // The price of the latest trade, null if there weren't any trades
      "i": "BTCUSD-PERP",     // Instrument name
      "v": "879.5024",        // The total 24h traded volume
      "vv": "26370000.12",    // The total 24h traded volume value (in USD)
      "oi": "12345.12",       // Open interest
      "c": "0.03955106",      // 24-hour price change, null if there weren't any trades
      "b": "51170.000000",    // The current best bid price, null if there aren't any bids
      "k": "51180.000000",    // The current best ask price, null if there aren't any asks
      "t": 1613580710768
    }]
  }
}

Fetches the public tickers for an instrument (e.g. BTC_USDT).

instrument_name can be omitted to show tickers for all instruments

Request Params

Name Type Required Description
instrument_name string N e.g. BTC_USDT, ETH_CRO, etc. Omit for 'all'

Applies To

REST

REST Method

GET

Response Attributes

Name Type Description
h string Price of the 24h highest trade
l string Price of the 24h lowest trade, null if there weren't any trades
a string The price of the latest trade, null if there weren't any trades
i string Instrument name
v string The total 24h traded volum
vv string The total 24h traded volume value (in USD)
oi string The open interest
c string 24-hour price change, null if there weren't any trades
b string The current best bid price, null if there aren't any bids
k string The current best ask price, null if there aren't any asks
t number Trade timestamp

public/get-trades

Request Sample

https://{URL}/v2/public/get-trades?instrument_name=BTC_USDT

Response Sample

{
  "id": 1,
  "method": "public/get-trades",
  "code": 0,
  "result": {
    "data": [{
      "s": "BUY",
      "p": "20722.15",
      "q": "0.00094",
      "t": 1666835079042,
      "d": "4611686018427464824",
      "i": "BTC_USDT",
      "dataTime": 1666835079042
    }]
  }
}

Fetches the public trades for a particular instrument

instrument_name can be omitted to show tickers for all instruments

Request Params

Name Type Required Description
instrument_name string N e.g. BTC_USDT, ETH_CRO, etc. Omit for 'all'

Applies To

REST

REST Method

GET

Response Attributes

Name Type Description
p number Trade price
q number Trade quantity
s string Side ("BUY" or "SELL")
i string Instrument name e.g. BTC_CRO
t number Trade timestamp
d string of number Trade ID
dataTime long Reserved. Can be ignored

private/set-cancel-on-disconnect

Request Sample

{
  "id": "11",
  "method": "private/set-cancel-on-disconnect",
  "params": {
    "scope": "CONNECTION"
  }
}

Response Sample

{
  "id": "11",
  "method": "private/set-cancel-on-disconnect",
  "code": 0,
  "result": {
    "scope": "CONNECTION"
  }
}

Cancel on Disconnect is an optional feature that will cancel all open orders created by the connection upon loss of connectivity between client or server.

This feature is only available via the Websocket.

Request Params

Name Type Required Description
scope string Y Specifies the scope of cancellation, whether it should be applied to the specific connection or to the account (all orders created via Websocket)

ACCOUNT or CONNECTION

Helpful Information

Applies To

Websocket (User API)

Response Attributes

Name Type Description
scope string Specifies the scope of cancellation, whether it should be applied to the specific connection or to the account (all orders created via Websocket)

ACCOUNT or CONNECTION

private/get-cancel-on-disconnect

Request Sample

{
  "id": "11",
  "method": "private/get-cancel-on-disconnect"
}

Response Sample

{
  "id": "11",
  "method": "private/get-cancel-on-disconnect",
  "code": 0,
  "result": {
    "scope": "CONNECTION"
  }
}

Returns the scope of cancellation for the connection.

Request Params

None

Applies To

Websocket (User API)

Response Attributes

Name Type Description
scope string Specifies the scope of cancellation, whether it should be applied to the specific connection or to the account (all orders created via Websocket)

ACCOUNT or CONNECTION

Wallet Management API

private/create-withdrawal

Request Sample

{
  "id": -1,
  "method": "private/create-withdrawal",
  "params": {
    "client_wid": "my_withdrawal_002",
    "currency": "BTC",
    "amount": "1",
    "address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBf",
    "address_tag": "",
    "network_id": null
  },
  "nonce": "1607063412000"
}

Response Sample

{
  "id":-1,
  "method":"private/create-withdrawal",
  "code":0,
  "result": {
    "id": 2220,
    "amount": 1,
    "fee": 0.0004,
    "symbol": "BTC",
    "address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBf",
    "client_wid": "my_withdrawal_002",
    "create_time":1607063412000,
    "network_id": null
  }
}

Creates a withdrawal request. Withdrawal setting must be enabled for your API Key. If you do not see the option when viewing your API Key, this feature is not yet available for you.

Request Params

Name Type Required Description
client_wid string N Optional Client withdrawal ID
currency string Y E.g. BTC, CRO
amount decimal Y
address string Y
address_tag string N Secondary address identifier for coins like XRP, XLM etc. Also known as memo or tags.
network_id string N Select the desired network, require the address to be whitelisted first. See default_network and network in get-currency-networks for the value.

Helpful Information

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

Name Type Description
id long Newly created withdrawal ID
client_wid string (Optional) if a Client withdrawal ID was provided in the request
currency string E.g. BTC, CRO
amount decimal
fee decimal
address string Address with Address Tag (if any)
create_time long

private/get-currency-networks

Request Sample

{
  "id": 12,
  "method": "private/get-currency-networks",
  "params": {},
  "api_key": "api_key",
  "sig": "9b4e5428970d88270ac18aa680d33bf6a42390db2060e7f3b81f579a99cea9d5",
  "nonce": :1640830660110
}

Response Sample

{
  "code": 0,
  "result": {
    "update_time": 1641151604000,
    "currency_map": {
      "AGLD": {
        "full_name": "Adventure Gold",
        "default_network": null,
        "network_list": [
          {
            "network_id": "ETH",
            "withdrawal_fee": null,
            "withdraw_enabled": true,
            "min_withdrawal_amount": 10.0,
            "deposit_enabled": true,
            "confirmation_required": 12
          }
        ]
      },
      "MATIC": {
        "full_name": "Polygon",
        "default_network": "ETH",
        "network_list": [
          {
            "network_id": "BNB",
            "withdrawal_fee": 0.80000000,
            "withdraw_enabled": true,
            "min_withdrawal_amount": 1.6,
            "deposit_enabled": true,
            "confirmation_required": 0
          },
          {
            "network_id": "ETH",
            "withdrawal_fee": 20.00000000,
            "withdraw_enabled": true,
            "min_withdrawal_amount": 40.0,
            "deposit_enabled": true,
            "confirmation_required": 0
          },
          {
            "network_id": "MATIC",
            "withdrawal_fee": 0.08000000,
            "withdraw_enabled": true,
            "min_withdrawal_amount": 0.16,
            "deposit_enabled": true,
            "confirmation_required": 0
          }
        ]
      }
    }
  }
}

Get the symbol network mapping.

Request Params

Name Type Required Description
no param required N/A

Note: You still need to pass in an empty params block like params: {} for API request consistency

Applies To

REST

REST Method

POST

Response Attributes

An Map of currency, consisting of:

Name Type Description
full_name string e.g. SHIBA INU
default_network string If network is not provided in create-withdrawal, it will search for default_network, if there is more than 1 network available.
network_list string A list of networks

network_list:

Name Type Description
network_id string the network id, can be used in create-withdrawal
withdraw_enabled boolean
deposit_enabled boolean
withdrawal_fee decimal
min_withdrawal_amount decimal
confirmation_required int confirmation blocks count

private/get-withdrawal-history

Request Sample

{
  "id": -1,
  "method": "private/get-withdrawal-history",
  "params": {
    "currency": "XRP",
    "start_ts": 1587846300000,
    "end_ts": 1587846358253,
    "page_size": 2,
    "page": 0,
    "status": "1"
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 11,
  "method": "private/get-withdrawal-history",
  "code": 0,
  "result": {
    "withdrawal_list": [
      {
        "currency": "XRP",
        "client_wid": "my_withdrawal_002",
        "fee": 1.0,
        "create_time": 1607063412000,
        "id": "2220",
        "update_time": 1607063460000,
        "amount": 100,
        "address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBf?1234567890",
        "status": "1",
        "txid": "",
        "network_id": null
      }
    ]
  }
}

Fetches withdrawal history. Withdrawal setting must be enabled for your API Key. If you do not see the option when viewing your API Keys, this feature is not yet available for you.

Request Params

Name Type Required Description
currency string N E.g. BTC, CRO
start_ts long N Default is 90 days from current timestamp
end_ts long N Default is current timestamp
page_size int N Page size (Default: 20, Max: 200)
page int N Page number (0-based)
status string N "0"

0 - Pending
1 - Processing
2 - Rejected
3 - Payment In-progress
4 - Payment Failed
5 - Completed
6 - Cancelled

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

An array of withdrawal_list, consisting of:

Name Type Description
id long Newly created withdrawal ID
client_wid string (Optional) if a Client withdrawal ID was provided in the request
currency string E.g. BTC, CRO
amount decimal
fee decimal
address string Address with Address Tag (if any)
create_time long
status string "0"

0 - Pending
1 - Processing
2 - Rejected
3 - Payment In-progress
4 - Payment Failed
5 - Completed
6 - Cancelled
txid string Transaction hash
network_id string Network for the transaction - please see get-currency-networks. Only available when Exchange support multiple network on the currency

private/get-deposit-history

Request Sample

{
  "id": -1,
  "method": "private/get-deposit-history",
  "params": {
    "currency": "XRP",
    "start_ts": 1587846300000,
    "end_ts": 1587846358253,
    "page_size": 2,
    "page": 0,
    "status": "1"
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 11,
  "method": "private/get-deposit-history",
  "code": 0,
  "result": {
    "deposit_list": [
      {
        "currency": "XRP",
        "fee": 1.0,
        "create_time": 1607063412000,
        "id": "2220",
        "update_time": 1607063460000,
        "amount": 100,
        "address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBf?1234567890",
        "status": "1"
      }
    ]
  }
}

Fetches deposit history. Withdrawal setting must be enabled for your API Key. If you do not see the option when viewing your API Keys, this feature is not yet available for you.

Request Params

Name Type Required Description
currency string N E.g. BTC, CRO
start_ts long N Default is 90 days from current timestamp
end_ts long N Default is current timestamp
page_size int N Page size (Default: 20, Max: 200)
page int N Page number (0-based)
status string N "0"

0 - Not Arrived
1 - Arrived
2 - Failed
3 - Pending

Applies To

REST

REST Method

POST

Response Attributes

An array of deposit_list, consisting of:

Name Type Description
id long Newly created deposit ID
currency string E.g. BTC, CRO
amount decimal
fee decimal
address string Address with Address Tag (if any)
create_time long
status string "0"

0 - Not Arrived
1 - Arrived
2 - Failed
3 - Pending

private/get-deposit-address

Request Sample

{
  "id": -1,
  "method": "private/get-deposit-address",
  "params": {
    "currency": "CRO",
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 11,
  "method": "private/get-deposit-address",
  "code": 0,
  "result": {
    "deposit_address_list": [
      {
        "currency": "CRO",
        "create_time": 1615886328000,
        "id": "12345",
        "address": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "status": "1",
        "network": "CRO"
      },
      {
        "currency": "CRO",
        "create_time": 1615886332000,
        "id": "12346",
        "address": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
        "status": "1",
        "network": "ETH"
      }
    ]
  }
}

Fetches deposit address. Withdrawal setting must be enabled for your API Key. If you do not see the option when viewing your API Keys, this feature is not yet available for you.

Request Params

Name Type Required Description
currency string Y E.g. BTC, CRO

Applies To

REST

REST Method

POST

Response Attributes

An array of deposit_address_list, consisting of:

Name Type Description
id long Newly created deposit ID
currency string E.g. BTC, CRO
network string E.g. ETH, CRO

When currency = CRO, network = CRO, it is a main net address.
When currency = CRO, network = ETH, it is an ERC20 address.
address string Address with Address Tag (if any)
create_time long
status string "0"

0 - Inactive
1 - Active

private/export/create-export-request

Request Sample

{
  "id": 12,
  "method": "private/export/create-export-request",
  "api_key": "yyyyy.........",
  "params": {
    "start_ts": 1650949742000, "end_ts": 1650967742000, // 2002-APR-26 05:09:02 UTC to 2002-APR-26 10:09:02 UTC
    "instrument_names": ["BTC_USDT"],                   // BTC_USDT only
    "requested_data": ["SPOT_ORDER"],
    "client_request_id": "My Export 123 - Part 1"
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

{
  "id": 12,
  "method": "private/export/create-export-request",
  "api_key": "yyyyy.........",
  "params": {
    "start_ts": 1650967742000, "end_ts": 1650985742000, // 2002-APR-26 10:09:02 UTC to 2002-APR-26 15:09:02 UTC
    "instrument_names": ["BTC_USDT"],                   // BTC_USDT only
    "requested_data": ["SPOT_ORDER"],
    "client_request_id": "My Export 123 - Part 2"
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

{
  "id": 12,
  "method": "private/export/create-export-request",
  "api_key": "yyyyy.........",
  "params": {
    "start_ts": 1650985742000, "end_ts": 1651000142000, // 2002-APR-26 15:09:02 UTC to 2002-APR-26 19:09:02 UTC
    "instrument_names": ["BTC_USDT"],                   // BTC_USDT only
    "requested_data": ["SPOT_ORDER"],
    "client_request_id": "My Export 123 - Part 3"
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

Response Sample

{
  "id": 12,
  "method": "private/export/create-export-request",
  "result": {
    "id": 1234567890,
    "status": 'PENDING',
    "client_request_id": 'My Export 123 - Part 1',
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

{
  "id": 12,
  "method": "private/export/create-export-request",
  "result": {
    "id": 1357924680,
    "status": 'PENDING',
    "client_request_id": 'My Export 123 - Part 2',
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

{
  "id": 12,
  "method": "private/export/create-export-request",
  "result": {
    "id": 2468013579,
    "status": 'PENDING',
    "client_request_id": 'My Export 123 - Part 3',
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

Request Params

Name Type Required Description
instrument_names String N e.g. BTC_CRO, ONLY ONE Symbols per request
start_ts Long Y Epoch (in milli secs)
end_ts Long Y Epoch (in milli secs)
requested_data Array of String Y SPOT_ORDER,
SPOT_TRADE,
MARGIN_ORDER,
MARGIN_TRADE ,
OEX_ORDER,
OEX_TRADE
client_request_id string N Max Length 256 Characters

Applies To

REST

REST Method

POST

Response Attributes

Name Type Description
id long
client_request_id string
status string PENDING, ACTIVE, COMPLETED, FAILED, TIMEOUT
expire_time Long Epoch

Response Codes

0: Success
10004: Bad Request
10006: Too Many Request
10009: Invalid Date Range
20001: Duplicate Record
30003: Symbol Not Found
30010: Missing Argument

private/export/get-export-requests

Request Sample

{
  "id": 12,
  "method": "private/export/get-export-requests",
  "api_key": "yyyyy.........",
  "params": {
    "start_ts": 1650949742000, "end_ts": 1651000142000, // 2002-APR-26 05:09:02 UTC to 2002-APR-26 19:09:02 UTC
    "instrument_names": ["BTC_USDT"],                   // BTC_USDT only
    "requested_data": ["SPOT_ORDER"]
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

Response Sample

{
  "id": 12,
  "method": "private/export/get-export-requests",
  "result": {
    "user_batch_list": [
      {
        "id": "1234567890",
        "start_ts": 1650949742000, "end_ts": 1650967742000, // 2002-APR-26 05:09:02 UTC to 2002-APR-26 10:09:02 UTC
        "instrument_names": ["BTC_USDT"],                   // BTC_USDT only
        "requested_data": ["SPOT_ORDER"],
        "client_request_id": "My Export 123 - Part 1",
        "status": "COMPLETED"
      },
      {
        "id": "1357924680",
        "start_ts": 1650967742000, "end_ts": 1650985742000, // 2002-APR-26 10:09:02 UTC to 2002-APR-26 15:09:02 UTC
        "instrument_names": ["BTC_USDT"],                   // BTC_USDT only
        "requested_data": ["SPOT_ORDER"],
        "client_request_id": "My Export 123 - Part 2",
        "status": "COMPLETED"
      },
      {
        "id": "2468013579",
        "start_ts": 1650985742000, "end_ts": 1651000142000, // 2002-APR-26 15:09:02 UTC to 2002-APR-26 19:09:02 UTC
        "instrument_names": ["BTC_USDT"],                   // BTC_USDT only
        "requested_data": ["SPOT_ORDER"],
        "client_request_id": "My Export 123 - Part 3",
        "status": "COMPLETED"
      }
    ]
  }
}

Request Params

Name Type Required Description
instrument_names String N e.g. BTC_CRO, ONLY ONE Symbols per request
start_ts Long N Epoch (in milli secs)
end_ts Long N Epoch (in milli secs)
requested_data Array of String N SPOT_ORDER,
SPOT_TRADE,
MARGIN_ORDER,
MARGIN_TRADE ,
OEX_ORDER,
OEX_TRADE
page_size Integer N Page size (Default: 20, max: 200)
page Integer N Page number (0-based)

Applies To

REST

REST Method

POST

Response Attributes

Name Type Description
id Long Use this id to download the zipped export when status is COMPLETED.
client_request_id String
instrument_names String
start_ts Long Epoch (in milli secs)
end_ts Long Epoch (in milli secs)
requested_data Array of String SPOT_ORDER,
SPOT_TRADE,
MARGIN_ORDER,
MARGIN_TRADE ,
OEX_ORDER,
OEX_TRADE
status string PENDING, ACTIVE, COMPLETED, FAILED, TIMEOUT
create_time Long Epoch
expire_time Long Epoch

private/export/download-export-output

Request Sample

{
  "id": 12,
  "method": "private/export/download-export-output",
  "api_key": "yyyyy.........",
  "params": {
    "id": "1234567890"
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

{
  "id": 12,
  "method": "private/export/download-export-output",
  "api_key": "yyyyy.........",
  "params": {
    "id": "1357924680"
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

{
  "id": 12,
  "method": "private/export/download-export-output",
  "api_key": "yyyyy.........",
  "params": {
    "id": "2468013579"
  },
  "nonce": 1650964812203,
  "sig": "xxxxxxxx...."
}

Request Params

Name Type Required Description
id Long Y

Applies To

REST

REST Method

POST

Response Parameters

Zip of CSVs

Spot Trading API

private/get-account-summary

Request Sample

{
  "id": 11,
  "method": "private/get-account-summary",
  "params": {
    "currency": "CRO"
  },
  "nonce": 1587523073344
}

// OR (for all currencies, omit currency, but ensure params still exists as {})

{
  "id": 11,
  "method": "private/get-account-summary",
  "params": {},
  "nonce": 1587523073344
}

Response Sample

{
  "id": 11,
  "method": "private/get-account-summary",
  "code": 0,
  "result": {
    "accounts": [
      {
        "balance": 99999999.905000000000000000,
        "available": 99999996.905000000000000000,
        "order": 3.000000000000000000,
        "stake": 0,
        "currency": "CRO"
      }
    ]
  }
}

Returns the account balance of a user for a particular token

Request Params

Name Type Required Description
currency string N Specific currency, e.g. CRO. Omit for 'all'

Omit the currency parameter for ALL currencies, but ensure you keep params: {} for API request consistency.

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

An array of accounts, consisting of:

Name Type Description
balance number Total balance
available number Available balance (e.g. not in orders, or locked, etc.)
order number Balance locked in orders
stake number Balance locked for staking (typically only used for CRO)
currency string e.g. CRO

private/create-order

Request Sample

{
  "id": 11,
  "method": "private/create-order",
  "params": {
    "instrument_name": "ETH_CRO",
    "side": "BUY",
    "type": "LIMIT",
    "price": 100.12,
    "quantity": 1.2,
    "client_oid": "my_order_0002",
    "time_in_force": "GOOD_TILL_CANCEL",
    "exec_inst": "POST_ONLY"
  },
  "nonce": 1587846358253
}

// Stop Limit Example

{
  "id": 15,
  "method": "private/create-order",
  "params": {
    "instrument_name": "BTC_USDT",
    "side": "BUY",
    "type": "STOP_LIMIT",
    "quantity": 1,
    "trigger_price": 9000,
    "price": 9100,
    "client_oid": "my_stop_limit_order_0015",
    "time_in_force": "GOOD_TILL_CANCEL"
  },
  "nonce": "1598070206891”
}

Response Sample

{
  "id": 11,
  "method": "private/create-order",
  "code": 0,
  "result": {
    "order_id": "337843775021233500",
    "client_oid": "my_order_0002"
  }
}

Creates a new BUY or SELL order on the Exchange.

This call is asynchronous, so the response is simply a confirmation of the request.

The user.order subscription can be used to check when the order is successfully created.

Request Params

Name Type Required Description
instrument_name string Y e.g., ETH_CRO, BTC_USDT
side string Y BUY, SELL
type string Y LIMIT, MARKET, STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
price number Depends For LIMIT and STOP_LIMIT orders only:
Unit price
quantity number Depends For LIMIT Orders, MARKET, STOP_LOSS, TAKE_PROFIT orders only:
Order Quantity to be Sold
notional number Depends For MARKET (BUY), STOP_LOSS (BUY), TAKE_PROFIT (BUY) orders only:
Amount to spend
client_oid string N Optional Client order ID (Maximum 36 characters). If a Client Order ID is not provided, it will be the nonce in the request. As nonce can be the same among orders, it is recommened to specify client_oid to prevent order being rejected.
time_in_force string N (Limit Orders Only)
Options are:
- GOOD_TILL_CANCEL (Default if unspecified)
- FILL_OR_KILL
- IMMEDIATE_OR_CANCEL
exec_inst string N (Limit Orders Only)
Options are:
- POST_ONLY
- Or leave empty
trigger_price number N Used with STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
Dictates when order will be triggered


Here are the mandatory parameters based on order type:

Type Side Additional Mandatory Parameters
LIMIT Both quantity, price
MARKET BUY notional or quantity, mutually exclusive
MARKET SELL quantity
STOP_LIMIT Both price, quantity, trigger_price
TAKE_PROFIT_LIMIT Both price, quantity, trigger_price
STOP_LOSS BUY notional, trigger_price
STOP_LOSS SELL quantity, trigger_price
TAKE_PROFIT BUY notional, trigger_price
TAKE_PROFIT SELL quantity, trigger_price


Helpful information:


To create trigger orders against market price:

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

Name Type Description
order_id number Newly created order ID
client_oid string If a Client Order ID was provided in the request, otherwise, will be the nonce in the request. As nonce can be the same among orders, it is recommened to specify client_oid.

private/cancel-order

Request Sample

{
  "id": 11,
  "method": "private/cancel-order",
  "params": {
    "instrument_name": "ETH_CRO",
    "order_id": "337843775021233500"
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 11,
  "method": "private/cancel-order",
  "code":0
}

Cancels an existing order on the Exchange (asynchronous)

This call is asynchronous, so the response is simply a confirmation of the request.

The user.order subscription can be used to check when the order is successfully cancelled.

Request Params

Name Type Required Description
instrument_name string Y instrument_name, e.g., ETH_CRO, BTC_USDT
order_id string Y Order ID

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

No result block is returned. The code (0 = success) is the primary indicator that the cancel request is queued.

private/create-order-list

Request Sample

// Create List of Orders example
{
  "id": 12,
  "method": "private/create-order-list",
  "params": {
    "contingency_type": "LIST",
    "order_list": [
      {
        "instrument_name": "ETH_CRO",
        "side": "BUY",
        "type": "LIMIT",
        "price": 5799,
        "quantity": 1,
        "client_oid": "my_order_0001",
        "time_in_force": "GOOD_TILL_CANCEL",
        "exec_inst": "POST_ONLY"
      },
      {
        "instrument_name": "ETH_CRO",
        "side": "BUY",
        "type": "LIMIT",
        "price": 5780,
        "quantity": 1,
        "client_oid": "my_order_0002",
        "time_in_force": "GOOD_TILL_CANCEL",
        "exec_inst": "POST_ONLY"
      }
    ]
  },
  "nonce": 1637891379231
}

> Response Sample

```json
// Create List of Orders - All ok
{
"id": 12,
"method": "private/create-order-list",
"code": 0,
"result": {
"result_list": [
{
"index": 0,
"code": 0,
"order_id": "2015106383706015873",
"client_oid": "my_order_0001"
},
{
"index": 1,
"code": 0,
"order_id": "2015119459882149857",
"client_oid": "my_order_0002"
}
]
}
}

// Create List of Orders - Some rejected
{
"id": 12,
"method": "private/create-order-list",
"code": 10001,
"result": {
"result_list": [
{
"index": 0,
"code": 0,
"order_id": "2015106383706015873",
"client_oid": "my_order_0001"
},
{
"index": 1,
"code": 20007,
"message": "INVALID_REQUEST",
"client_oid": "my_order_0002"
}
]
}
}

Create a list of orders on the Exchange.

contingency_type must be LIST, for list of orders creation.

This call is asynchronous, so the response is simply a confirmation of the request.

The user.order subscription can be used to check if the orders are successfully created.

Request Params

Name Type Required Description
contingency_type string Y LIST
order_list array of orders Y LIST: 1-10 orders

Content of each order in order_list

Name Type Required Description
instrument_name string Y e.g., ETH_CRO, BTC_USDT
side string Y BUY, SELL
type string Y LIMIT, MARKET, STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
price number Depends For LIMIT and STOP_LIMIT orders only:
Unit price
quantity number Depends For LIMIT Orders, MARKET, STOP_LOSS, TAKE_PROFIT orders only:
Order Quantity to be Sold
notional number Depends For MARKET (BUY), STOP_LOSS (BUY), TAKE_PROFIT (BUY) orders only:
Amount to spend
client_oid string N Optional Client order ID (Maximum 36 characters)
time_in_force string N (Limit Orders Only)
Options are:
- GOOD_TILL_CANCEL (Default if unspecified)
- FILL_OR_KILL
- IMMEDIATE_OR_CANCEL
exec_inst string N (Limit Orders Only)
Options are:
- POST_ONLY
- Or leave empty
trigger_price number N Used with STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
Dictates when order will be triggered


Here are the mandatory parameters based on order type:

Type Side Additional Mandatory Parameters
LIMIT Both quantity, price
MARKET BUY notional or quantity, mutually exclusive
MARKET SELL quantity
STOP_LIMIT Both price, quantity, trigger_price
TAKE_PROFIT_LIMIT Both price, quantity, trigger_price
STOP_LOSS BUY notional, trigger_price
STOP_LOSS SELL quantity, trigger_price
TAKE_PROFIT BUY notional, trigger_price
TAKE_PROFIT SELL quantity, trigger_price


Contingency Type:

Type Description
LIST Create a list of orders


Helpful information:


To create trigger orders against market price:

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

Name Type Description
result_list array of results List of order creation result

Content of each order in result_list

Name Type Description
index number The index of corresponding order request (Start from 0)
code number 0 if success
message string (Optional) For server or error messages
order_id number Newly created order ID
client_oid string (Optional) if a Client order ID was provided in the request. (Maximum 36 characters)

private/cancel-order-list

Request Sample

// Cancel List of Orders example
{
  "id": 13,
  "method": "private/cancel-order-list",
  "params": {
    "order_list": [
      {
        "instrument_name": "ETH_CRO",
        "order_id": "2015106383706015873"
      },
      {
        "instrument_name": "ETH_CRO",
        "order_id": "2015119459882149857"
      }
    ]
  },
  "nonce": 1587846358253
}

Response Sample

// Cancel List of Orders - All ok
{
  "id": 13,
  "method": "private/cancel-order-list",
  "code":0,
  "result": {
    "result_list": [
      {
        "index": 0,
        "code": 0,
      },
      {
        "index": 1,
        "code": 0,
      }
    ]
  }
}

// Cancel List of Orders - Error encountered
{
  "id": 13,
  "method": "private/cancel-order-list",
  "code": 10001,
  "result": {
    "order_list": [
      {
        "index": 0,
        "code": 0,
      },
      {
        "index": 1,
        "code": 20007,
        "message": "INVALID_REQUEST"
      }
    ]
  }
}

Cancel a list of orders on the Exchange.

This call is asynchronous, so the response is simply a confirmation of the request.

The user.order subscription can be used to check when each of the orders is successfully cancelled.

Request Params (List of Orders)

Name Type Required Description
order_list array of orders N For non contingency orders, A list of orders to be cancelled
instrument_name string N Instrument name of contingency order, e.g., ETH_CRO, BTC_USDT
contingency_id string N ID of the contingency order

Content of each order in order_list

Name Type Required Description
instrument_name string Y instrument_name, e.g., ETH_CRO, BTC_USDT
order_id string Y Order ID

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes (List of Orders)

A result_list will be received:

Name Type Description
result_list array of results List of order cancellation result

Content of each order in result_list

Name Type Description
index number The index of corresponding order request (Start from 0)
code number 0 if success
message string (Optional) For server or error messages

private/cancel-all-orders

Request Sample

{
  "id": 12,
  "method": "private/cancel-all-orders",
  "params": {
    "instrument_name": "ETH_CRO"
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 12,
  "method": "private/cancel-all-order",
  "code": 0
}

Cancels all orders for a particular instrument/pair (asynchronous)

This call is asynchronous, so the response is simply a confirmation of the request.

The user.order subscription can be used to check when the order is successfully cancelled.

Request Params

Name Type Required Description
instrument_name string Y e.g. ETH_CRO, BTC_USDT

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

No result block is returned. The code (0 = success) is the primary indicator that the request is queued.

private/get-order-history

Request Sample

{
  "id": 12,
  "method": "private/get-order-history",
  "params": {
    "instrument_name": "ETH_CRO",
    "start_ts": 1587846300000,
    "end_ts": 1587846358253,
    "page_size": 2,
    "page": 0
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 11,
  "method": "private/get-order-history",
  "code": 0,
  "result": {
    "order_list": [
      {
        "status": "FILLED",
        "side": "SELL",
        "price": 1,
        "quantity": 1,
        "order_id": "367107623521528457",
        "client_oid": "my_order_0002",
        "create_time": 1588777459755,
        "update_time": 1588777460700,
        "type": "LIMIT",
        "instrument_name": "ETH_CRO",
        "cumulative_quantity": 1,
        "cumulative_value": 1,
        "avg_price": 1,
        "fee_currency": "CRO",
        "time_in_force": "GOOD_TILL_CANCEL"
      },
      {
        "status": "FILLED",
        "side": "SELL",
        "price": 1,
        "quantity": 1,
        "order_id": "367063282527104905",
        "client_oid": "my_order_0002",
        "create_time": 1588776138290,
        "update_time": 1588776138679,
        "type": "LIMIT",
        "instrument_name": "ETH_CRO",
        "cumulative_quantity": 1,
        "cumulative_value": 1,
        "avg_price": 1,
        "fee_currency": "CRO",
        "time_in_force": "GOOD_TILL_CANCEL"
      }
    ]
  }
}

Gets the order history for a particular instrument

If paging is used, enumerate each page (starting with 0) until an empty order_list array appears in the response.

Users should use user.order to keep track of real-time order updates, and private/get-order-history should primarily be used for recovery; typically when the websocket is disconnected.

Request Params

Name Type Required Description
instrument_name string N e.g. ETH_CRO, BTC_USDT. Omit for 'all'
start_ts long N Start timestamp (milliseconds since the Unix epoch) - defaults to 24 hours ago
end_ts long N End timestamp (milliseconds since the Unix epoch) - defaults to 'now'
page_size int N Page size (Default: 20, max: 200)
page int N Page number (0-based)

Note: If you omit all parameters, you still need to pass in an empty params block like params: {} for API request consistency

Maximum Duration

The maximum duration between start_ts and end_ts is 24 hours.

You will receive an INVALID_DATE_RANGE error if the difference exceeds the maximum duration.

For users looking to pull longer historical order data, users can create a loop to make a request for each 24-period from the desired start to end time.

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

An array of order_list, consisting of:

Name Type Description
status string ACTIVE, CANCELED, FILLED, REJECTED or EXPIRED
reason string Reason code (see "Response and Reason Codes") -- only for REJECTED orders
side string BUY, SELL
price number Price specified in the order
quantity number Quantity specified in the order
order_id string Order ID
client_oid string (Optional) Client order ID if included in request. (Maximum 36 characters)
create_time number Order creation time (Unix timestamp)
update_time number Order update time (Unix timestamp)
type string LIMIT, MARKET, STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
instrument_name string e.g. ETH_CRO, BTC_USDT
cumulative_quantity number Cumulative executed quantity (for partially filled orders)
cumulative_value number Cumulative executed value (for partially filled orders)
avg_price number Average filled price. If none is filled, returns 0
fee_currency string Currency used for the fees (e.g. CRO)
time_in_force string - GOOD_TILL_CANCEL
- FILL_OR_KILL
- IMMEDIATE_OR_CANCEL
exec_inst string Empty or POST_ONLY (Limit Orders Only)
trigger_price number Used for trigger-related orders

Note: To detect a 'partial filled' status, look for status as ACTIVE and cumulative_quantity > 0.

private/get-open-orders

Request Sample

{
  "id": 12,
  "method": "private/get-open-orders",
  "params": {
    "instrument_name": "ETH_CRO",
    "page_size": 2,
    "page": 0
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 11,
  "method": "private/get-open-orders",
  "code": 0,
  "result": {
    "count": 1177,
    "order_list": [
      {
        "status": "ACTIVE",
        "side": "BUY",
        "price": 1,
        "quantity": 1,
        "order_id": "366543374673423753",
        "client_oid": "my_order_0002",
        "create_time": 1588760643829,
        "update_time": 1588760644292,
        "type": "LIMIT",
        "instrument_name": "ETH_CRO",
        "cumulative_quantity": 0,
        "cumulative_value": 0,
        "avg_price": 0,
        "fee_currency": "CRO",
        "time_in_force": "GOOD_TILL_CANCEL"
      },
      {
        "status": "ACTIVE",
        "side": "BUY",
        "price": 1,
        "quantity": 1,
        "order_id": "366455245775097673",
        "client_oid": "my_order_0002",
        "create_time": 1588758017375,
        "update_time": 1588758017411,
        "type": "LIMIT",
        "instrument_name": "ETH_CRO",
        "cumulative_quantity": 0,
        "cumulative_value": 0,
        "avg_price": 0,
        "fee_currency": "CRO",
        "time_in_force": "GOOD_TILL_CANCEL"
      }
    ]
  }
}

Gets all open orders for a particular instrument

Request Params

Name Type Required Description
instrument_name string N instrument_name, e.g., ETH_CRO, BTC_USDT. Omit for "all"
page_size int N Page size (Default: 20, max: 200)
page int N Page number (0-based)

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

Name Type Description
count number Total count of orders

Additionally, an array of order_list, consisting of:

Name Type Description
status string ACTIVE, CANCELED, FILLED, REJECTED or EXPIRED
reason string Reason code (see "Response and Reason Codes") -- only for REJECTED orders
side string BUY, SELL
price number Price specified in the order
quantity number Quantity specified in the order
order_id string Order ID
client_oid string (Optional) Client order ID if included in request. (Maximum 36 characters)
create_time number Order creation time (Unix timestamp)
update_time number Order update time (Unix timestamp)
type string LIMIT, MARKET, STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
instrument_name string e.g. ETH_CRO, BTC_USDT
cumulative_quantity number Cumulative executed quantity (for partially filled orders)
cumulative_value number Cumulative executed value (for partially filled orders)
avg_price number Average filled price. If none is filled, returns 0
fee_currency string Currency used for the fees (e.g. CRO)
time_in_force string - GOOD_TILL_CANCEL
- FILL_OR_KILL
- IMMEDIATE_OR_CANCEL
exec_inst string Empty or POST_ONLY (Limit Orders Only)
trigger_price number Used for trigger-related orders

Note: To detect a 'partial filled' status, look for status as ACTIVE and cumulative_quantity > 0.

private/get-order-detail

Request Sample

{
  "id": 12,
  "method": "private/get-order-detail",
  "params": {
    "order_id": "337843775021233500"
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 11,
  "method": "private/get-order-detail",
  "code": 0,
  "result": {
    "trade_list": [
      {
        "side": "BUY",
        "instrument_name": "ETH_CRO",
        "fee": 0.007,
        "trade_id": "371303044218155296",
        "create_time": 1588902493045,
        "traded_price": 7,
        "traded_quantity": 7,
        "fee_currency": "CRO",
        "order_id": "371302913889488619"
      }
    ],
    "order_info": {
      "status": "FILLED",
      "side": "BUY",
      "order_id": "371302913889488619",
      "client_oid": "9_yMYJDNEeqHxLqtD_2j3g",
      "create_time": 1588902489144,
      "update_time": 1588902493024,
      "type": "LIMIT",
      "instrument_name": "ETH_CRO",
      "cumulative_quantity": 7,
      "cumulative_value": 7,
      "avg_price": 7,
      "fee_currency": "CRO",
      "time_in_force": "GOOD_TILL_CANCEL",
      "exec_inst": "POST_ONLY"
    }
  }
}

Gets details on a particular order ID

Request Params

Name Type Required Description
order_id string Y Order ID

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

An array of trade_list, consisting of:

Name Type Description
side string BUY, SELL
instrument_name string e.g. ETH_CRO, BTC_USDT
fee number Trade fee
trade_id string Trade ID
create_time long Trade creation time
traded_price number Executed trade price
traded_quantity number Executed trade quantity
fee_currency string Currency used for the fees (e.g. CRO)
order_id string Order ID

Additionally, an array of order_info, consisting of:

Name Type Description
status string ACTIVE, CANCELED, FILLED, REJECTED or EXPIRED
reason string Reason code (see "Response and Reason Codes") -- only for REJECTED orders
side string BUY, SELL
price number Price specified in the order
quantity number Quantity specified in the order
order_id string Order ID
client_oid string (Optional) Client order ID if included in request. (Maximum 36 characters)
create_time number Order creation time (Unix timestamp)
update_time number Order update time (Unix timestamp)
type string LIMIT, MARKET, STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
instrument_name string e.g. ETH_CRO, BTC_USDT
cumulative_quantity number Cumulative executed quantity (for partially filled orders)
cumulative_value number Cumulative executed value (for partially filled orders)
avg_price number Average filled price. If none is filled, returns 0
fee_currency string Currency used for the fees (e.g. CRO)
time_in_force string - GOOD_TILL_CANCEL
- FILL_OR_KILL
- IMMEDIATE_OR_CANCEL
exec_inst string Empty or POST_ONLY (Limit Orders Only)
trigger_price number Used for trigger-related orders

Note: To detect a 'partial filled' status, look for status as ACTIVE and cumulative_quantity > 0.

private/get-trades

Request Sample

{
  "id": 11,
  "method": "private/get-trades",
  "params": {
    "instrument_name": "ETH_CRO",
    "page_size": 1,
    "page": 0,
    "start_ts": 1488851410000,
    "end_ts": 1688851410000
  },
  "nonce": 1587523073344
}

Response Sample

{
  "id": 11,
  "method": "private/get-trades",
  "code": 0,
  "result": {
    "trade_list": [
      {
        "side": "SELL",
        "instrument_name": "ETH_CRO",
        "fee": 0.014,
        "trade_id": "367107655537806900",
        "create_time": 1588777459755,
        "traded_price": 7,
        "traded_quantity": 1,
        "fee_currency": "CRO",
        "order_id": "367107623521528450"
      }
    ]
  }
}

Gets all executed trades for a particular instrument.

If paging is used, enumerate each page (starting with 0) until an empty trade_list array appears in the response.

Users should use user.trade to keep track of real-time trades, and private/get-trades should primarily be used for recovery; typically when the websocket is disconnected.

Request Params

Name Type Required Description
instrument_name string N e.g. ETH_CRO, BTC_USDT. Omit for 'all'
start_ts long N Start timestamp (milliseconds since the Unix epoch) - defaults to 24 hours ago
end_ts long N End timestamp (milliseconds since the Unix epoch) - defaults to 'now'
page_size int N Page size (Default: 20, max: 200)
page int N Page number (0-based)

Note: If you omit all parameters, you still need to pass in an empty params block like params: {} for API request consistency

Maximum Duration

The maximum duration between start_ts and end_ts is 24 hours.

You will receive an INVALID_DATE_RANGE error if the difference exceeds the maximum duration.

For users looking to pull longer historical trade data, users can create a loop to make a request for each 24-period from the desired start to end time.

Applies To

REST Websocket (User API)

REST Method

POST

Response Attributes

An array of trade_list, consisting of:

Name Type Description
side string BUY, SELL
instrument_name string e.g. ETH_CRO, BTC_USDT
fee number Trade fee
trade_id string Trade ID
create_time long Trade creation time
traded_price number Executed trade price
traded_quantity number Executed trade quantity
fee_currency string Currency used for the fees (e.g. CRO)
order_id string Order ID
client_order_id string Client Order ID
liquidity_indicator string TAKER
MAKER

Sub-account API

Please refer to the following links from Exchange API v1 for details:

OTC Trading API

private/otc/get-otc-user

Request Sample

{
  "id": 12,
  "method": "private/otc/get-otc-user",
  "params": {},
  "nonce": 1587846358253
}

Response Sample

{
  "id": 12,
  "method": "private/otc/get-otc-user",
  "code": 0,
  "result": {
    "account_uuid": "00000000-00000000-00000000-00000000",
    "requests_per_minute": 30,
    "max_trade_value_usd": "5000000",
    "min_trade_value_usd": "50000",
    "accept_otc_tc_datetime": 1636512069509
  }
}

Get OTC User.

Request Params

None

Ensure you keep params: {} for API request consistency.

Applies To

REST

REST Method

POST

Response Attributes

Name Type Description
account_uuid string Account uuid
requests_per_minute number Quote requests allowed per minute
max_trade_value_usd string Maximum trade value in USD equivalent
min_trade_value_usd string Minimum trade value in USD equivalent
accept_otc_tc_datetime number Accepted terms and conditions timestamp (milliseconds since the Unix epoch)

private/otc/get-instruments

Request Sample

{
  "id": 12,
  "method": "private/otc/get-instruments",
  "params": {
  },
  "nonce": 1587846358253
}

Response Sample

{
  "id": 12,
  "method": "private/otc/get-instruments",
  "code": 0,
  "result": {
    "instrument_list": [
      {
        "instrument_name": "BTC_USDC",
        "base_currency": "BTC",
        "quote_currency": "USDC",
        "base_currency_decimals": 6,
        "quote_currency_decimals": 2,
        "base_currency_display_decimals": 8,
        "quote_currency_display_decimals": 2,
        "tradable": true,
        "streamable": false
      }
    ]
  }
}

Get tradable OTC instruments.

Request Params

None

Ensure you keep params: {} for API request consistency.

Applies To

REST

REST Method

POST

Response Attributes

An array of instrument_list, consisting of:

Name Type Description
instrument_name string Name of instrument, e.g. BTC_USDT
base_currency string Base currency of instrument, e.g. BTC, ETH
quote_currency string Quote currency of instrument, e.g. USDT, USDC
base_currency_decimals number Base currency decimals of instrument
quote_currency_decimals number Quote currency decimals of instrument
base_currency_display_decimals number Base currency display decimals of instrument
quote_currency_display_decimals number Quote currency display decimals of instrument
tradable boolean true or false
streamable boolean true or false

private/otc/request-quote

Request Sample

{
  "id": 12,
  "method": "private/otc/request-quote",
  "params": {
    "base_currency": "BTC",
    "quote_currency": "USDT",
    "quote_currency_size": "100000",
    "direction": "BUY"
  }
}

Response Sample

{
  "id": 12,
  "method": "private/otc/request-quote",
  "code": 0,
  "result": {
    "quote_id": "2412548678404715041",
    "quote_status": "ACTIVE",
    "quote_direction": "BUY",
    "base_currency": "BTC",
    "quote_currency": "USDT",
    "base_currency_size": null,
    "quote_currency_size": "100000.00",
    "quote_buy": "39708.24",
    "quote_buy_quantity": "2.51836898",
    "quote_buy_value": "100000.00",
    "quote_sell": "39677.18",
    "quote_sell_quantity": "2.52034040",
    "quote_sell_value": "100000.00",
    "quote_time": 1649736353489,
    "quote_expiry_time": 1649736363578
  }
}

Request a quote to buy or sell with either base currency or quote currency.

Request Params

Name Type Required Description
base_currency string Y Base currency, e.g. BTC, ETH
quote_currency string Y Quote currency, e.g. USDT, USDC
base_currency_size string Depends Requested base currency size.
Either use base_currency_size or quote_currency_size not both
quote_currency_size string Depends Requested quote currency size.
Either use base_currency_size or quote_currency_size not both
direction string Y - BUY
- SELL
- TWO-WAY (returns price for both buy and sell)

Applies To

REST

REST Method

POST

Response Attributes

Name Type Description
quote_id string Quote Id (used to accept quote)
quote_status string - ACTIVE
- EXPIRED (due to insufficient funds or below minimum trade value)
quote_direction string BUY or SELL or TWO-WAY
base_currency string Base currency, e.g. BTC, ETH
quote_currency string Quote currency, e.g. USDT, USDC
base_currency_size string (optional) Base currency size requested
quote_currency_size string (optional) Quote currency size requested
quote_buy string (optional) Price to buy base currency with quote currency
quote_buy_quantity string (optional) Size of base currency to buy
quote_buy_value string (optional) Size of quote currency to buy
quote_sell string (optional) Price to sell base currency for quote currency
quote_sell_quantity string (optional) Size of base currency to sell
quote_sell_value string (optional) Size of quote currency to sell
quote_time number Quote requested timestamp (milliseconds since the Unix epoch)
quote_expiry_time number Quote expiry timestamp (milliseconds since the Unix epoch)

private/otc/accept-quote

Request Sample

{
  "id": 12,
  "method": "private/otc/accept-quote",
  "params": {
    "quote_id": "2412548678404715041"
  }
}

Response Sample

{
  "id": 12,
  "method": "private/otc/accept-quote",
  "code": 0,
  "result": {
    "quote_id": "2412548678404715041",
    "quote_status": "FILLED",
    "quote_direction": "BUY",
    "base_currency": "BTC",
    "quote_currency": "USDT",
    "base_currency_size": null,
    "quote_currency_size": "100000.00",
    "quote_buy": "39708.24",
    "quote_sell": null,
    "quote_time": 1649743710146,
    "quote_expiry_time": 1649743720231,
    "trade_direction": "BUY",
    "trade_price": "39708.24",
    "trade_quantity": "2.51836898",
    "trade_value": "100000.00",
    "trade_time": 1649743718963
  }
}

Accept a quote from request quote.

Request Params

Name Type Required Description
quote_id string Y Quote Id from request quote
direction string Depends BUY or SELL if requested quote using TWO-WAY

Applies To

REST

REST Method

POST

Response Attributes

Name Type Description
quote_id string Quote Id
quote_status string - FILLED
- REJECTED
- PENDING (if PENDING does not resolve to FILLED or REJECTED contact support)
quote_direction string BUY or SELL or TWO-WAY
base_currency string Base currency, e.g. BTC, ETH
quote_currency string Quote currency, e.g. USDT, USDC
base_currency_size string (optional) Base currency size requested
quote_currency_size string (optional) Quote currency size requested
quote_buy string (optional) Price to buy base currency with quote currency
quote_sell string (optional) Price to sell base currency for quote currency
quote_time number Quote requested timestamp (milliseconds since the Unix epoch)
quote_expiry_time number Quote expiry timestamp (milliseconds since the Unix epoch)
trade_direction string BUY or SELL
trade_price string Price quote executed at
trade_quantity string Traded quantity
trade_value string Traded value
trade_time number Quote accepted timestamp (milliseconds since the Unix epoch)

private/otc/get-quote-history

Request Sample

{
  "id": 1,
  "method": "private/otc/get-quote-history",
  "params": {
    "start_ts": 1649743718903,
    "end_ts": 1649743718963,
    "page": 0,
    "page_size": 20
  }
}

Response Sample

{
  "id": 1,
  "method": "private/otc/get-quote-history",
  "code": 0,
  "result": {
    "count": 1,
    "quote_list": [
      {
        "quote_id": "2412795526826582752",
        "quote_status": "EXPIRED",
        "quote_direction": "BUY",
        "base_currency": "BTC",
        "quote_currency": "USDT",
        "base_currency_size": null,
        "quote_currency_size": "100000.00",
        "quote_buy": "39708.24",
        "quote_sell": null,
        "quote_time": 1649743710146,
        "quote_expiry_time": 1649743720231,
        "trade_direction": null,
        "trade_price": null,
        "trade_quantity": null,
        "trade_value": null,
        "trade_time": null
      }
    ]
  }
}

Get quote history.

Request Params

Name Type Required Description
base_currency string N Base currency, e.g. BTC, ETH or omit for 'all'
quote_currency string N Quote currency, e.g. USDT, USDC or omit for 'all'
start_ts long N Default is 24 hours ago from current timestamp
end_ts long N Default is current timestamp
page_size int N Page size (Default: 20, Max: 200)
page int N Page number (0-based)

Note: If you omit all parameters, you still need to pass in an empty params block like params: {} for API request consistency

Maximum Duration

The maximum duration between start_ts and end_ts is 7 days.

You will receive an INVALID_DATE_RANGE error if the difference exceeds the maximum duration.

For users looking to pull longer historical quote data, users can create a loop to make a request for each 7-day-period from the desired start to end time.

Applies To

REST

REST Method

POST

Response Attributes

An array of quote_list, consisting of:

Name Type Description
quote_id string Quote Id
quote_status string - ACTIVE
- REJECTED
- EXPIRED
- FILLED
- PENDING (if PENDING does not resolve to FILLED or REJECTED contact support)
quote_direction string BUY or SELL or TWO-WAY
base_currency string Base currency, e.g. BTC, ETH
quote_currency string Quote currency, e.g. USDT, USDC
base_currency_size string (optional) Base currency size requested
quote_currency_size string (optional) Quote currency size requesed
quote_buy string (optional) Price to buy base currency with quote currency
quote_sell string (optional) Price to sell base currency for quote currency
quote_time number Quote requested timestamp (milliseconds since the Unix epoch)
quote_expiry_time number Quote expiry timestamp (milliseconds since the Unix epoch)
trade_direction string (optional) BUY or SELL
trade_price string (optional) Price quote executed at
trade_quantity string (optional) Traded quantity
trade_value string (optional) Traded value
trade_time number (optional) Quote accepted timestamp (milliseconds since the Unix epoch)

private/otc/get-trade-history

Request Sample

{
  "id": 12,
  "method": "private/otc/get-trade-history",
  "params": {
    "start_ts": 1649743718903,
    "end_ts": 1649743718963,
    "page": 0,
    "page_size": 20
  }
}

Response Sample

{
  "id": 12,
  "method": "private/otc/get-trade-history",
  "code": 0,
  "result": {
    "count": 1,
    "trade_list": [
      {
        "quote_id": "2412795526826582752",
        "quote_status": "FILLED",
        "quote_direction": "BUY",
        "base_currency": "BTC",
        "quote_currency": "USDT",
        "base_currency_size": null,
        "quote_currency_size": "100000.00",
        "quote_buy": "39708.24",
        "quote_sell": null,
        "quote_time": 1649743710146,
        "quote_expiry_time": 1649743720231,
        "trade_direction": "BUY",
        "trade_price": "39708.24",
        "trade_quantity": "2.51836898",
        "trade_value": "100000.00",
        "trade_time": 1649743718963
      }
    ]
  }
}

Get trade history.

Request Params

Name Type Required Description
base_currency string N Base currency, e.g. BTC, ETH or omit for 'all'
quote_currency string N Quote currency, e.g. USDT, USDC or omit for 'all'
start_ts long N Default is 24 hours ago from current timestamp
end_ts long N Default is current timestamp
page_size int N Page size (Default: 20, Max: 200)
page int N Page number (0-based)

Note: If you omit all parameters, you still need to pass in an empty params block like params: {} for API request consistency

Maximum Duration

The maximum duration between start_ts and end_ts is 7 days.

You will receive an INVALID_DATE_RANGE error if the difference exceeds the maximum duration.

For users looking to pull longer historical trade data, users can create a loop to make a request for each 7-day-period from the desired start to end time.

Applies To

REST

REST Method

POST

Response Attributes

An array of trade_list, consisting of:

Name Type Description
quote_id string Quote Id
quote_status string - FILLED
- REJECTED
quote_direction string BUY or SELL or TWO-WAY
base_currency string Base currency, e.g. BTC, ETH
quote_currency string Quote currency, e.g. USDT, USDC
base_currency_size string (optional) Base currency size requested
quote_currency_size string (optional) Quote currency size requesed
quote_buy string (optional) Price to buy base currency with quote currency
quote_sell string (optional) Price to sell base currency for quote currency
quote_time number Quote requested timestamp (milliseconds since the Unix epoch)
quote_expiry_time number Quote expiry timestamp (milliseconds since the Unix epoch)
trade_direction string BUY or SELL
trade_price string Price quote executed at
trade_quantity string Traded quantity
trade_value string Traded value
trade_time number Quote accepted timestamp (milliseconds since the Unix epoch)

private/otc/create-order

Request Sample

{
  "id": 12,
  "method": "private/otc/create-order",
  "params": {
    "instrument_name": "BTC_USDT",
    "quantity": "1",
    "price": "20000",
    "side": "BUY"
  }
}

Response Sample

{
  "id": 12,
  "method": "private/otc/create-order",
  "code": 0,
  "result": {
    "client_oid": null,
    "order_id": "3427401068340147456",
    "status": "FILLED",
    "instrument_name": "BTC_USDT",
    "side": "BUY",
    "price": "20000",
    "quantity": "1.00000000",
    "value": "20000.00",
    "create_time": 1679981311630
  }
}

Creates a new BUY or SELL OTC order

  1. Subscribe to otc_book.{instrument_name}
  2. Receive otc_book.{instrument_name} response
  3. Send private/otc/create-order with price obtained from step 2.
  4. If receive PENDING status, keep sending private/otc/get-trade-history till status FILLED or REJECTED

Request Params

Name Type Required Description
instrument_name string Y Instrument, e.g. BTC_USDT, ETH_USDT
quantity string Y Order quantity in base currency
price string Y Price in quote currency
side string Y - BUY
- SELL
client_oid string N (optional) Client order ID (Maximum 36 characters)
settle_later boolean N (optional) (default: false), whether to trade on credit

Applies To

REST

REST Method

POST

Response Attributes

Name Type Description
client_oid string (otional) Client order ID (Maximum 36 characters)
order_id string Order Id
status string - FILLED
- REJECTED
- UNSETTLED (when settle_later=true)
- PENDING
reject_reason string (optional) reason if status is REJECTED
instrument_name string Instrument, e.g. BTC_USDT, ETH_USDT
side string - BUY
- SELL
price string Price in quote currency
quantity string Order quantity in base currency
value string Order value in quote currency
create_time number Order created timestamp (milliseconds since the Unix epoch)

Websocket Heartbeats

Heartbeat Example

{
  "id": 1587523073344,
  "method": "public/heartbeat",
  "code": 0
}

For websocket connections, the system will send a heartbeat message to the client every 30 seconds.

The client must respond back with the public/respond-heartbeat method, using the same matching id, within 5 seconds, or the connection will break.

public/respond-heartbeat

Request Sample

{
  "id": 1587523073344,
  "method": "public/respond-heartbeat"
}

Responds to the server-initiated websocket heartbeat

Request Params

None

Applies To

Websocket (User API) Websocket (Market Data Subscriptions)

Websocket Subscriptions

Introduction

Request Sample

{
  "id": 11,
  "method": "subscribe",
  "params": {
    "channels": ["user.order.ETH_CRO"]
  },
  "nonce": 1587523073344
}

Response Sample (Initial)

{
  "id": 11,
  "code": 0,
  "method": "subscribe"
}

One of the powerful features of a websocket is the ability to subscribe to incremental updates in particular channels.

This section covers the available channels that can be subscribed or unsubscribed for both the Websocket (User API) and Websocket (Market Data Subscriptions)

Market Data Subscriptions include features such as order book depth, all trades and ticker data. Market data information is pushed every 100 milliseconds.

Websocket subscriptions involve two responses:

Important Note

We recommend adding a 1-second sleep after establishing the websocket connection, and before requests are sent.

This will avoid occurrences of rate-limit (`TOO_MANY_REQUESTS`) errors, as the websocket rate limits are pro-rated based on the calendar-second that the websocket connection was opened.
Note

For User API (user.*), after subscribing to a channel, it is recommended to wait for 1-second before sending related requests to avoid missing updates.

Request Params

Name Type Required Description
method string Y subscribe, unsubscribe
channels array of strings Y Channels to be subscribed

Applies To

Websocket (User API)

user.order.{instrument_name}

Request Sample

{
  "id": 11,
  "method": "subscribe",
  "params": {
    "channels": ["user.order.ETH_CRO"]
  },
  "nonce": 1587523073344
}

Response Sample

{
  "method": "subscribe",
  "result": {
    "instrument_name": "ETH_CRO",
    "subscription": "user.order.ETH_CRO",
    "channel": "user.order",
    "data": [
      {
        "status": "ACTIVE",
        "side": "BUY",
        "price": 1,
        "quantity": 1,
        "order_id": "366455245775097673",
        "client_oid": "my_order_0002",
        "create_time": 1588758017375,
        "update_time": 1588758017411,
        "type": "LIMIT",
        "instrument_name": "ETH_CRO",
        "cumulative_quantity": 0,
        "cumulative_value": 0,
        "avg_price": 0,
        "fee_currency": "CRO",
        "time_in_force":"GOOD_TILL_CANCEL"
      }
    ],
    "channel": "user.order.ETH_CRO"
  }
}

For Spot Trading

Publishes all new orders or order updates for the user for a particular instrument (e.g. BTC_USDT).

instrument_name can be omitted to show tickers for all instruments

Requires initial authentication using public/auth (see public/auth for more information).

Applies To

Websocket (User API)

Response Attributes

Name Type Description
instrument_name string e.g. ETH_CRO, BTC_USDT
subscription string user.margin.order.{instrument_name} -- even in the all case
channel string user.order
data array See below

subscription makes it easy to map to the initial subscription

channel and instrument_name simply allow easier access to parameters without needing to parse the subscription

data consists of:

Name Type Description
order_id string Order ID
client_oid string (Optional) Client order ID if included in request. (Maximum 36 characters)
create_time number Order creation time (Unix timestamp)
update_time number Order update time (Unix timestamp)
status string ACTIVE, CANCELED, FILLED, REJECTED or EXPIRED
reason string Reason code (see "Response and Reason Codes") -- only for REJECTED orders
type string LIMIT, MARKET, STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
side string BUY, SELL
instrument_name string e.g. ETH_CRO, BTC_USDT
price number Price specified in the order
quantity number Quantity specified in the order
cumulative_quantity number Cumulative executed quantity (for partially filled orders)
cumulative_value number Cumulative executed value (for partially filled orders)
avg_price number Average filled price. If none is filled, returns 0
fee_currency string Currency used for the fees (e.g. CRO)
time_in_force string - GOOD_TILL_CANCEL
- FILL_OR_KILL
- IMMEDIATE_OR_CANCEL
exec_inst string Empty or POST_ONLY (Limit Orders Only)
trigger_price number Used for trigger-related orders

Note: To detect a 'partial filled' status, look for status as ACTIVE and cumulative_quantity > 0.

user.trade.{instrument_name}

Request Sample

{
  "id": 11,
  "method": "subscribe",
  "params": {
    "channels": ["user.trade.ETH_CRO"]
  },
  "nonce": 1587523073344
}

Response Sample

{
  "method": "subscribe",
  "code": 0,
  "result": {
    "instrument_name": "ETH_CRO",
    "subscription": "user.trade.ETH_CRO",
    "channel": "user.trade",
    "data": [
      {
        "side": "SELL",
        "instrument_name": "ETH_CRO",
        "fee": 0.014,
        "trade_id": "367107655537806900",
        "create_time": "1588777459755",
        "traded_price": 7,
        "traded_quantity": 1,
        "fee_currency": "CRO",
        "order_id": "367107623521528450"
      }
    ],
    "channel": "user.trade.ETH_CRO"
  }
}

For Spot Trading

Publishes all new trades updates related to the user for a particular instrument (e.g. BTC_USDT)

instrument_name can be omitted to show tickers for all instruments

Requires initial authentication using public/auth (see public/auth for more information).

Applies To

Websocket (User API)

Response Attributes

Name Type Description
instrument_name string e.g. ETH_CRO, BTC_USDT
subscription string user.trade.{instrument_name} -- even in the all case
channel string user.trade
data array See below

subscription makes it easy to map to the initial subscription

channel and instrument_name simply allow easier access to parameters without needing to parse the subscription

data consists of:

Name Type Description
side string BUY, SELL
fee number Trade fee
trade_id string Trade ID
create_time long Trade creation time
traded_price number Executed trade price
traded_quantity number Executed trade quantity
fee_currency string Currency used for the fees (e.g. CRO)
order_id string Order ID

user.balance

Request Sample

{
  "id": 11,
  "method": "subscribe",
  "params": {
    "channels": ["user.balance"]
  },
  "nonce": 1587523073344
}

Response Sample

{
  "method": "subscribe",
  "result": {
    "subscription": "user.balance",
    "channel": "user.balance",
    "data": [
      {
        "currency": "CRO",
        "balance": 99999999947.99626,
        "available": 99999988201.50826,
        "order": 11746.488,
        "stake": 0
      }
    ],
    "channel": "user.balance"
  }
}

For Spot Trading

Publishes all new balance updates for the user. Update frequency is 2s.

Requires initial authentication using public/auth (see public/auth for more information).

Applies To

Websocket (User API)

Response Attributes

Name Type Description
subscription string user.balance
channel string user.balance
data array See below

data consists of:

Name Type Description
currency string e.g. CRO
balance number Total balance
available number Available balance (e.g. not in orders, or locked, etc.)
order number Balance locked in orders
stake number Balance locked for staking (typically only used for CRO)

book.{instrument_name}

Request Sample - Subscription (SNAPSHOT by default)

{
  "id": 1,
  "method": "subscribe",
  "params": {
    "channels": ["book.BTCUSD-PERP"]
  }
}

Response Sample - Subscription (SNAPSHOT)

// Snapshot


{
  "id":-1,
  "code":0,
  "method":"subscribe",
  "result":{
    "channel":"book",
    "subscription":"book.BTCUSD-PERP",
    "instrument_name":"BTCUSD-PERP",
    "depth":50,
    "data":[
      {
        "asks":[
          ["20860.7","0.0495","1"],["20860.8","0.0400","1"],["20860.9","0.0675","1"],["20861.4","0.0006","1"],["20861.7","0.0400","1"],
          ["20861.8","0.0100","2"],["20861.9","0.3000","3"],["20862.1","0.1000","1"],["20862.7","0.0239","1"],["20862.9","0.0958","1"],
          ["20863.0","0.0006","1"],["20863.1","0.0500","1"],["20863.2","0.1100","2"],["20863.3","0.6091","2"],["20863.5","0.1509","2"],
          ["20863.6","0.0600","1"],["20864.2","0.0300","1"],["20864.3","0.1258","2"],["20864.7","0.0908","1"],["20864.8","0.0239","1"],
          ["20865.2","0.1626","1"],["20865.4","0.7543","2"],["20865.7","0.0906","1"],["20866.2","2.2495","1"],["20866.6","0.0906","1"],
          ["20866.8","0.5468","2"],["20867.3","0.1582","1"],["20867.4","0.1582","1"],["20867.5","0.1000","1"],["20867.6","0.2488","2"],
          ["20867.7","0.3164","2"],["20867.9","0.0239","1"],["20868.0","0.0931","1"],["20868.5","0.0850","1"],["20869.0","0.2547","1"],
          ["20869.1","0.0850","1"],["20869.6","0.1582","1"],["20869.7","0.3164","2"],["20869.9","0.0100","1"],["20870.0","0.0855","1"],
          ["20870.1","0.0958","1"],["20870.5","0.3094","3"],["20870.6","0.1917","1"],["20870.8","0.1582","1"],["20871.0","0.0300","1"],
          ["20871.1","0.4693","2"],["20871.5","0.1198","1"],["20872.1","0.0855","1"],["20872.2","0.1198","1"],["20872.6","0.0850","1"]
        ],
        "bids":[
          ["20860.1","0.0400","1"],["20860.0","0.0855","2"],["20859.7","0.0100","2"],["20859.6","0.2000","2"],["20859.5","0.0100","1"],
          ["20859.4","0.1000","1"],["20859.3","0.0600","1"],["20859.0","0.1000","1"],["20858.9","0.1666","1"],["20858.8","0.0506","2"],
          ["20858.7","0.0300","1"],["20858.6","0.0300","1"],["20858.2","0.0958","1"],["20858.1","1.1982","2"],["20857.4","0.0958","1"],
          ["20855.9","0.0006","1"],["20855.6","0.0239","1"],["20855.4","0.0909","1"],["20855.2","0.0895","1"],["20855.0","0.0300","1"],
          ["20854.5","0.2790","3"],["20854.4","0.5419","2"],["20854.2","0.1583","1"],["20854.1","2.1673","1"],["20853.8","0.1668","2"],
          ["20853.7","0.1788","2"],["20853.6","0.2158","1"],["20853.5","0.1583","1"],["20853.4","0.3166","2"],["20853.2","0.2098","2"],
          ["20853.0","0.2099","2"],["20852.9","0.0958","1"],["20852.3","0.0881","1"],["20852.2","0.0958","1"],["20852.0","0.0900","1"],
          ["20851.9","0.0006","1"],["20851.8","0.3772","2"],["20851.5","0.1762","2"],["20851.3","0.2860","2"],["20851.2","0.0840","1"],
          ["20850.9","0.0902","1"],["20850.7","0.0876","1"],["20850.6","0.1198","1"],["20850.2","0.1662","1"],["20850.1","0.0844","1"],
          ["20850.0","0.3324","2"],["20849.9","0.0006","1"],["20849.3","0.2506","2"],["20849.0","1.0000","1"],["20848.7","0.1662","1"]
        ],
        "t":1667800910315,
        "tt":1667800910310,
        "u":957056256576,
        "cs":-240057483
      }
    ]
  }
}

Orderbook / L2 streaming at millisecond frequency.

Channel Parameters

Name Description
instrument_name Must be formal symbol
e.g. BTCUSD-PERP, BTC_USDT

Response Fields

Name Type Description
instrument_name string Same as requested instrument_name
subscription string Same as requested channel
channel string book
depth string Default 50
data array See below

In book broadcasts, data consists of:

Name Type Description
bids array Array of level
asks array Array of level
tt integer Epoch millis of last book update
t integer Epoch millis of message publish
u integer Update sequence, See below
cs integer Internal use only

level is an array:

Index Type Description
0 string Price of the level
1 string Total size of the level
2 string Number of standing orders in the level

Upon successful subscription, continuous book snapshot dataframe will be sent. And book will be broadcasted periodically, regardless whether there were any updates.

Each full snapshot comes with a u field that is unique (per instrument per websocket session) & incremental.

ticker.{instrument_name}

Request Sample

{
  "id": 1,
  "method": "subscribe",
  "params": {
    "channels": ["ticker.BTCUSD-PERP"]
  },
  "nonce": 1587523073344
}

Response Sample

{
  "id": -1,
  "method": "subscribe",
  "code": 0,
  "result": {
    "channel": "ticker",
    "subscription": "ticker.BTCUSD-PERP",
    "data": [{
      "h": "51790.00",        // Price of the 24h highest trade
      "l": "47895.50",        // Price of the 24h lowest trade, null if there weren't any trades
      "a": "51174.500000",    // The price of the latest trade, null if there weren't any trades
      "i": "BTCUSD-PERP",     // Instrument name
      "v": "879.5024",        // The total 24h traded volume
      "vv": "26370000.12",    // The total 24h traded volume value (in USD)
      "oi": "12345.12",       // Open interest
      "c": "0.03955106",      // 24-hour price change, null if there weren't any trades
      "b": "51170.000000",    // The current best bid price, null if there aren't any bids
      "bs": "51170.000000",   // The current best bid size, null if there aren't any bids
      "k": "51180.000000",    // The current best ask price, null if there aren't any asks
      "ks": "51180.000000",   // The current best ask size, null if there aren't any asks
      "t": 1613580710768
    }],
    "instrument_name": "BTCUSD-PERP"
  }
}

Publishes new tickers for an instrument (e.g. BTCUSD-PERP).

Applies To

Websocket (Market Data Subscriptions)

Response Attributes

Name Type Description
instrument_name string e.g. BTCUSD-PERP
subscription string ticker.{instrument_name}
channel string Always ticker
data array See below

subscription makes it easy to map to the initial subscription

channel and instrument_name simply allow easier access to parameters without needing to parse the subscription

data consists of:

Name Type Description
h string Price of the 24h highest trade
l string Price of the 24h lowest trade, null if there weren't any trades
a string The price of the latest trade, null if there weren't any trades
i string Instrument name
v string The total 24h traded volume
vv string The total 24h traded volume value (in USD)
oi string The open interest
c string 24-hour price change, null if there weren't any trades
b string The current best bid price, null if there aren't any bids
bs string The current best bid size, null if there aren't any bids
k string The current best ask price, null if there aren't any asks
ks string The current best ask size, null if there aren't any asks
t number Trade timestamp

trade.{instrument_name}

Request Sample

{
  "id": 1,
  "method": "subscribe",
  "params": {
    "channels": ["trade.BTCUSD-PERP"]
  }
}

Response Sample

{
  "id": 1,
  "method": "subscribe",
  "code": 0,
  "result": {
    "channel": "trade",
    "subscription": "trade.BTCUSD-PERP",
    "data": [{
      "s": "SELL",           // Side
      "p": "51327.500000",   // Price
      "q": "0.000100",       // Quantity
      "t": 1613581138462,    // Trade time
      "d" : "2030407068",    // Trade ID
      "i": "BTCUSD-PERP"     // Instrument name
    }],
    "instrument_name": "BTCUSD-PERP"
  }
}

Publishes new trades for an instrument (e.g. BTCUSD-PERP).

Applies To

Websocket (Market Data Subscriptions)

Response Attributes

Name Type Description
instrument_name string e.g. BTCUSD-PERP
subscription string trade.{instrument_name}
channel string Always trade
data array See below

subscription makes it easy to map to the initial subscription

channel and instrument_name simply allow easier access to parameters without needing to parse the subscription

data consists of:

Name Type Description
s string Side (buy or sell)
p string Trade price
q string Trade quantity
t number Trade timestamp
d string of number Trade ID
i string Instrument name

candlestick.{time_frame}.{instrument_name}

Request Sample

{
  "id": 1,
  "method": "subscribe",
  "params": {
    "channels": ["candlestick.D1.BTCUSD-PERP"]
  }
}

Response Sample

{
  "id": 1,
  "method": "subscribe",
  "code": 0,
  "result": {
    "channel": "candlestick",
    "subscription": "candlestick.1D.BTCUSD-PERP",
    "interval": "1D",
    "data": [{
      "o": "51140.500000",    // Open price
      "h": "51699.000000",    // High price
      "l": "49212.000000",    // Low price
      "c": "51313.500000",    // Close price
      "v": "867.9432",        // Volume
      "t": 1612224000000,     // Start time
      "ut": 1612224000000     // Update time
    }],
    "instrument_name": "BTCUSD-PERP"
  }
}

Publishes candlesticks (k-line data history) over a given period for an instrument (e.g. BTCUSD-PERP).

period can be:

Lagacy format is still supported until further notice.

Applies To

Websocket (Market Data Subscriptions)

Response Attributes

Name Type Description
instrument_name string e.g. BTCUSD-PERP
subscription string candlestick.{time_frame}.{instrument_name}
interval string The period (e.g. M5)
channel string Always candlestick
data array See below

subscription makes it easy to map to the initial subscription

channel and instrument_name simply allow easier access to parameters without needing to parse the subscription

data consists of:

Name Type Description
t long Start time of candlestick (Unix timestamp)
ut long Update time of candlestick (Unix timestamp)
o number Open
h number High
l number Low
c number Close
v number Volume

otc_book.{instrument_name}

Request Sample - Subscription

{
  "id": 1,
  "method": "subscribe",
  "params": {
    "channels": ["otc_book.BTC_USDT"]
  }
}

Response Sample - Subscription

// Snapshot


{
  "id": 1,
  "code": 0,
  "method": "subscribe",
  "result": {
    "channel": "otc_book",
    "subscription": "otc_book.BTC_USDT",
    "instrument_name": "BTC_USDT",
    "t": 1667800910315,
    "data": [
      {
        "asks": [
          ["8944.4", "1", "1", 1672502400000, 1510419685596942874],
          ["8955.1", "3", "1", 1672502400000, 1510419685596942875]
        ],
        "bids": [
          ["8940.5", "1", "1", 1672502400000, 1510419685596942876],
          ["8918.7", "3", "1", 1672502400000, 1510419685596942877]
        ]
      }
    ]
  }
}

Channel Parameters

Name Description
instrument_name Must be formal symbol, e.g. BTC_USDT

Response Fields

Name Type Description
channel string otc_book
subscription string Same as requested channel
instrument_name string Same as requested instrument_name
t number Timestamp of book publish (milliseconds since the Unix epoch)
data array See below

In otc_book broadcasts, data consists of:

Name Type Description
bids array Array of level
asks array Array of level

level is an array:

Index Type Description
0 string Price of the level
1 string Total size of the level
2 string Number of standing orders in the level
3 number Expiry time of the level (milliseconds since the Unix epoch)
4 number Unique ID of the level

Upon successful subscription, continuous otc_book snapshot dataframe will be sent. And otc_book will be broadcasted periodically, latest book will mean previous book is outdated.

Common Issues

TOO_MANY_REQUESTS After Websocket Connects

Websocket rate limits are pro-rated based on the calendar-second that the websocket connection was opened.

This means, depending on the fraction of the calendar-second that the connection was established, the rate limit could be pro-rated to a small number.

By adding a 1-second sleep after establishing the websocket connection, and before requests are sent, this will ensure the rate limit is properly reset and synchronized to your session.

This will avoid occurrences of rate-limit (TOO_MANY_REQUESTS) errors.

INVALID_NONCE On All Requests

The nonce should be the UTC Unix timestamp in milliseconds.

If this has been carefully checked, then the issue occurs when the system clock of the client machine is greater than 1 second in the future, or 30 seconds in the past.

Usually, re-syncing with the NTP time server on the client machine will correct the issue.

If the issue persists, you can try deliberately subtracting 5 seconds from the nonce to force it to be 5 seconds in the past, which is still within the 30-second past tolerance.