REST API

Public methods

Use the following public methods to obtain various exchange data:

GET [base]/frontoffice/api/info

Get the supported instruments

GET [base]/marketdata/instruments/{instrument}/depth

Get an order book snapshot

GET[base]/marketdata/instruments/{instrument}/history

Get data about instrument candles

Note

See also CMC integration.


Get the supported instruments

Use this method to obtain up-to-date information about all markets available on the exchange.

Request

No parameters.

GET[base]/frontoffice/api/info

GET /frontoffice/api/info HTTP/1.1
Host: host.name

Response

baseAsset string

The base asset identifier.

quoteAsset string

The quote asset identifier.

minAmount number

The minimum amount that can be traded on a market.

Orders with a lesser amount are rejected.

priceDeviation number

The allowed price deviation for limit orders placed on a market.

When the requested price deviates too much from the best bid or ask prices, exceeding the limit defined by this parameter, an order is rejected.

This value is normalized to 0–1 range: for example, 0.15 indicates the allowed deviation of 15%.

hidden number

The market availability:

0 — available 1 — hidden (trading is not recommended because a market may be due to be disconnected)

makerFee number

The fee charged for orders placed by market makers providing liquidity to a market.

This value is normalized to 0–1 range: for example, 0.05 indicates a fee of 5%. A maker fee of 5% is considered substantial and may be detrimental to business.

takerFee number

The fee charged for orders placed by market takers diminishing market liquidity.

This value is normalized to 0–1 range: for example, 0.05 indicates a fee of 5%. A taker fee of 5% is considered substantial and may be detrimental to business.

priceScale integer

The maximum number of decimal places allowed for representing asset prices. This value also determines the minimum amount that can be traded on a market.

Typically, the price scale is equal to the scale specified for a quote asset in a pair.

This value cannot exceed the scale of a quote asset and must be within 2–18 range.

amountScale integer

The maximum number of decimal places allowed for representing asset amounts on a market. This value also determines the minimum amount that can be traded on a market.

Typically, the amount scale is equal to the scale specified for a base asset in a pair.

This value cannot exceed the scale of a base asset and must be within 2–18 range.

createdAt string

The date and time when an instrument was created: YYYY-MM-DDThh:mm:ss.

updatedAt string

The date and time when an instrument was last updated: YYYY-MM-DDThh:mm:ss.

status string

The market status:

  • Open — new orders can be placed on a market using the UI or API

  • Halted — new orders cannot be placed on a market using the UI or API

  • Paused — order placement requests made using the UI or API are rejected on a market, while previously placed limit orders still await execution as per their time-in-force settings

side string

The market side. Possible values:

  • BuySell

  • Buy

  • Sell

RESPONSE BODY EXAMPLE
{
  "serverTime": 636880696809972288,
  "pairs": {
    "btc_usdt": {
      "baseAsset": "btc",
      "quoteAsset": "usdt",
      "minAmount": 0.0,
      "priceDeviation": 0.0,
      "hidden": 0,
      "makerFee": 0,
      "takerFee": 0.001,
      "priceScale": 6,
      "amountScale": 6,
      "createdAt": "2019-11-14T16:18:49.253354",
      "updatedAt": "2019-11-14T16:18:49.253354",
      "status": 0,
      "side": "BuySell",
    },
    "eth_usd": {
      "baseAsset": "eth",
      "quoteAsset": "usdt",
      "minAmount": 0.0,
      "priceDeviation": 0.0,
      "hidden": 0,
      "makerFee": 0.0025,
      "takerFee": 0.0028,
      "priceScale": 8,
      "amountScale": 8,
      "createdAt": "2019-11-14T16:18:49.255354",
      "updatedAt": "2019-11-14T16:18:49.255354",
      "status": "Open",
      "side": "BuySell",
    }
  }
}

Get an order book snapshot

Use this method to obtain order book information for a specified currency pair (instrument).

Request

Path parameters:

instrument required

The instrument identifier: {baseAsset}_{quoteAsset}.

GET[base]/marketdata/instruments/{instrument}/depth

GET /marketdata/instruments/eth_btc/depth HTTP/1.1
Host: host.name

Response

instrument string

The instrument identifier specified in a request.

bids array

Each element of the array represents a particular order and contains the string fields amount and price.

asks array

Each element of the array represents a particular order and contains the string fields amount and price.

version number

The current order book snapshot version.

askTotalAmount number

The total amount of all ask (sell) orders.

bidTotalAmount number

The total amount of all bid (buy) orders.

snapshot boolean

A self-contained snapshot (always true for this request).

RESPONSE BODY EXAMPLE
{
  "instrument": "eth_btc",
  "bids": [
    {
      "amount": 0.3092258,
      "price": 0.01734264
    },
    {
      "amount": 51.61494099,
      "price": 0.01734363
    }
  ],
  "asks": [
    {
      "amount": 133.52370356,
      "price": 0.01739337
    },
    {
      "amount": 9.16854518,
      "price": 0.01739838
    }
  ],
  "version": 1891724,
  "askTotalAmount": 1849.11363582,
  "bidTotalAmount": 809.23878372,
  "snapshot": true
}

Get data about instrument candles

Use this method to obtain candlestick data for a specified currency pair (instrument).

Request

Path parameters:

instrument required

The instrument identifier: {baseAsset}_{quoteAsset}.

Query parameters:

startDate required

The date and time indicating the beginning of a required time interval: YYYY-MM-DDThh:mm:ss

endDate required

The date and time indicating the end of a required time interval: YYYY-MM-DDThh:mm:ss

type required

The detail level of the chart data; the following values are supported:

  • 1m1 minute

  • 5m5 minutes

  • 15m15 minutes

  • 30m30 minutes

  • 1h1 hour

  • 12h12 hours

  • 1d1 day

  • 1w1 week

  • 1M1 month

count number

The number of candles to return; the default value is 1000 (which is the maximum supported value).

GET[base]/marketdata/instruments/{instrument}/history

GET /marketdata/instruments/btc_usdt/history?startDate=2019-03-13T09:00:00&endDate=2019-03-13T11:00:00&type=1h&count=2 HTTP/1.1
Host: host.name

Response

instrument string

The same as in the request.

start string

The same as in the request.

end string

The same as in the request.

low number

The lowest trade price.

high number

The highest trade price.

volume number

The total volume of trades.

open number

The opening price.

close number

The closing price.

RESPONSE BODY EXAMPLE
{
  "success": true,
  "instrument": "btc_usdt",
  "data": [
    {
      "instrument": "btc_usdt",
      "start": "2019-03-13T09:00:00Z",
      "end": "2019-03-13T10:00:00Z",
      "low": 3842.855,
      "high": 3855.445,
      "volume": 4.0,
      "open": 3855.105,
      "close": 3842.855
    },
    {
      "instrument": "btc_usdt",
      "start": "2019-03-13T10:00:00Z",
      "end": "2019-03-13T11:00:00Z",
      "low": 3834.355,
      "high": 3848.855,
      "volume": 26.0,
      "open": 3842.865,
      "close": 3835.655
    }
  ],
  "startDateTime": "2019-03-13T09:00:00Z",
  "endDateTime": "2019-03-13T11:00:00Z"
}

Private methods

Use the following private methods to trade on the exchange and obtain the data about user orders, trades and balances:

POST [base]/frontoffice/api/order

Place an order

GET [base]/frontoffice/api/order_history

Get order history

DELETE [base]/frontoffice/api/orders/{id}

Cancel an order

POST [base]/frontoffice/api/stoporders

Create a stop order

GET [base]/frontoffice/api/stoporders

Get stop order history

GET [base]/frontoffice/api/stoporders/{id}

Get stop order details

DELETE [base]/frontoffice/api/stoporders/{id}

Delete a stop order

GET [base]/frontoffice/api/trade_history

Get trade history

GET [base]/frontoffice/api/balances

Get user balance

GET [base]/frontoffice/api/orders

Get order details

GET [base]/frontoffice/api/orders/my

Get data about the current user’s orders


Place an order

Use this method to place a new market or limit order on the exchange.

Request

The ts and nonce values should be specified for a request.

Body:

instrument string required

The currency pair identifier: {baseAsset}_{quoteAsset}.

type string required

The order side: buy or sell.

amount number required

The order amount (must be greater than 0).

price number

The order price (required for limit orders, optional for market orders); if isLimit is true, this value must be greater than 0; otherwise, it can be equal to 0.

isLimit boolean

Set this value to true to place a limit order; set this value to false to place a market order (see Flags combinations to learn more).

isFok boolean

If true, the order is supposed to be executed instantly in a full amount or cancelled if not filled (see Flags combinations to learn more).

clientOrderId number

The order identifier provided by a client (can be any UUID strings, except for 00000000-0000-0000-0000-000000000000); must be unique among the orders placed on behalf of a particular client, meaning that an order with a clientOrderId identical to the one of an already placed order will not by placed.

POST[base]/frontoffice/api/order

POST /frontoffice/api/order HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...

{
  "ts": "2019-12-12T01:01:01",
  "nonce": 4,
  "order": {
    "instrument": "btc_usdt",
    "type": "sell",
    "amount": 1,
    "price": 1,
    "isLimit": true,
    "isFok": false,
    "clientOrderId": "6fdf688e-00b0-4c68-82dd-3aee5c727ed1"
  }
}
const crypto = require('crypto');
const https = require('https');
const Key = "7fa6ceec-d8fc..."; // Change to your PublicKey
const Secret = "7ae49b5b-99db..."; // Change to your Secret
const Host = "host.name"; // Change to your host name
const Method = '/frontoffice/api/order'
const Payload = new Date().toISOString();
const body = {
  ts: Payload,
  nonce:1,
  order: {
    instrument: 'eth_usd',
    type: 'buy',
    amount: 1,
    price: 1,
    isLimit: true
  }
};
const data = JSON.stringify(body);
const Sign = crypto
  .createHmac('sha512', Secret)
  .update(data)
  .digest('hex')
  .toUpperCase();
const options = {
  hostname: Host,
  path: Method,
  port: Port,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Key,
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
    Sign
  }
};
const req = https.request(options, res => {
  console.log(`statusCode: ${res.statusCode}`);
  res.on('data', d => {
    process.stdout.write(d);
  });
});
req.on('error', e => {
  console.error(e);
});
req.write(data);
req.end();

Response

In case of success, an Order object is returned.


Get order history

Use this method to obtain the history of orders that meet specified criteria or the history of all orders if no parameters are defined in a request.

Request

The ts and nonce values should be specified for a request.

Query parameters:

market

The currency pair for which the orders history should be obtained (for example, btc_usdt).

side

The order side: buy or sell.

status

The current order status: Working, Rejected, Cancelled or Completed.

startDate

The date and time indicating the beginning of a required time interval: YYYY-MM-DDThh:mm:ss.s

endDate

The date and time indicating the end of a required time interval: YYYY-MM-DDThh:mm:ss.s

AscOrder

The field to be used as a criteria for sorting response data in the ascending order; any of the following fields can be specified:

  • TradeSeq

  • TradeTime

  • OrderId

  • Amount

  • Instrument

  • Side

  • ExecutionPrice

  • Commission

DescOrder

The field to be used as a criteria for sorting response data in descending order; for a list of support fields, see the AscOrder parameter description.

isHideCanceled

If true, canceled orders are not returned.

page

The number of a page listing the orders to be returned (when the perPage parameter is defined).

perPage

The number of orders to be listed on a single page

GET[base]/frontoffice/api/order_history

GET /frontoffice/api/order_history?market=btc_usdt&ts=2019-12-12T01:01:01&nonce=4 HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...
const crypto = require('crypto');
const https = require('https');
const Key = "7fa6ceec-d8fc..."; // Change to your PublicKey
const Secret = "7ae49b5b-99db..."; // Change to your Secret
const Host = "host.name"; // Change to your host name
const Payload = new Date().toISOString();
const Method = `/frontoffice/api/order_history?ts=${Payload}&market=btc_usd&nonce=4`;
async function GetOrders() {

    const Sign = crypto
        .createHmac('sha512', Secret)
        .update(`?ts=${Payload}&market=btc_usd&nonce=4`)
        .digest('hex')
        .toUpperCase();
    const options = {
        hostname: Host,
        port: Port,
        path: Method,
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
            Key,
            Sign
        }
    };
    const req = https.request(options, res => {
        console.log(`statusCode: ${res.statusCode}`);
        console.log(`statusMessage: ${res.statusMessage}`);
        res.on('data', d => {
            process.stdout.write(d);
        });
    });
    req.on('error', e => {
        console.error(e);
    });
    req.end();
}

GetOrders().catch(err => {
    console.log(err);
});

Response

In case of success, an array of Order objects meeting the specified criteria is returned.


Cancel an order

Use this method to cancel a specified market or limit order.

Request

The ts and nonce values should be specified for a request.

Path parameters:

id required

The order identifier: either orderId (the one specified in a response to a Place an order request) or clientOrderId (the one specified in the Place an order request).

DELETE[base]/frontoffice/api/orders/{id}

DELETE /frontoffice/api/orders/-72057594037927933&ts=2019-12-12T01:01:01&nonce=4 HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...
const crypto = require('crypto');
const https = require('https');
const Key = "7fa6ceec-d8fc..."; // Change to your PublicKey
const Secret = "7ae49b5b-99db..."; // Change to your Secret
const Host = "host.name"; // Change to your host name
const Payload = new Date().toISOString();
const OrderId = '-72057594037927933';
const Method = `/frontoffice/api/orders?OrderId=${OrderId}&ts=${Payload}&nonce=2`
async function deleteOrder() {
  const Sign = crypto
    .createHmac('sha512', Secret)
    .update(`?OrderId=${OrderId}&ts=${Payload}&nonce=2`)
    .digest('hex')
    .toUpperCase();
  const options = {
    hostname: Host,
    path: Method,
    port: Port,
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
      'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
      Key,
      Sign
    }
  };
  const req = https.request(options, res => {
    console.log(`statusCode: ${res.statusCode}`);
    console.log(`statusMessage: ${res.statusMessage}`);
    res.on('data', d => {
      process.stdout.write(d);
    });
  });
  req.on('error', e => {
    console.error(e);
  });
  req.end();
}
deleteOrder().catch(err => {
  console.log(err);
});

Response

In case of success, an HTTP status code is returned, indicating the request result:

  • 200 — the order has been cancelled

  • 400 — the request has not been processed due to an unexpected error

  • 404 — the order with a specified ID has not been found


Create a stop order

Use this method to place a new stop market or stop limit order on the exchange.

Note

The maximum number of active stop orders that can be placed at a time is 1000.

Request

The ts and nonce values should be specified for a request.

Body:

marketId string required

The currency pair identifier: {baseAsset}_{quoteAsset}.

orderType string required

The order type. Possible values:

  • market

  • limit

side string required

The order side: buy or sell.

requestedPrice number required

For limit orders, the sell or buy price at which the order is placed after a specified stop price (activationPrice) is reached on the market.

This value must be greater than or equal to zero.

The number of decimal places allowed for this value cannot exceed the scale value specified for the currency pair being traded.

activationPrice number required

The stop (trigger) price which the market price must hit for the order to be placed.

This value must be greater than or equal to zero.

The number of decimal places allowed for this value cannot exceed the scale value defined for the instrument being traded.

requestedAmount number required

The order amount.

This value must be greater than zero.

This amount must correspond to the amountScale and minAmount values defined for the instrument being traded.

timeInForce string required

The time-in-force rule applied to an order. Possible values:

For limit orders:

  • gtc (good-‘til-cancelled) — the order must await execution until it is cancelled explicitly or filled

For market orders:

  • ioc (immediate-or-cancel) — the order must be executed instantly, while any portion of an order that cannot be filled at once must be cancelled

  • fok (fill-or-kill) — the order must be filled instantly in its full amount or not executed at all

POST[base]/frontoffice/api/stoporders

POST /frontoffice/api/stoporders HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...

{
  "ts": "2019-12-12T01:01:01",
  "nonce": 4,
  "order": {
    "marketId": "btc_usd",
    "orderType": "limit",
    "side": "buy",
    "requestedPrice": 100,
    "activationPrice": 100,
    "requestedAmount": 1,
    "timeInForce": "gtc"
  }
}

Response

In case of success, a Stop Order object is returned.


Get stop order history

Use this method to obtain the history of stop orders that meet specified criteria, or the history of all stop orders if no parameters are defined in a request.

Request

The ts and nonce values should be specified for a request.

Query parameters:

market

The currency pair for which the orders history should be obtained (for example, btc_usdt).

status

The current order status: WaitingForActivation, Activated or Rejected.

sort

The sorting criteria:

OrderId

The order identifier in the system.

RequestedAmount

The order amount.

RequestedPrice

For limit orders, the sell or buy price at which the order is placed after a specified stop price (activationPrice) is reached on the market.

MarketId

The currency pair identifier: {baseAsset}_{quoteAsset}.

Side

The order side: buy or sell.

GET[base]/frontoffice/api/stoporders

GET /frontoffice/api/stoporders?market=usdt_usd&status=working&sort=-orderid,%2BrequestedPrice&page=1&perPage=10 HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...

Response

In case of success, an array of Stop Order objects meeting the specified criteria is returned.


Get stop order details

Use this method to obtain detailed information about a specified stop order.

Request

The ts and nonce values should be specified for a request.

Query parameters:

id

The stop order identifier in the system.

GET[base]/frontoffice/api/stoporders/{id}

GET /frontoffice/api/stoporders/1 HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...

Response

In case of success, a specified Stop Order object is returned.


Delete a stop order

Use this method to delete a stop order.

Note

Only stop orders with the WaitingForActivation status can be deleted.

Request

The ts and nonce values should be specified for a request.

Query parameters:

id

The stop order identifier in the system.

DELETE[base]/frontoffice/api/stoporders/{id}

DELETE /frontoffice/api/stoporders/1 HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...

Response

In case of success, HTTP code 200 is returned.


Get trade history

Use this method to obtain the history of trades that meet specified criteria or the history of all trades if no parameters are defined in a request.

Request

The ts and nonce values should be specified for a request.

Query parameters:

orderId

The order identifier by which you can get information about all related trades.

market

The currency pair for which the trades history should be obtained (for example, btc_usdt)

side

The trade side: 0 — buy; 1 — sell

startDate

The date and time indicating the beginning of a required time interval: YYYY-MM-DDThh:mm:ss.s

endDate

The date and time indicating the end of a required time interval: YYYY-MM-DDThh:mm:ss.s

AscOrder

The field to be used as a criteria for sorting response data in ascending order; any of the following fields can be specified:

  • TradeSeq

  • TradeTime

  • OrderId

  • Amount

  • Instrument

  • Side

  • ExecutionPrice

  • Commission

DescOrder

The field to be used as a criteria for sorting response data in descending order; for a list of support fields, see the AscOrder parameter description.

page

The number of a page listing the trades to be returned (when the perPage parameter is defined).

perPage

The number of trades to be listed on a single page.

GET[base]/frontoffice/api/trade_history

GET /frontoffice/api/trade_history?market=btc_usdt&ts=2019-12-12T01:01:01&nonce=4 HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...
const crypto = require('crypto');
const https = require('https');
const Key = "7fa6ceec-d8fc..."; // Change to your PublicKey
const Secret = "7ae49b5b-99db..."; // Change to your Secret
const Host = "host.name"; // Change to your host name
const Payload = new Date().toISOString();
const Method = `/frontoffice/api/trade_history?ts=${Payload}&market=btc_usd&startDate=2020-01-12T01:01:01&nonce=5&ascOrder=Side`;
async function GetTrades() {

    const Sign = crypto
        .createHmac('sha512', Secret)
        .update(`?ts=${Payload}&market=btc_usd&startDate=2020-01-12T01:01:01&nonce=5&ascOrder=Side`)
        .digest('hex')
        .toUpperCase();
    const options = {
        hostname: Host,
        port: Port,
        path: Method,
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
            Key,
            Sign
        }
    };
    const req = https.request(options, res => {
        console.log(`statusCode: ${res.statusCode}`);
        console.log(`statusMessage: ${res.statusMessage}`);
        res.on('data', d => {
            process.stdout.write(d);
        });
    });
    req.on('error', e => {
        console.error(e);
    });
    req.end();
}
GetTrades().catch(err => {
    console.log(err);
});

Response

tradeSeq number

The trade sequence number.

tradeTime string

The date and time when a trade was executed.

amount number

The trade amount.

executionPrice number

The trade execution price.

instrument string

The traded currency pair (instrument).

side number

The trade side: 0 — buy; 1 — sell.

commission number

The commission charged for a trade.

orderId number

The identifier of a related order.

RESPONSE BODY EXAMPLE
{
  "filters": {
    "market": "btc_usdt",
    "ascOrder": [
      "Side"
    ]
  },
  "paging": {
    "page": 1,
    "per_page": 15,
    "total": 1
  },
  "data": [
    {
      "tradeSeq": 0,
      "tradeTime": "2019-12-20T06:17:03.093597",
      "amount": 0.00000001,
      "executionPrice": 0.00000001,
      "instrument": "btc_usdt",
      "side": 0,
      "commission": 0.00000000,
      "orderId": -72057593704402280
    },
    {
      "tradeSeq": 3927,
      "tradeTime": "2019-12-20T06:17:03.093597",
      "amount": 0.00000001,
      "executionPrice": 0.00000001,
      "instrument": "btc_usdt",
      "side": 1,
      "commission": 0.00000000,
      "orderId": -72057593704402281
    }
  ]
}

Get user balance

Use this method to obtain up-to-date information about the total and locked amount of each asset on user balances.

Request

The ts and nonce values should be specified for a request.

No parameters.

GET[base]/frontoffice/api/balances

GET /frontoffice/api/balances HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...
const crypto = require('crypto');
const https = require('https');
const Key = "7fa6ceec-d8fc..."; // Change to your PublicKey
const Secret = "7ae49b5b-99db..."; // Change to your Secret
const Host = "host.name"; // Change to your host name
const Payload = new Date().toISOString();
const Method = `/frontoffice/api/balances?ts=${Payload}&nonce=6`;
async function GetBalances() {
  const Sign = crypto
    .createHmac('sha512', Secret)
    .update(`?ts=${Payload}&nonce=6`)
    .digest('hex')
    .toUpperCase();
  const options = {
    hostname: Host,
    port: Port,
    path: Method,
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
      'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
      Key,
      Sign
    }
  };
  const req = https.request(options, res => {
    console.log(`statusCode: ${res.statusCode}`);
    console.log(`statusMessage: ${res.statusMessage}`);
    res.on('data', d => {
      process.stdout.write(d);
    });
  });
  req.on('error', e => {
    console.error(e);
  });
  req.end();
}
GetBalances().catch(err => {
  console.log(err);
});

Response

asset string

The asset name.

balance number

The total asset amount on a user’s balance.

locked number

The locked asset amount on a user’s balance.

RESPONSE BODY EXAMPLE
[
  {
    "asset": "btc",
    "balance": 10.0,
    "locked": 0.0
  },
  {
    "asset": "usdt",
    "balance": 80000.0,
    "locked": 7.0
  }
]

Get order details

Use this method to obtain detailed information about an order that is identified by a specific order ID or client order ID.

Request

The ts and nonce values should be specified for a request.

Query parameters:

orderId required

The order identifier: either orderId (the one specified in a response to a Place an order request) or clientOrderId (the one specified in the Place an order request).

When obtaining an order by its clientOrderId, the currently opened user order is returned.

If there are no opened user orders, the last order with a specified clientOrderId is returned.

GET[base]/frontoffice/api/orders

GET /frontoffice/api/orders?orderId=-72057594037927933
    &ts=2019-12-12T01:01:01
    &nonce=4 HTTP/1.1
Host: host.name

Response

In case of success, an Order object is returned.


Get data about the current user’s orders

Use this method to obtain up-to-date information about orders placed by a currently authorized user.

Request

The ts and nonce values should be specified for a request.

No parameters.

GET[base]/frontoffice/api/orders/my

GET /frontoffice/api/orders/my?ts=2019-12-12T01:01:01&nonce=4 HTTP/1.1
Host: host.name
Key: 7fa6ceec-d8fc...
Sign: 7ae49b5b-99db...

Response

In case of success, an array of Order objects meeting the specified criteria is returned.


CMC integration

Use the following public methods to transfer information about the exchange to CoinMarketCap.

Note that some endpoints are mandatory to establish the integration.

Note

For CMC endpoints, a separate base URL is used — [base2].

GET [base2]/asset

Get data about assets

Recommended

GET [base2]/summary

Get data about a market

Mandatory

GET [base2]/ticker

Get ticker data

Mandatory

GET [base2]/orderbook/{instrument}

Get Order Book data

Mandatory

GET [base2]/trades/{instrument}

Get data about trades

Mandatory


Get data about assets

Use this method to obtain in depth details on crypto currencies available on the exchange.

Request

No parameters.

GET[base2]/asset

GET /asset HTTP/1.1
Host: host.name

Response

name string

The asset name.

can_withdraw string

If true, the asset can be withdrawn.

can_deposit string

If true, the asset can be deposited.

min_withdraw string

The minimum withdrawal/deposit amount.

max_withdraw string

The maximum withdrawal/deposit amount.

RESPONSE BODY EXAMPLE
{
  "BTC": {
    "name": "btc",
    "can_withdraw": true,
    "can_deposit": true,
    "min_withdraw": "0.00000001",
    "max_withdraw": "100000000"
  },
  "USDT": {
    "name": "usdt",
    "can_withdraw": true,
    "can_deposit": true,
    "min_withdraw": "0.00000001",
    "max_withdraw": "100000000"
}

Get data about a market

Use this method to obtain summary information about all tickers and all currency pairs available on the exchange.

Request

No parameters.

GET[base2]/summary

GET /summary HTTP/1.1
Host: host.name

Response

id string

The market identifier.

last string

The price of the most recent trade executed within the last 24 hours; 0 if more than 24 hours have passed since the most recent trade has been executed on this market.

lowestAsk string

The lowest ask (sell) price.

highestBid string

The highest bid (buy) price.

percentChange string

The price change within the last 24 hours, as a percentage.

baseVolume string

The total volume of assets traded within the last 24 hours (converted to a base asset).

quoteVolume string

The total volume of assets traded within the last 24 hours (converted to a quote asset).

isFrozen string

The current market status: 0 — active (orders can be placed and are being processed); 1 — temporarily suspended (orders cannot be placed and are not processed).

high24hr string

The maximum trade price within the last 24 hours.

low24hr string

The minimum trade price within the last 24 hours.

RESPONSE BODY EXAMPLE
{
  "BTC_USDT": {
    "id": "btc_usdt",
    "last": "10978.93578",
    "lowestAsk": "10979.0",
    "highestBid": "10978.71",
    "percentChange": "0.0813730364297798727996051454",
    "baseVolume": "6.47119743",
    "quoteVolume": "70829.9781692126756",
    "isFrozen": "0",
    "high24hr": "10985.0049",
    "low24hr": "10857.95376"
  },
  "BTC_USD": {
    "id": "btc_usd",
    "last": "0",
    "lowestAsk": "0",
    "highestBid": "0",
    "percentChange": "0",
    "baseVolume": "0",
    "quoteVolume": "0",
    "isFrozen": "0",
    "high24hr": "0",
    "low24hr": "0"
  }
}

Get ticker data

Use this method to obtain a 24-hour pricing and volume summary for each currency pair available on the exchange.

Request

No parameters.

GET[base2]/ticker

GET /ticker HTTP/1.1
Host: host.name

Response

base_name string

The base asset name.

quote_name string

The quote asset name.

last_price string

The price of the most recent trade executed within the last 24 hours; 0 if more than 24 hours have passed since the most recent trade has been executed on this market.

base_volume string

The total base asset volume traded within the last 24 hours.

quote_volume string

The total quote asset volume traded within the last 24 hours.

isFrozen string

The current market status: 0 — active (orders can be placed and are being processed); 1 — temporarily suspended (orders cannot be placed and are not processed).

RESPONSE BODY EXAMPLE
{
  "dash_btc": {
    "base_name": "dash",
    "quote_name": "btc",
    "last_price": "0",
    "base_volume": "0",
    "quote_volume": "0",
    "isFrozen": "1"
  },
  "eth_usdt": {
    "base_name": "eth",
    "quote_name": "usdt",
    "last_price": "423.9936",
    "base_volume": "2942.97774",
    "quote_volume": "1273092.080666887",
    "isFrozen": "0"
  }
}

Get Order Book data

Use this method to obtain a complete level 2 Order Book (with entries arranged according to the best asks/bids) with full depth returned for a given currency pair.

Request

Path parameters:

instrument required

The instrument identifier: {baseAsset}_{quoteAsset}.

GET[base2]/orderbook/{instrument}

GET /orderbook/btc_usdt HTTP/1.1
Host: host.name

Response

timestamp string

The date and time of the last update, in the format of the Unix timestamp.

bids array

Each element of the array represents a particular order and contains the string fields amount and price.

asks array

Each element of the array represents a particular order and contains the string fields amount and price.

RESPONSE BODY EXAMPLE
{
  "timestamp": "1585177482652",
  "bids": [
    [
      "12462000",
      "0.04548320"
    ],
    [
      "12457000",
      "3.00000000"
    ]
  ],
  "asks": [
    [
      "12506000",
      "2.73042000"
    ],
    [
      "12508000",
      "0.33660000"
    ]
  ]
}

Get data about trades

Use this method to obtain information about all trades made with a specified currency pair within the last 24 hours.

Request

Path parameters:

instrument required

The instrument identifier: {baseAsset}_{quoteAsset}.

GET[base2]/trades/{instrument}

GET /trades/btc_usd HTTP/1.1
Host: host.name

Response

tradeID string

The trade identifier.

price string

The trade price.

base_volume string

The base asset amount.

quote_volume string

The quote asset amount.

trade_timestamp string

The date and time when a trade has been executed, in the format of the Unix timestamp.

type string

The trade side: buy or sell.

RESPONSE BODY EXAMPLE
[
  {
    "tradeID": "1247307",
    "price": "10093.92246491",
    "base_volume": "0.0259",
    "quote_volume": "261.432591841169",
    "trade_timestamp": "1599577070",
    "type": "buy"
  },
  {
    "tradeID": "1247309",
    "price": "10091.69185435",
    "base_volume": "0.0754",
    "quote_volume": "760.913565817990",
    "trade_timestamp": "1599577128",
    "type": "sell"
  }
]

Reference

In this section, you can find additional information about the exchange REST API:

The Order object

The following data is provided about an order:

orderId string

The order identifier.

total number

The traded order amount, in a quote asset.

orderType integer

The order type:

  • 0 — a GTC limit order

  • 1 — an IOC market order

  • 2 — an FOK market order

  • 3 — a GTD limit order

  • 4 — a DAY limit order

commission number

The commission charged for an order, in a quote asset.

createdAt string

The date and time when an order was created.

unitsFilled number

The filled order amount.

isPending boolean

If true, the order is awaiting execution (it has not been rejected, cancelled or completed).

status string

The order status: Working, Rejected, Cancelled or Completed.

type string

The order side: buy or sell.

amount number

The order amount, must be greater than 0.

remaining number

The remaining order amount awaiting to be filled.

fillFactor number

For partially filled orders, the percentage by which an order is filled so far.

executionPrice number

The order execution price.

requestedPrice number

The requested (ask or bid) price for the order.

isLimit boolean

If true, indicates a limit order; if false, indicates a market order.

instrument string

The order instrument identifier: {baseAsset}_{quoteAsset}.

side integer

The order side: 0 — buy; 1 — sell.

timeInForce integer

The order time-in-force settings. Possible values:

  • 0 — “good-‘til-cancelled” (the order awaits execution until it is cancelled)

  • 1 — “immediate-or-cancel” (the order must be executed instantly, while any portion of it that cannot be filled at once must be cancelled)

  • 2 — “fill-or-kill” (the order must be filled instantly in its full amount or not executed at all)

  • 3 — “good-‘til-date” (unless the order has already been filled or cancelled, it will be removed from the order book after 23:59:59 of a day specified by the cancellationDate parameter, according to the time settings specified for the exchange)

  • 4 — “day” (unless the order has already been filled or cancelled, it will be removed from the order book after 23:59:59 of the current day, according to the time settings specified for the exchange)

cancellationDate string

For “good-‘til-date” orders (timeInForce is set to 3), the date when an order must be cancelled (according to the time settings specified for the exchange).

rejectDetails string

For rejected orders, the reason why an order was rejected.

source integer

The way in which an order was opened:

  • 0 — for orders that are opened by users (including those opened using [base]/frontoffice/api/orders methods)

  • 1 — for stop orders that are placed automatically

THE ORDER OBJECT
{
  "order": {
    "orderId": "-72057594037927934",
    "total": 0.0,
    "orderType": 0,
    "commission": 0.0,
    "createdAt": "2020-06-19T11:21:30.532784Z",
    "unitsFilled": 0.0,
    "isPending": true,
    "status": "working",
    "type": "buy",
    "amount": 1.0,
    "remaining": 1.0,
    "fillFactor": 0.0,
    "executionPrice": 0.0,
    "requestedPrice": 0.0,
    "isLimit": true,
    "instrument": "btc_usdt",
    "side": 0,
    "timeInForce": 4,
    "cancellationDate": "2022-12-21T00:00:00Z",
    "rejectDetails": "",
    "source": 0
  }
}

The Stop Order object

The following data is provided about a stop order:

orderId number

The order identifier in the system.

accountId number

The account identifier of a user who created an order.

orderType string

The order type. Possible values:

  • market

  • limit

timeInForce string

For limit orders:

  • gtc (good-‘til-cancelled) — the order must await execution until it is cancelled explicitly or filled

For market orders:

  • ioc (immediate-or-cancel) — the order must be executed instantly, while any portion of an order that cannot be filled at once must be cancelled

  • fok (fill-or-kill) — the order must be filled instantly in its full amount or not executed at all

side string

The order side: buy or sell.

requestedAmount string

The order amount.

requestedPrice string

For limit orders, the sell or buy price at which the order is placed after a specified stop price (activationPrice) is reached on the market.

activationPrice string

The stop (trigger) price which the market price must hit for the order to be placed.

marketId string

The currency pair identifier: {baseAsset}_{quoteAsset}.

createdAt string

The date and time when an order was created.

updatedAt string

The date and time when an order was last updated.

status string

The current order status. Possible values:

  • WaitingForActivation — the order is created and awaits activation

  • Activated — the order was activated and awaits execution

  • Rejected — the order was rejected

In addition, the stop order data returned for a Get stop order history or Get stop order details request may include the following information:

activatedOrderId string

For stop orders with the Activated status, the identifier of a market or limit order that has been placed upon stop order activation.

activationError string

For stop orders with the Rejected status, the reason why an order was rejected.

THE STOP ORDER OBJECT
{
  "order": {
    "orderId": 2,
    "accountId": 14090,
    "orderType": "Limit",
    "timeInForce": "Gtc",
    "side": "Buy",
    "requestedAmount": "1",
    "requestedPrice": "100",
    "activationPrice": "100",
    "marketId": "btc_usd",
    "createdAt": "2022-10-17T11:20:57.1204992Z",
    "updatedAt": "2022-10-17T11:20:57.1204996Z",
    "status": "WaitingForActivation",
  }
}

Flags combinations

In the following table, you can find information about various combinations of flags corresponding to specific order types:

Order

Description

Flags

Limit

Limit order

isLimit is true

isFok is false

Market (Market IOС)

Market order (Immediate-or-Cancel) — the order must be executed instantly, with any unfilled portion being cancelled

isLimit is false

isFok is false

Market FOK

Market order (Fill-or-Kill) — the order must be executed instantly in the full amount or cancelled

isLimit is false

isFok is true


HTTP status codes

The B2Trader API uses standard HTTP response codes to indicate the success or failure of a request:

Successful responses

200 OK

The request succeeded.

201 Created

The request succeeded, and a new resource was created as a result. Typically, this response is sent after POST requests.

202 Accepted

The request was accepted for processing, but the processing will start later.

204 No Content

The request succeeded, but no response body was returned.

Error responses

400 Bad Request

The request was invalid (for example, malformed or syntactically incorrect). This status code may indicate one of the following issues:

  • The API cannot convert the payload data to the underlying data type.

  • The data is not in the expected data format.

  • Required fields are not available.

  • A data validation error occurred.

401 Unauthorized

The request didn’t include an authentication token or the token has expired.

403 Forbidden

The client didn’t have the permissions to access the requested resource.

404 Not Found

The requested resource wasn’t found because the specified URI was invalid or the requested resource was unavailable (for example, a URI pointed to an empty database).

405 Method Not Allowed

The HTTP method in the request wasn’t supported by the resource.

406 Not Acceptable

The request wasn’t completed because the server doesn’t support the requested response format.

For example, the request contained the Accept: application/xml header, but the API can only generate a response in the application/json format.

413 Payload Too Large

The request payload was too large to be processed by the server.

415 Unsupported Media Type

The request was rejected by the server because it doesn’t support the requested data format.

For example, the request contained the Content-Type: application/xml header, but the API only accepts requests in the application/json format.

429 Too Many Requests

The rate limit set for the user, application or token exceeded a predefined value.

To learn more, see API rate limits.

500 Internal Server Error

The request wasn’t completed due to an internal error on the server side.

503 Service Unavailable

The server is down for maintenance.

For a full list of valid response codes, refer to the IANA HTTP Status Code Registry.