Skip to content

Latest commit

 

History

History
5949 lines (5043 loc) · 150 KB

http-trade-v4.md

File metadata and controls

5949 lines (5043 loc) · 150 KB

Private HTTP API V4 for trading


Base URL is https://whitebit.com

Endpoint example: https://whitebit.com/api/v4/{endpoint}

All endpoints return time in Unix-time format.

All endpoints return either a JSON object or array.

For receiving responses from API calls please use http method POST

Error messages V4 format


{
  "code": 0,
  "message": "MESSAGE",
  "errors": {
    "PARAM1": ["MESSAGE"],
    "PARAM2": ["MESSAGE"]
  }
}

Spot

Trading balance

[POST] /api/v4/trade-account/balance

This endpoint retrieves the trade balance by currency ticker or all balances.

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
ticker String No Currency's ticker. Example: BTC

Request BODY raw:

{
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 422 if request validation failed
  • Status 400 if inner validation failed
  • Status 503 if service temporary unavailable
{
    "...": {...},
    "BTC": {
        "available": "0.123",      // Available balance of currency for trading
        "freeze": "1"              // Balance of currency that is currently in active orders
    },
    "...": {...},
    "XMR": {
        "available": "3013",
        "freeze": "100"
    },
    "...": {...}
}
Errors:
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "ticker": ["Ticker field should be a string."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "ticker": ["Currency was not found."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
___

Create limit order

[POST] /api/v4/order/new

This endpoint creates limit trading order.

❗ Rate limit 10000 requests/10 sec.

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'
amount String/Number Yes Amount of stock currency to buy or sell. Example: '0.001' or 0.001
price String/Number Yes Price in money currency. Example: '9800' or 9800
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.
postOnly boolean No Orders are guaranteed to be the maker order when executed. Variables: 'true' / 'false' Example: 'false'.
ioc boolean No An immediate or cancel order (IOC) is an order that attempts to execute all or part immediately and then cancels any unfilled portion of the order. Variables: 'true' / 'false' Example: 'false'.
bboRole Integer No When you activate the BBO option when placing Limit orders, the system automatically selects the best market prices for executing these orders in one of two ways. Variables: 1 - Queue Method / 2 - Counterparty Method. You can use 2 method with ioc flag. Example: 2.

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.01",
  "price": "40000",
  "postOnly": false,
  "ioc": false,
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if request validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom client order id; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "buy",                   // order side
  "type": "limit",                 // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // if order finished - amount in money currency that is finished
  "dealStock": "0",                // if order finished - amount in stock currency that is finished
  "amount": "0.01",                // amount
  "takerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "left": "0.001",                 // if order not finished - rest of the amount that must be finished
  "dealFee": "0",                  // fee in money that you pay if order is finished
  "price": "40000",                // price
  "postOnly": false,               // PostOnly
  "ioc": false                     // IOC
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
  • 32 - amount validation failed
  • 33 - price validation failed
  • 36 - clientOrderId validation failed
  • 37 - ioc and postOnly flags are both true
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field is required."],
    "market": ["Market field is required."],
    "price": ["Price field is required."],
    "side": ["Side field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "side": ["Side field should contain only 'buy' or 'sell' values."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be numeric string or number."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 37,
  "message": "Validation failed",
  "errors": {
    "ioc": ["Either IOC or PostOnly flag in true state is allowed."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "total": ["Total(amount * price) is less than 5.05"]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Min amount step = 0.01" // money/stock precision is not taken into consideration when order was submitted
    ]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be at least 10", "Min price step = 0.000001"]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price should be greater than 0."]
  }
}
{
  "code": 35,
  "message": "Validation failed",
  "errors": {
    "maker_fee": ["Incorrect maker fee"]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}
{
  "code": 13,
  "message": "Inner validation failed",
  "errors": {
    "postOnly": [
      "This order couldn't be executed as a maker order and was canceled."
    ]
  }
}

Bulk limit order

[POST] /api/v4/order/bulk

This endpoint creates bulk limit trading orders.

❗Limit - From 1 to 20 orders by request.

Parameters:

Name Type Mandatory Description
orders Array Yes Array of limit orders

Request BODY raw:

{
  "orders": [
    {
      "side": "buy",
      "amount": "0.02",
      "price": "40000",
      "market": "BTC_USDT",
      "postOnly": false,
      "ioc": false,
      "clientOrderId": ""
    },
    {
      "side": "sell",
      "amount": "0.0001",
      "price": "41000",
      "postOnly": false,
      "market": "BTC_USDT",
      "ioc": false,
      "clientOrderId": ""
    },
    {
      "side": "sell",
      "amount": "0.02",
      "price": "41000",
      "postOnly": false,
      "market": "BTC_USDT",
      "ioc": false,
      "clientOrderId": ""
    }
  ],
  "stopOnFail": true,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if request validation failed
  • Status 503 if service temporary unavailable
[
  {
    "result": {
      "orderId": 4326248250,          // order id
      "clientOrderId": "",            // custom client order id; "clientOrderId": "" - if not specified.
      "market": "BTC_USDT",           // deal market
      "side": "buy",                  // order side
      "type": "limit",                // order type
      "timestamp": 1684916268.825564, // timestamp of order creation
      "dealMoney": "641.988",         // if order finished - amount in money currency that is finished
      "dealStock": "0.02",            // if order finished - amount in stock currency that is finished
      "amount": "0.02",               // amount
      "takerFee": "0.002",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
      "makerFee": "0.02",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
      "left": "0",                    // if order not finished - rest of the amount that must be finished
      "dealFee": "1.283976",          // fee in money that you pay if order is finished
      "ioc": false,                   // IOC
      "postOnly": false,              // PostOnly
      "price": "40000"                // price
    },
    "error": null
  },
  {
    "result": null,
    "error": {
      "code": 32,
      "message": "Validation failed",
      "errors": {
        "amount": ["Given amount is less than min amount 0.001."]
      }
    }
  },
  {
    "result": {
      "orderId": 4326248250,
      "clientOrderId": "",
      "market": "BTC_USDT",
      "side": "sell",
      "type": "limit",
      "timestamp": 1684916268.825564,
      "dealMoney": "641.988",
      "dealStock": "0.02",
      "amount": "0.02",
      "takerFee": "0.002",
      "makerFee": "0.02",
      "left": "0",
      "dealFee": "1.283976",
      "ioc": false,
      "postOnly": false,
      "price": "41000"
    },
    "error": null
  }
]
Errors:

Error codes:

  • 30 - default validation error code
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "orders": ["The orders must be an array."]
  }
}
Errors in multiply response:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
  • 32 - amount validation failed
  • 33 - price validation failed
  • 36 - clientOrderId validation failed
  • 37 - ioc and postOnly flags are both true
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field is required."],
    "market": ["Market field is required."],
    "price": ["Price field is required."],
    "side": ["Side field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "side": ["Side field should contain only 'buy' or 'sell' values."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be numeric string or number."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 37,
  "message": "Validation failed",
  "errors": {
    "ioc": ["Either IOC or PostOnly flag in true state is allowed."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "total": ["Total(amount * price) is less than 5.05"]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Min amount step = 0.01" // money/stock precision is not taken into consideration when order was submitted
    ]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be at least 10", "Min price step = 0.000001"]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price should be greater than 0."]
  }
}
{
  "code": 35,
  "message": "Validation failed",
  "errors": {
    "maker_fee": ["Incorrect maker fee"]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}
{
  "code": 13,
  "message": "Inner validation failed",
  "errors": {
    "postOnly": [
      "This order couldn't be executed as a maker order and was canceled."
    ]
  }
}

Create market order

[POST] /api/v4/order/market

This endpoint creates market trading order.

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'
amount String/Number Yes ⚠️ Amount of money currency to buy or amount in stock currency to sell. Example: '5 USDT' for buy (min total) and '0.001 BTC' for sell (min amount).
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "50", // I want to buy BTC for 50 USDT
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}
{
  "market": "BTC_USDT",
  "side": "sell",
  "amount": "0.01", // I want to sell 0.01 BTC
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if request validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom client order id; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "buy",                   // order side
  "type": "market",                // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // amount in money currency that finished
  "dealStock": "0",                // amount in stock currency that finished
  "amount": "0.001",               // amount
  "takerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - its rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - its rounded to zero
  "left": "0.001",                 // rest of amount that must be finished
  "dealFee": "0"                   // fee in money that you pay if order is finished
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
  • 32 - amount validation failed
  • 36 - clientOrderId validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field is required."],
    "market": ["Market field is required."],
    "side": ["Side field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "side": ["Side field should contain only 'buy' or 'sell' values."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Total amount should be no less than 5.05 + trade fee"]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Min total step = = 0.000001"]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount should be greater than 0."]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}

Create buy stock market order

[POST] /api/v4/order/stock_market

This endpoint creates buy stock market trading order.

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
side String Yes Order type. Available variables: "buy", "sell"
amount String/Number Yes ⚠️ Amount in stock currency for buy or sell. Example: "0.0001" or 0.0001.
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.001", // I want to buy 0.001 BTC
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if request validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom client order id; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "buy",                   // order side
  "type": "stock market",          // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // amount in money currency that finished
  "dealStock": "0",                // amount in stock currency that finished
  "amount": "0.001",               // amount
  "takerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - its rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - its rounded to zero
  "left": "0.001",                 // rest of amount that must be finished
  "dealFee": "0"                   // fee in money that you pay if order is finished
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
  • 32 - amount validation failed
  • 36 - clientOrderId validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field is required."],
    "market": ["Market field is required."],
    "side": ["Side field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "side": ["Side field should contain only 'buy' or 'sell' values."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount should be greater than 0."]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}

Create stop-limit order

[POST] /api/v4/order/stop_limit

This endpoint creates stop-limit trading order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'
amount String/Number Yes Amount of stock currency to buy or sell. Example: '0.001' or 0.001
price String/Number Yes Price in money currency. Example: '9800' or 9800
activation_price String/Number Yes Activation price in money currency. Example: '10000' or 10000
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.001",
  "price": "40000",
  "activation_price": "40000",
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if request validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom client order id; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "buy",                   // order side
  "type": "stop limit",            // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // if order finished - amount in money currency that finished
  "dealStock": "0",                // if order finished - amount in stock currency that finished
  "amount": "0.001",               // amount
  "takerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "left": "0.001",                 // if order not finished - rest of amount that must be finished
  "dealFee": "0",                  // fee in money that you pay if order is finished
  "price": "40000",                // price
  "activation_price": "40000"      // activation price
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
  • 32 - amount validation failed
  • 33 - price validation failed
  • 36 - clientOrderId validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activation_price": ["Activation price field is required."],
    "amount": ["Amount field is required."],
    "market": ["Market field is required."],
    "price": ["Price field is required."],
    "side": ["Side field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "side": ["Side field should contain only 'buy' or 'sell' values."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be numeric string or number."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "total": ["Total(amount * price) is less than 5.05"]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount should be greater than 0."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be at least 10", "Min price step = 0.000001"]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price should be greater than 0."]
  }
}
{
  "code": 35,
  "message": "Validation failed",
  "errors": {
    "maker_fee": ["Incorrect maker fee"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": [
      "Activation price should not be equal to the last price"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activation_price": ["Activation price should be numeric string."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Activation price should be greater than 0."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Empty history"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Min activation price = 10"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Min activation price step = 0.00001"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": [
      "Activation price should not be equal to the last price"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "lastPrice": ["internal error"]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}

Create stop-market order

[POST] /api/v4/order/stop_market

This endpoint creates stop-market trading order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'
amount String/Number Yes ⚠️Amount of money currency to buy or amount in stock currency to sell. Example: '0.01' or 0.01 for buy and '0.0001' for sell.
activation_price String/Number Yes Activation price in money currency. Example: '10000' or 10000
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "50", // I want to buy for 50 USDT
  "activation_price": "40000",
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}
{
  "market": "BTC_USDT",
  "side": "sell",
  "amount": "0.001", // I want to sell 0.01 BTC
  "activation_price": "40000",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if inner validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom order identifier; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "buy",                   // order side
  "type": "stop market",           // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // if order finished - amount in money currency that finished
  "dealStock": "0",                // if order finished - amount in stock currency that finished
  "amount": "0.001",               // amount
  "takerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "left": "0.001",                 // if order not finished - rest of amount that must be finished
  "dealFee": "0",                  // fee in money that you pay if order is finished
  "activation_price": "40000"      // activation price
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
  • 32 - amount validation failed
  • 36 - clientOrderId validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activation_price": ["Activation price field is required."],
    "amount": ["Amount field is required."],
    "market": ["Market field is required."],
    "side": ["Side field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "side": ["Side field should contain only 'buy' or 'sell' values."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount should be greater than 0."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": [
      "Activation price should not be equal to the last price"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activation_price": ["Activation price should be numeric string."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Activation price should be greater than 0."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Empty history"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Min activation price = 10"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Min activation price step = 0.00001"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": [
      "Activation price should not be equal to the last price"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "lastPrice": ["internal error"]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}

Cancel order

[POST] /api/v4/order/cancel

Cancel existing order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
orderId String/Int Yes Order Id. Example: 4180284841 or "4180284841"

Request BODY raw:

{
  "market": "BTC_USDT",
  "orderId": 4180284841,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,          // order id
  "clientOrderId": "customId11",  // custom order identifier; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",           // deal market
  "side": "buy",                  // order side
  "type": "stop market",          // order type
  "timestamp": 1595792396.165973, // timestamp of order creation
  "dealMoney": "0",               // if order finished - amount in money currency that is finished
  "dealStock": "0",               // if order finished - amount in stock currency that is finished
  "amount": "0.001",              // amount
  "takerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "left": "0.001",                // if order not finished - rest of the amount that must be finished
  "dealFee": "0",                 // fee in money that you pay if order is finished
  "price": "40000",               // price if price isset
  "activation_price": "40000"     // activation price if activation price is set
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field is required."],
    "orderId": ["OrderId field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "orderId": ["OrderId field should be an integer."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": [
      "Market field should be a string.",
      "Market field format is invalid."
    ]
  }
}
{
  "code": 2,
  "message": "Inner validation failed",
  "errors": {
    "orderId": ["Unexecuted order was not found."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Cancel all orders

[POST] /api/v4/order/cancel/all

Cancel existing order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String No Available market. Example: BTC_USDT
type Array No Order types value. Example: "spot", "margin", "futures"

Request BODY raw:

{
  "market": "BTC_USDT",
  "type": [
    "Margin",
    "Futures",
    "Spot"
  ]
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
  • Status 503 if service temporary unavailable
[]
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "type": ["The type must be an array."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": [
      "Market field should be a string.",
      "Market field format is invalid."
    ]
  }
}
{
  "code": 2,
  "message": "Inner validation failed",
  "errors": {
    "orderId": ["Unexecuted order was not found."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Query unexecuted(active) orders

[POST] /api/v4/orders

This endpoint retrieves unexecuted orders only.

❗ Rate limit 1000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String No Available market. Example: BTC_USDT
orderId String/Int No Available orderId. Example: 3134995325
clientOrderId String No Available clientOrderId. Example: customId11
limit String/Int No LIMIT is a special clause used to limit records a particular query can return. Default: 50, Min: 1, Max: 100
offset String/Int No If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 10000

Search across all markets is available only if clientOrderId and orderId are not provided.

Request BODY raw:

{
  "market": "BTC_USDT",
  "orderId": "3134995325",       //order Id (optional)
  "clientOrderId": "customId11", // custom order id; (optional)
  "offset": 0,
  "limit": 100,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 422 if request validation failed
  • Status 400 if inner validation failed
  • Status 503 if service temporary unavailable
[
    {
        "orderId": 3686033640,         // unexecuted order ID
        "clientOrderId": "customId11", // custom order id; "clientOrderId": "" - if not specified.
        "market": "BTC_USDT",          // currency market
        "side": "buy",                 // order side
        "type": "limit",               // unexecuted order type
        "timestamp": 1594605801.49815, // timestamp of order creation
        "dealMoney": "0",              // executed amount in money
        "dealStock": "0",              // executed amount in stock
        "amount": "2.241379",          // active order amount
        "takerFee": "0.001",           // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
        "makerFee": "0.001",           // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
        "left": "2.241379",            // unexecuted amount in stock
        "dealFee": "0",                // executed fee by deal
        "price": "40000",              // unexecuted order price
        "oto": {                       // OTO order data - if stopLoss or takeProfit is specified
          "otoId": 29457221,           // ID of the OTO
          "stopLoss": "30000",         // stop loss order price - if stopLoss is specified
          "takeProfit": "50000"        // take profit order price - if takeProfit is specified
      }
    },
    {...}
]
Errors:
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["The market field is required."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should be a string."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field format is invalid."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "message": "Validation failed",
  "code": 31,
  "errors": {
    "market": ["Market is not available"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit must be an integer."],
    "offset": ["The offset must be an integer."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit may not be greater than 100."],
    "offset": ["The offset may not be greater than 10000."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit must be at least 1."],
    "offset": ["The offset must be at least 0."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Query executed order history

[POST] /api/v4/trade-account/executed-history

This endpoint retrieves the deals history. Can be sorted by single market if needed.

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String No Requested market. Example: BTC_USDT
clientOrderId String No Requested clientOrderId. Example: customId11
limit String/Int No LIMIT is a special clause used to limit records a particular query can return. Default: 50, Min: 1, Max: 100
offset String/Int No If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 10000

Request BODY raw:

{
  "clientOrderId": "customId11", // custom order id; (optional)
  "offset": 0,
  "limit": 100,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 422 if request validation failed
  • Status 400 if inner validation failed
  • Status 503 if service temporary unavailable
{
    "BTC_USDT": [
        {
            "id": 160305483,               // deal ID
            "clientOrderId": "customId11", // custom order id; "clientOrderId": "" - if not specified.
            "time": 1594667731.724403,     // Timestamp of the executed deal
            "side": "sell",                // Deal side "sell" / "buy"
            "role": 2,                     // Role - 1 - maker, 2 - taker
            "amount": "0.000076",          // amount in stock
            "price": "9264.21",            // price
            "deal": "0.70407996",          // amount in money
            "fee": "0.00070407996"         // paid fee
        },
        {...}
    ],
    "DTBC_DUSDT": [...]
}

Errors:
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["Limit field should be an integer."],
    "offset": ["Offset field should be an integer."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field format is invalid."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should be a string."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["Limit should not be greater than 100."],
    "offset": ["Offset should not be greater than 10000."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["Limit should be at least 1."],
    "offset": ["Offset should be at least 0."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Query executed order deals

[POST] /api/v4/trade-account/order

This endpoint retrieves deals history details on pending or executed order.

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
orderId String/Int Yes Order ID. Example: 1234
limit String/Int No LIMIT is a special clause used to limit records a particular query can return. Default: 50, Min: 1, Max: 100
offset String/Int No If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 1000

Request BODY raw:

{
  "orderId": 3135554375,
  "offset": 0,
  "limit": 100,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 422 if request validation failed
  • Status 400 if inner validation failed
  • Status 503 if service temporary unavailable
{
  "records": [
    {
      "time": 1593342324.613711,     // Timestamp of executed order
      "fee": "0.00000419198",        // fee that you pay
      "price": "0.00000701",         // price
      "amount": "598",               // amount in stock
      "id": 149156519,               // deal id
      "dealOrderId": 3134995325,     // completed order Id
      "clientOrderId": "customId11", // custom order id; "clientOrderId": "" - if not specified.
      "role": 2,                     // Role - 1 - maker, 2 - taker
      "deal": "0.00419198"           // amount in money
    }
  ],
  "offset": 0,
  "limit": 100
}
Errors:
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "orderId": ["Order was not found."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "orderId": ["OrderId field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "orderId": ["OrderId field should be an integer."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["Limit should not be greater than 100."],
    "offset": ["Offset should not be greater than 10000."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["Limit should be at least 1."],
    "offset": ["Offset should be at least 0."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Query executed orders

[POST] /api/v4/trade-account/order/history

This endpoint retrieves executed order history by market.

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String/Int No Requested available market. Example: BTC_USDT
orderId String/Int No Requested available orderId. Example: 3134995325
clientOrderId String No Requested available clientOrderId. Example: clientOrderId
limit String/Int No LIMIT is a special clause used to limit records a particular query can return. Default: 50, Min: 1, Max: 100
offset String/Int No If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 10000
status String No Possible values: "all", "filled", "canceled"

Request BODY raw:

{
  "market": "BTC_USDT",             //optional
  "orderId": "3134995325",          //order Id (optional)
  "clientOrderId": "clientOrderId", // custom order id; (optional)
  "offset": 0,
  "limit": 100,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 422 if request validation failed
  • Status 400 if inner validation failed
  • Status 503 if service temporary unavailable

Empty response if order is not yours

{
    "BTC_USDT": [
        {
            "amount": "0.0009",            // amount of trade
            "price": "40000",              // price
            "type": "limit",               // order type
            "id": 4986126152,              // order id
            "clientOrderId": "customId11", // custom order identifier; "clientOrderId": "" - if not specified.
            "side": "sell",                // order side
            "ctime": 1597486960.311311,    // timestamp of order creation
            "takerFee": "0.001",           // maker fee ratio. If the number less than 0.0001 - its rounded to zero
            "ftime": 1597486960.311332,    // executed order timestamp
            "makerFee": "0.001",           // maker fee ratio. If the number less than 0.0001 - its rounded to zero
            "dealFee": "0.041258268",      // paid fee if order is finished
            "dealStock": "0.0009",         // amount in stock currency that finished
            "dealMoney": "41.258268",      // amount in money currency that finished
            "postOnly": false,             // PostOnly flag
            "ioc": false,                  // IOC flag
            "status": "canceled"           // Order status: either "filled" or "canceled"
        },
        {...}
    ]
}

Errors:
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["Limit field should be an integer."],
    "offset": ["Offset field should be an integer."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field format is invalid."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should be a string."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["Limit should not be greater than 100."],
    "offset": ["Offset should not be greater than 10000."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["Limit should be at least 1."],
    "offset": ["Offset should be at least 0."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Modify order

[POST] /api/v4/order/modify

This endpoint modify existing order

Supported order types: limit, stop limit, stop market, stop limit

Request must contain one of the following parameters: amount, price, activationPrice

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
orderId Integer Yes Active order id order. Example: 834506
market String Yes Available market. Example: BTC_USDT
amount String/Number No Amount of stock currency to buy or sell. Example: '0.001' or 0.001
total String/Number No Total of money currency to buy or sell. Example: '0.001' or 0.001
price String/Number No Price in money currency. Example: '9800' or 9800
activationPrice String/Number No Activation price in money currency. Example: '10000' or 10000
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.

❗ Use total parameter instead of amount for modify buy stop market order

Request BODY raw:

{
  "orderId": 2590468842,
  "market": "BTC_USDT",
  "price": "38635",
  "activationPrice": "123456",
  "amount": "2",
  "clientOrderId": "1a2s3f4g5h6v",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
  • Status 503 if service temporary unavailable
[
  {
    "orderId": 2590468939,
    "clientOrderId": "1clientOrderId1",
    "market": "BTC_USDT",
    "side": "buy",
    "type": "limit",
    "timestamp": 1706023985.307382,
    "dealMoney": "0",
    "dealStock": "0",
    "amount": "0.001",
    "takerFee": "0",
    "makerFee": "0",
    "left": "0.001",
    "dealFee": "0",
    "ioc": false,
    "price": "38635",
    "postOnly": false
  }
]
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": [
      "Market field should be a string.",
      "Market field format is invalid."
    ]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be numeric string or number."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 37,
  "message": "Validation failed",
  "errors": {
    "ioc": ["Either IOC or PostOnly flag in true state is allowed."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "total": ["Total(amount * price) is less than 5.05"]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Min amount step = 0.01" // money/stock precision is not taken into consideration when order was submitted
    ]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be at least 10", "Min price step = 0.000001"]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price should be greater than 0."]
  }
}
{
  "code": 35,
  "message": "Validation failed",
  "errors": {
    "maker_fee": ["Incorrect maker fee"]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}

Collateral

Collateral Account Balance

[POST] /api/v4/collateral-account/balance

This endpoint returns a current collateral balance

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

Parameters

Name Type Mandatory Description
ticker String No Asset to be filtered. For example: BTC

Request BODY raw:

{
  "ticker": "BTC",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if inner validation failed
  • Status 503 if service temporary unavailable
{
  "BTC": 1,
  "USDT": 1000
}
Errors:
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "ticker": [
      "ticker is invalid."
    ]
  }
}

Collateral Account Balance Summary

[POST] /api/v4/collateral-account/balance-summary

This endpoint returns a current collateral balance summary

Parameters

Name Type Mandatory Description
ticker String No Filter by requested asset. For example: BTC

Request BODY raw:

{
  "ticker": "BTC",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if inner validation failed
  • Status 503 if service temporary unavailable
[
  {
    "asset": "BTC",
    "balance": "0",
    "borrow": "0",
    "availableWithoutBorrow": "0",
    "availableWithBorrow": "123.456"
  }
]
Errors:
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "ticker": [
      "ticker is invalid."
    ]
  }
}

Collateral Limit Order

[POST] /api/v4/order/collateral/limit

This endpoint creates limit order using collateral balance

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available margin market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'. For open long position you have to use buy, for short sell. Also to close current position you have to place opposite order with current position amount.
amount String Yes ⚠️Amount of stock currency to buy or sell.
price String Yes Price in money currency. Example: '9800'
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.
stopLoss String No Stop loss price, if exist create OTO with stop loss
takeProfit String No Take profit price, if exist create OTO with take profit
postOnly boolean No Orders are guaranteed to be the maker order when executed. Variables: true / false Example: false.
ioc boolean No An immediate or cancel order (IOC) is an order that attempts to execute all or part immediately and then cancels any unfilled portion of the order. Variables: 'true' / 'false' Example: 'false'.
bboRole Integer No When you activate the BBO option when placing Limit orders, the system automatically selects the best market prices for executing these orders in one of two ways. Variables: 1 - Queue Method / 2 - Counterparty Method. You can use 2 method with ioc flag. Example: 1.

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.01",
  "price": "40000",
  "postOnly": false,
  "ioc": false,
  "clientOrderId": "order1987111",
  "stopLoss": "50000",
  "takeProfit": "30000",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if inner validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom client order id; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "buy",                   // order side
  "type": "limit",                 // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // if order finished - amount in money currency that is finished
  "dealStock": "0",                // if order finished - amount in stock currency that is finished
  "amount": "0.01",                // amount
  "takerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "left": "0.001",                 // if order not finished - rest of the amount that must be finished
  "dealFee": "0",                  // fee in money that you pay if order is finished
  "price": "40000",                // price
  "postOnly": false,               // PostOnly
  "ioc": false,                    // IOC
  "oto": {                         // OTO order data - if stopLoss or takeProfit is specified
    "otoId": 29457221,             // ID of the OTO
    "stopLoss": "30000",           // stop loss order price - if stopLoss is specified
    "takeProfit": "50000"          // take profit order price - if takeProfit is specified
  }
}
Errors:

Error codes:

  • 31 - market is disabled for trading
  • 32 - incorrect amount (it is less than or equals zero or its precision is too big)
  • 33 - incorrect price (it is less than or equals zero or its precision is too big)
  • 36 - incorrect clientOrderId (invalid string or not unique id)
  • 37 - ioc and postOnly flags are both true

Detailed information about errors response you can find in Create limit order


Collateral Market Order

[POST] /api/v4/order/collateral/market

This endpoint creates market trading order.

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available margin market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'. For open long position you have to use buy, for short sell. Also to close current position you have to place opposite order with current position amount.
amount String Yes ⚠️Amount of stock currency to buy or sell.
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.
stopLoss String No Stop loss price, if exist create OTO with stop loss
takeProfit String No Take profit price, if exist create OTO with take profit

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.01", // I want to buy 0.01 BTC
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}
{
  "market": "BTC_USDT",
  "side": "sell",
  "amount": "0.01", // I want to sell 0.01 BTC
  "clientOrderId": "order1987111",
  "stopLoss": "50000",
  "takeProfit": "40000",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if internal validation failed
  • Status 503 if service is temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom client order id; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "sell",                  // order side
  "type": "market",                // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // amount in money currency that finished
  "dealStock": "0",                // amount in stock currency that finished
  "amount": "0.001",               // amount
  "takerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - its rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - its rounded to zero
  "left": "0.001",                 // rest of amount that must be finished
  "dealFee": "0",                  // fee in money that you pay if order is finished
  "oto": {                         // OTO order data - if stopLoss or takeProfit is specified
    "otoId": 29457221,             // ID of the OTO
    "stopLoss": "50000",           // stop loss order price - if stopLoss is specified
    "takeProfit": "40000"          // take profit order price - if takeProfit is specified
  }
}
Errors:

Error codes:

  • 31 - market is disabled for trading
  • 32 - incorrect amount (it is less than or equals zero or its precision is too big)
  • 33 - incorrect price (it is less than or equals zero or its precision is too big)
  • 36 - incorrect clientOrderId (invalid string or not unique id)

Detailed information about errors response you can find in Create market order



Collateral Stop-Limit Order

[POST] /api/v4/order/collateral/stop-limit

This endpoint creates collateral stop-limit trading order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'
amount String/Number Yes Amount of stock currency to buy or sell. Example: '0.001' or 0.001
price String/Number Yes Price in money currency. Example: '9800' or 9800
activation_price String/Number Yes Activation price in money currency. Example: '10000' or 10000
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.
stopLoss String/Number No Stop loss price, if exist create OTO with stop loss
takeProfit String/Number No Take profit price, if exist create OTO with take profit

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.001",
  "price": "40000",
  "activation_price": "40000",
  "stopLoss": "30000",
  "takeProfit": "50000",
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if request validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom client order id; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "buy",                   // order side
  "type": "stop limit",            // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // if order finished - amount in money currency that finished
  "dealStock": "0",                // if order finished - amount in stock currency that finished
  "amount": "0.001",               // amount
  "takerFee": "0.001",             // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "left": "0.001",                 // if order not finished - rest of amount that must be finished
  "dealFee": "0",                  // fee in money that you pay if order is finished
  "price": "40000",                // price
  "activation_price": "40000",     // activation price
  "oto": {                         // OTO order data - if stopLoss or takeProfit is specified
    "otoId": 29457221,             // ID of the OTO
    "stopLoss": "30000",           // stop loss order price - if stopLoss is specified
    "takeProfit": "50000"          // take profit order price - if takeProfit is specified
  }
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
  • 32 - amount validation failed
  • 33 - price validation failed
  • 36 - clientOrderId validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activation_price": ["Activation price field is required."],
    "amount": ["Amount field is required."],
    "market": ["Market field is required."],
    "price": ["Price field is required."],
    "side": ["Side field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "side": ["Side field should contain only 'buy' or 'sell' values."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be numeric string or number."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "total": ["Total(amount * price) is less than 5.05"]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount should be greater than 0."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be at least 10", "Min price step = 0.000001"]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price should be greater than 0."]
  }
}
{
  "code": 35,
  "message": "Validation failed",
  "errors": {
    "maker_fee": ["Incorrect maker fee"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": [
      "Activation price should not be equal to the last price"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activation_price": ["Activation price should be numeric string."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Activation price should be greater than 0."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Empty history"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Min activation price = 10"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Min activation price step = 0.00001"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": [
      "Activation price should not be equal to the last price"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "lastPrice": ["internal error"]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}

Collateral Trigger Market Order

[POST] /api/v4/order/collateral/trigger-market

This endpoint creates margin trigger market order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available margin market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'. For open long position you have to use buy, for short sell. Also to close current position you have to place opposite order with current position amount.
amount String Yes ⚠️Amount of stock currency to buy or sell.
activation_price String Yes Activation price in money currency. Example: '10000'
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.
stopLoss String No Stop loss price, if exist create OTO with stop loss
takeProfit String No Take profit price, if exist create OTO with take profit

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.01", // I want to buy 0.01 BTC
  "activation_price": "40000",
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}
{
  "market": "BTC_USDT",
  "side": "sell",
  "amount": "0.01", // I want to sell 0.01 BTC
  "activation_price": "40000",
  "stopLoss": "50000",
  "takeProfit": "30000",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if inner validation failed
  • Status 503 if service temporary unavailable
{
  "orderId": 4180284841,           // order id
  "clientOrderId": "order1987111", // custom order identifier; "clientOrderId": "" - if not specified.
  "market": "BTC_USDT",            // deal market
  "side": "sell",                  // order side
  "type": "stop market",           // order type
  "timestamp": 1595792396.165973,  // timestamp of order creation
  "dealMoney": "0",                // if order finished - amount in money currency that finished
  "dealStock": "0",                // if order finished - amount in stock currency that finished
  "amount": "0.001",               // amount
  "takerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "makerFee": "0.001",             // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
  "left": "0.001",                 // if order not finished - rest of amount that must be finished
  "dealFee": "0",                  // fee in money that you pay if order is finished
  "activation_price": "40000",     // activation price
  "oto": {                         // OTO order data - if stopLoss or takeProfit is specified
    "otoId": 29457221,             // ID of the OTO
    "stopLoss": "50000",           // stop loss order price - if stopLoss is specified
    "takeProfit": "30000"          // take profit order price - if takeProfit is specified
  }
}
Errors:

Error codes:

  • 31 - market is disabled for trading
  • 32 - incorrect amount (it is less than or equals zero or its precision is too big)
  • 33 - incorrect price (it is less than or equals zero or its precision is too big)
  • 36 - incorrect clientOrderId (invalid string or not unique id)

Collateral Account Summary

[POST] /api/v4/collateral-account/summary

This endpoint retrieves summary of collateral account

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

Request BODY raw:

{
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 503 if service temporary unavailable
{
  "equity": "130970.8947456254113367",              // total equity of collateral balance including lending funds in USDT
  "margin": "456.58349",                            // amount of funds in open position USDT
  "freeMargin": "129681.3285348840110099",          // free funds for trading according to
  "unrealizedFunding": "0.0292207414003268",        // funding that will be paid on next position stage change (order, liquidation, etc)
  "pnl": "-832.9535",                               // curren profit and loss in USDT
  "leverage": 10,                                   // current leverage of account which affect amount of lending funds
  "marginFraction": "6.2446758120916304",           // margin fraction
  "maintenanceMarginFraction": "1.2446758120916304" // maintenance margin fraction
}

Open Positions

[POST] /api/v4/collateral-account/positions/open

This endpoint returns all open positions

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String No Requested market. Example: BTC_USDT

Request BODY raw:

{
  "market": "BTC_USDT",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if inner validation failed
  • Status 503 if service temporary unavailable
[
  {
    "positionId": 527,                        // position ID
    "market": "BTC_USDT",                     // market name
    "openDate": 1651568067.789679,            // date of position opening
    "modifyDate": 1651568067.789679,          // date of position modifying (this is date of current event)
    "amount": "0.1",                          // amount of order
    "basePrice": "45658.349",                 // base price of position
    "liquidationPrice": null,                 // liquidation price according to current state of position
    "liquidationState": null,                 // state of liquidation. Possible values: null, margin_call, liquidation
    "pnl": "-168.42",                         // current profit and loss in **money**
    "pnlPercent": "-0.43",                    // current profit and loss in percentage
    "margin": "8316.74",                      // amount of funds in open position **money**
    "freeMargin": "619385.67",                // free funds for trading according to
    "funding": "0",                           // funding that will be paid on next position stage change (order, liquidation, etc)
    "unrealizedFunding": "0.0019142920201966" // funding that will be paid on next position stage change (order, liquidation, etc)
  },
  ...
]
  • NOTE: In case of position opening using trigger or limit order you can get situation when basePrice, liquidationPrice, amount, pnl, pnlPercent returns with null value. It happens when funds are lending, and you start to pay funding fee, but position is not completely opened, cos activation price hadn't been triggered yet.

Positions History

[POST] /api/v4/collateral-account/positions/history

This endpoint returns past positions history. Each position represented by position states. Each of them means event that shows current position changes such order, position close, liquidation, etc.

If your request has a "positionId" field, you receive data only with this "positionId". If your request has a "market" field, you receive data only by this "market".

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

"positionId" field has higher priority then "market" field.

Parameters:

Name Type Mandatory Description
market String No Requested market. Example: BTC_USDT
positionId Int No Requested position
startDate Int No Start date in Unix-time format
endDate Int No End date in Unix-time format
limit Int No LIMIT is a special clause used to limit records a particular query can return. Default: 50, Min: 1, Max: 100
offset Int No If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 10000

Request BODY raw:

{
  "market": "BTC_USDT", //optional
  "positionId": 1, //optional
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if inner validation failed
  • Status 503 if service temporary unavailable
[

  {
      "positionId": 111,               // position ID
      "market": "BTC_USDT",            // position market
      "openDate": 1650400589.882613,   // date of position opening
      "modifyDate": 1650400589.882613, // date of position modifying (this is date of current event)
      "amount": "0.1",                 // amount of order
      "basePrice": "45658.349",        // base price of position
      "realizedFunding": "0",          // funding fee for whole position lifetime till current state
      "liquidationPrice": null,        // liquidation price according to current state of position
      "liquidationState": null,        // state of liquidation. Possible values: null, margin_call, liquidation
      "orderDetail": {                 // details of order which changes position
        "id": 97067934,                // order ID
        "tradeAmount": "0.1",          // trade amount of order
        "basePrice": "41507.59",       // order's base price
        "tradeFee": "415.07",          // order's trade fee
        "fundingFee": null,            // funding fee which was captured by this position change (order)
        "realizedPnl": null            // realized pnl
      }
    },
    ...
]

Change Collateral Account Leverage

[POST] /api/v4/collateral-account/leverage

This endpoint changes the current leverage of account.

Please note: Leverages of 50x and 100x are applicable only for futures trading. When applied to margin trading, the maximum leverage applied will be 20x. The leverage value is applied to the entire account, so if you choose a new leverage value below 50x, it will be applied to both margin and futures trading. Additionally, we would like to draw your attention to the fact that calculations for futures positions with 50x and 100x leverage are done considering brackets (see endpoint futures). You can familiarize yourself with the bracket mechanics for 50x and 100x leverage on the Trading Rules page.

❗ Rate limit 12000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
leverage Int Yes New collateral account leverage value. Acceptable values: 1, 2, 3, 5, 10, 20, 50, 100

Request BODY raw:

{
  "leverage": 5,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 422 if inner validation failed
  • Status 503 if service temporary unavailable
{
  "leverage": 5 // current collateral balance leverage
}

Query unexecuted(active) conditional orders

[POST] /api/v4/conditional-orders

This endpoint retrieves unexecuted conditional orders only.

❗ Rate limit 1000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
limit String/Int No LIMIT is a special clause used to limit records a particular query can return. Default: 50, Min: 1, Max: 100
offset String/Int No If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 10000

Request BODY raw:

{
  "market": "BTC_USDT",
  "offset": 0,
  "limit": 100,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 422 if request validation failed
  • Status 400 if inner validation failed
  • Status 503 if service temporary unavailable
{
  "limit": 100,
  "offset": 0,
  "total": 2,
  "records": [
    {
      "id": 117703764513,               // conditional order id
      "type": "oco",
      "stop_loss": {
        "orderId": 117703764514,        // unexecuted order ID
        "clientOrderId": "",            // custom order id; "clientOrderId": "" - if not specified.
        "market": "BTC_USDT",           // currency market
        "side": "buy",                  // order side
        "type": "stop limit",           // unexecuted order type
        "timestamp": 1594605801.49815,  // timestamp of order creation
        "dealMoney": "0",               // executed amount in money
        "dealStock": "0",               // executed amount in stock
        "amount": "2.241379",           // active order amount
        "takerFee": "0.001",            // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
        "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
        "left": "2.241379",             // unexecuted amount in stock
        "dealFee": "0",                 // executed fee by deal
        "post_only": false,             // orders are guaranteed to be the maker order when executed.
        "mtime": 1662478154.941582,     // timestamp of order modification
        "price": "19928.79",            // unexecuted order price
        "activation_price": "29928.79", // activation price
        "activation_condition": "gte",  // activation condition
        "activated": 0                  // activation status
      },
      "take_profit": {
        "orderId": 117703764515,        // unexecuted order ID
        "clientOrderId": "",            // custom order id; "clientOrderId": "" - if not specified.
        "market": "BTC_USDT",           // currency market
        "side": "buy",                  // order side
        "type": "limit",                // unexecuted order type
        "timestamp": 1662478154.941582, // timestamp of order creation
        "dealMoney": "0",               // executed amount in money
        "dealStock": "0",               // executed amount in stock
        "amount": "0.635709",           // active order amount
        "takerFee": "0.001",            // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
        "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
        "left": "0.635709",             // unexecuted amount in stock
        "dealFee": "0",                 // executed fee by deal
        "post_only": false,             // orders are guaranteed to be the maker order when executed.
        "mtime": 1662478154.941582,     // timestamp of order modification
        "price": "9928.79"              // unexecuted order price
      }
    },
    {
      "id": 29457221,                    // ID of the conditional
      "type": "oto",                     // type of the conditional
      "stopLossPrice": "30000",          // stop loss order price - if stopLoss is specified
      "takeProfitPrice": "50000",        // take profit order price - if takeProfit is specified
      "conditionalOrder":                // OTO order data - if stopLoss or takeProfit is specified
        {
          "orderId": 3686033640,         // unexecuted order ID
          "clientOrderId": "customId11", // custom order id; "clientOrderId": "" - if not specified.
          "market": "BTC_USDT",          // currency market
          "side": "buy",                 // order side
          "type": "limit",               // unexecuted order type
          "timestamp": 1594605801.49815, // timestamp of order creation
          "dealMoney": "0",              // executed amount in money
          "dealStock": "0",              // executed amount in stock
          "amount": "2.241379",          // active order amount
          "takerFee": "0.001",           // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
          "makerFee": "0.001",           // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
          "left": "2.241379",            // unexecuted amount in stock
          "dealFee": "0",                // executed fee by deal
          "price": "40000"               // unexecuted order price
        }
    },
    {
      ...
    }
  ]
}
Errors:
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["The market field is required."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should be a string."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field format is invalid."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "message": "Validation failed",
  "code": 31,
  "errors": {
    "market": ["Market is not available"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit must be an integer."],
    "offset": ["The offset must be an integer."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit may not be greater than 100."],
    "offset": ["The offset may not be greater than 10000."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit must be at least 1."],
    "offset": ["The offset must be at least 0."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Query unexecuted(active) OCO orders

[POST] /api/v4/oco-orders

This endpoint retrieves unexecuted oco orders only.

❗ Deprecated - use GET /api/v4/conditional-orders instead. ❗ Rate limit 1000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
limit String/Int No LIMIT is a special clause used to limit records a particular query can return. Default: 50, Min: 1, Max: 100
offset String/Int No If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 10000

Request BODY raw:

{
  "market": "BTC_USDT",
  "offset": 0,
  "limit": 100,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 422 if request validation failed
  • Status 400 if inner validation failed
  • Status 503 if service temporary unavailable
[
  {
    "id": 117703764513,               // oco order id
    "stop_loss": {
      "orderId": 117703764514,        // unexecuted order ID
      "clientOrderId": "",            // custom order id; "clientOrderId": "" - if not specified.
      "market": "BTC_USDT",           // currency market
      "side": "buy",                  // order side
      "type": "stop limit",           // unexecuted order type
      "timestamp": 1594605801.49815,  // timestamp of order creation
      "dealMoney": "0",               // executed amount in money
      "dealStock": "0",               // executed amount in stock
      "amount": "2.241379",           // active order amount
      "takerFee": "0.001",            // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
      "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
      "left": "2.241379",             // unexecuted amount in stock
      "dealFee": "0",                 // executed fee by deal
      "post_only": false,             // orders are guaranteed to be the maker order when executed.
      "mtime": 1662478154.941582,     // timestamp of order modification
      "price": "19928.79",            // unexecuted order price
      "activation_price": "29928.79", // activation price
      "activation_condition": "gte",  // activation condition
      "activated": 0                  // activation status
    },
    "take_profit": {
      "orderId": 117703764515,        // unexecuted order ID
      "clientOrderId": "",            // custom order id; "clientOrderId": "" - if not specified.
      "market": "BTC_USDT",           // currency market
      "side": "buy",                  // order side
      "type": "limit",                // unexecuted order type
      "timestamp": 1662478154.941582, // timestamp of order creation
      "dealMoney": "0",               // executed amount in money
      "dealStock": "0",               // executed amount in stock
      "amount": "0.635709",           // active order amount
      "takerFee": "0.001",            // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
      "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
      "left": "0.635709",             // unexecuted amount in stock
      "dealFee": "0",                 // executed fee by deal
      "post_only": false,             // orders are guaranteed to be the maker order when executed.
      "mtime": 1662478154.941582,     // timestamp of order modification
      "price": "9928.79"              // unexecuted order price
    }
  },
    {...}
]
Errors:
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["The market field is required."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should be a string."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field format is invalid."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "message": "Validation failed",
  "code": 31,
  "errors": {
    "market": ["Market is not available"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit must be an integer."],
    "offset": ["The offset must be an integer."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit may not be greater than 100."],
    "offset": ["The offset may not be greater than 10000."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "limit": ["The limit must be at least 1."],
    "offset": ["The offset must be at least 0."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Create collateral OCO order

[POST] /api/v4/order/collateral/oco

This endpoint creates collateral trading OCO order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
side String Yes Order type. Variables: 'buy' / 'sell' Example: 'buy'
amount String/Number Yes Amount of stock currency to buy or sell. Example: '0.001' or 0.001
price String/Number Yes Price in money currency for limit order. Example: '9800' or 9800
activation_price String/Number Yes Activation price in money currency. Example: '10000' or 10000
stop_limit_price String/Number Yes Price in money currency for stop limit order. Example: '10100' or 10100
clientOrderId String No Identifier should be unique and contain letters, dashes or numbers only. The identifier must be unique for the next 24 hours.

Request BODY raw:

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.001",
  "price": "40000",
  "activation_price": "41000",
  "stop_limit_price": "42000",
  "clientOrderId": "order1987111",
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response: Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if request validation failed
  • Status 503 if service temporary unavailable
{
  "id": 117703764513,               // oco order id
  "stop_loss": {
    "orderId": 117703764514,        // unexecuted order ID
    "clientOrderId": "",            // custom order id; "clientOrderId": "" - if not specified.
    "market": "BTC_USDT",           // currency market
    "side": "buy",                  // order side
    "type": "stop limit",           // unexecuted order type
    "timestamp": 1594605801.49815,  // timestamp of order creation
    "dealMoney": "0",               // executed amount in money
    "dealStock": "0",               // executed amount in stock
    "amount": "2.241379",           // active order amount
    "takerFee": "0.001",            // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
    "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
    "left": "2.241379",             // unexecuted amount in stock
    "dealFee": "0",                 // executed fee by deal
    "post_only": false,             // orders are guaranteed to be the maker order when executed.
    "mtime": 1662478154.941582,     // timestamp of order modification
    "price": "19928.79",            // unexecuted order price
    "activation_price": "29928.79", // activation price
    "activation_condition": "gte",  // activation condition
    "activated": 0                  // activation status
  },
  "take_profit": {
    "orderId": 117703764515,        // unexecuted order ID
    "clientOrderId": "",            // custom order id; "clientOrderId": "" - if not specified.
    "market": "BTC_USDT",           // currency market
    "side": "buy",                  // order side
    "type": "limit",                // unexecuted order type
    "timestamp": 1662478154.941582, // timestamp of order creation
    "dealMoney": "0",               // executed amount in money
    "dealStock": "0",               // executed amount in stock
    "amount": "0.635709",           // active order amount
    "takerFee": "0.001",            // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
    "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
    "left": "0.635709",             // unexecuted amount in stock
    "dealFee": "0",                 // executed fee by deal
    "post_only": false,             // orders are guaranteed to be the maker order when executed.
    "mtime": 1662478154.941582,     // timestamp of order modification
    "price": "9928.79"              // unexecuted order price
  }
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
  • 32 - amount validation failed
  • 33 - price validation failed
  • 36 - clientOrderId validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activation_price": ["Activation price field is required."],
    "amount": ["Amount field is required."],
    "market": ["Market field is required."],
    "price": ["Price field is required."],
    "side": ["Side field is required."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "side": ["Side field should contain only 'buy' or 'sell' values."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount field should be numeric string or number."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be numeric string or number."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "stop_limit_price": [
      "Stop_limit_price field should be numeric string or number."
    ]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field should not be empty string."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": [
      "Given amount is less than min amount 0.001",
      "Min amount step = 0.000001"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "total": ["Total(amount * price) is less than 5.05"]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": ["ClientOrderId field should be a string."]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "ClientOrderId field field should contain only latin letters, numbers and dashes."
    ]
  }
}
{
  "code": 36,
  "message": "Validation failed",
  "errors": {
    "clientOrderId": [
      "This client order id is already used by the current account. It will become available in 24 hours (86400 seconds)."
    ]
  }
}
{
  "code": 32,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount should be greater than 0."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price field should be at least 10", "Min price step = 0.000001"]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "stop_limit_price": [
      "Stop_limit_price field should be at least 10",
      "Min price step = 0.000001"
    ]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "price": ["Price should be greater than 0."]
  }
}
{
  "code": 33,
  "message": "Validation failed",
  "errors": {
    "stop_limit_price": ["Stop_limit_price should be greater than 0."]
  }
}
{
  "code": 35,
  "message": "Validation failed",
  "errors": {
    "maker_fee": ["Incorrect maker fee"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": [
      "Activation price should not be equal to the last price"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activation_price": ["Activation price should be numeric string."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Activation price should be greater than 0."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Empty history"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Min activation price = 10"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": ["Min activation price step = 0.00001"]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "activationPrice": [
      "Activation price should not be equal to the last price"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "lastPrice": ["internal error"]
  }
}
{
  "code": 10,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Not enough balance."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}
{
  "code": 11,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Amount too small."]
  }
}
{
  "code": 16,
  "message": "Inner validation failed",
  "errors": {
    "error": ["Please try again later."]
  }
}
{
  "code": 15,
  "message": "Inner validation failed",
  "errors": {
    "error": ["Please try again later."]
  }
}
{
  "code": 14,
  "message": "Inner validation failed",
  "errors": {
    "postOnly": [
      "This order couldn't be executed as a maker order and was canceled."
    ]
  }
}
{
  "code": 153,
  "message": "Inner validation failed",
  "errors": {
    "price": ["Not enough balance for limit order."]
  }
}
{
  "code": 150,
  "message": "Inner validation failed",
  "errors": {
    "price": ["Can't place limit order."]
  }
}
{
  "code": 151,
  "message": "Inner validation failed",
  "errors": {
    "activation_price": ["Wrong activation price for stop loss."]
  }
}
{
  "code": 152,
  "message": "Inner validation failed",
  "errors": {
    "price": ["Not enough balance for stop limit order."]
  }
}

Cancel OCO order

[POST] /api/v4/order/oco-cancel

Cancel existing order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
orderId String/Int Yes OCO order Id. Example: 4180284841 or "4180284841"

Request BODY raw:

{
  "market": "BTC_USDT",
  "orderId": 117703764514,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
  • Status 503 if service temporary unavailable
{
  "id": 117703764513,               // oco order id
  "stop_loss": {
    "orderId": 117703764514,        // unexecuted order ID
    "clientOrderId": "",            // custom order id; "clientOrderId": "" - if not specified.
    "market": "BTC_USDT",           // currency market
    "side": "buy",                  // order side
    "type": "stop limit",           // unexecuted order type
    "timestamp": 1594605801.49815,  // timestamp of order creation
    "dealMoney": "0",               // executed amount in money
    "dealStock": "0",               // executed amount in stock
    "amount": "2.241379",           // active order amount
    "takerFee": "0.001",            // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
    "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
    "left": "2.241379",             // unexecuted amount in stock
    "dealFee": "0",                 // executed fee by deal
    "post_only": false,             // orders are guaranteed to be the maker order when executed.
    "mtime": 1662478154.941582,     // timestamp of order modification
    "price": "19928.79",            // unexecuted order price
    "activation_price": "29928.79", // activation price
    "activation_condition": "gte",  // activation condition
    "activated": 0                  // activation status
  },
  "take_profit": {
    "orderId": 117703764515,        // unexecuted order ID
    "clientOrderId": "",            // custom order id; "clientOrderId": "" - if not specified.
    "market": "BTC_USDT",           // currency market
    "side": "buy",                  // order side
    "type": "limit",                // unexecuted order type
    "timestamp": 1662478154.941582, // timestamp of order creation
    "dealMoney": "0",               // executed amount in money
    "dealStock": "0",               // executed amount in stock
    "amount": "0.635709",           // active order amount
    "takerFee": "0.001",            // taker fee ratio. If the number less than 0.0001 - it will be rounded to zero
    "makerFee": "0.001",            // maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
    "left": "0.635709",             // unexecuted amount in stock
    "dealFee": "0",                 // executed fee by deal
    "post_only": false,             // orders are guaranteed to be the maker order when executed.
    "mtime": 1662478154.941582,     // timestamp of order modification
    "price": "9928.79"              // unexecuted order price
  }
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field is required."],
    "orderId": ["OrderId field is required."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "orderId": ["OrderId field should be an integer."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": [
      "Market field should be a string.",
      "Market field format is invalid."
    ]
  }
}
{
  "code": 2,
  "message": "Inner validation failed",
  "errors": {
    "orderId": ["Unexecuted order was not found."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Cancel conditional order

[POST] /api/v4/order/conditional-cancel

Cancel existing order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
id String/Int Yes conditional Id. Example: 4180284841 or "4180284841"

Request BODY raw:

{
  "market": "BTC_USDT",
  "id": 117703764514,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
  • Status 503 if service temporary unavailable
[]
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field is required."],
    "orderId": ["Id field is required."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "orderId": ["Id field should be an integer."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": [
      "Market field should be a string.",
      "Market field format is invalid."
    ]
  }
}
{
  "code": 2,
  "message": "Inner validation failed",
  "errors": {
    "orderId": ["Unexecuted order was not found."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Cancel OTO order

[POST] /api/v4/order/oto-cancel

Cancel existing order

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
otoId String/Int Yes OTO Id. Example: 4180284841 or "4180284841"

Request BODY raw:

{
  "market": "BTC_USDT",
  "otoId": 117703764514,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
  • Status 503 if service temporary unavailable
[]
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field is required."],
    "orderId": ["OtoId field is required."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "orderId": ["OtoId field should be an integer."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": [
      "Market field should be a string.",
      "Market field format is invalid."
    ]
  }
}
{
  "code": 2,
  "message": "Inner validation failed",
  "errors": {
    "orderId": ["Unexecuted order was not found."]
  }
}
{
  "code": 1,
  "message": "Inner validation failed",
  "errors": {
    "amount": ["Invalid argument."]
  }
}

Sync kill-switch timer

[POST] /api/v4/order/kill-switch

This endpoint creates, updates, deletes kill-switch timer

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String Yes Available market. Example: BTC_USDT
timeout String Yes Timer value. Example: "5"-"600" or null
types Array No Order types value. Example: "spot", "margin", "futures" or null

If timer=null - delete existing timer by market. If types=null - create timer by market for all order types.

Request BODY raw:

{
  "market": "BTC_USDT",
  "timeout": "5",
  "types": ["spot", "margin"],
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
{
  "market": "BTC_USDT", // currency market,
  "startTime": 1662478154, // now timestamp,
  "cancellationTime": 1662478154, // now + timer_value,
  "types": ["spot", "margin"]
}
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": ["Market field is required."],
    "timeout": ["Timeout field is required."]
  }
}
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "timeout": ["Timeout field should be a string."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": [
      "Market field should be a string.",
      "Market field format is invalid."
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "timeout": ["Timeout should be at least 5."]
  }
}

Status kill-switch timer

[POST] /api/v4/order/kill-switch/status

This endpoint retrieves the status of kill-switch timer

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
market String No Available market. Example: BTC_USDT

Request BODY raw:

{
  "market": "BTC_USDT", // optional
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
[
  {
    "market": "BTC_USDT",
    "startTime": 1686127243,
    "cancellationTime": 1686127343,
    "types": ["spot", "margin"]
  }
]
Errors:

Error codes:

  • 30 - default validation error code
  • 31 - market validation failed
{
  "code": 31,
  "message": "Validation failed",
  "errors": {
    "market": ["Market is not available."]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "market": [
      "Market field should be a string.",
      "Market field format is invalid."
    ]
  }
}

Convert

Convert Estimate

[POST] /api/v4/convert/estimate

This endpoint creates a quote for converting one currency to another. Quote lifetime is 10 seconds, then quote will be expired.

❗ Rate limit 10000 requests/10 sec.

Parameters:

Name Type Mandatory Description
from String Yes From currency. Example: BTC
to String Yes To currency. Example: USDT
direction String Yes Convert amount direction, defines in which currency corresponding "amount" field is populated. Use "to" in case amount is in "to" currency, use "from" if amount is in "from" currency (see use case samples below)
amount String Yes Amount to convert or receive.

Request BODY raw:

Example of 'I would like to estimate convert of BTC to receive 35,103.1 USDT':

{
  "amount": "35,103.1",
  "direction": "to", // enum('from', 'to')
  "from": "BTC",
  "to": "USDT",
  "nonce": "{{nonce}}",
  "request": "{{request}}"
}

Example of 'I would like to estimate convert of 1 BTC to USDT':

{
  "amount": "1",
  "direction": "from", // enum('from', 'to')
  "from": "BTC",
  "to": "USDT",
  "nonce": "{{nonce}}",
  "request": "{{request}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
{
  "id": "123",
  "from": "BTC",
  "to": "USDT",
  "give": "50",
  "receive": "1714988.41577452",
  "rate": "34299.76831549",
  "expireAt": 1699016476
}
Errors:
{
  "code": 0,
  "message": "Validation failed",
  "errors": {
    "user": [
      "Terms of exchange are not accepted"
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "direction": [
      "Direction field does not exist in [from,to]."
    ]
  }
}
{
    "code": 0,
    "message": "Validation failed",
    "errors": {
        "from": [
            "Conversion markets not available"
        ]
    }
}

Convert Confirm

[POST] /api/v4/convert/confirm

This endpoint confirms an estimated quote.

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
quoteId String Yes Quote ID

Request BODY raw:

{
  "quoteId": 4050,
  "nonce": "{{nonce}}",
  "request": "{{request}}"
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
{
  "finalGive": "0.00002901",
  "finalReceive": "1"
}
Errors:
{
  "code": 0,
  "message": "Validation failed",
  "errors": {
    "quoteId": [
      "Quote could not be found"
    ]
  }
}

Convert History

[POST] /api/v4/convert/history

This endpoint returns convert history.

❗ Rate limit 10000 requests/10 sec.

Response is cached for: NONE

Parameters:

Name Type Mandatory Description
fromTicker String No From currency. Example: BTC
toTicker String No To currency. Example: USDT
from String No From time filter. Example: 1699260637
to String No To time filter. Example: 1699260637
quoteId String No Quote Id. Example: 4050
limit String No How many records to receive. Default: 100
offset String No Amount to convert or receive. Default 0

Request BODY raw:

{
  "fromTicker": "BTC",
  "nonce": "{{nonce}}",
  "request": "{{request}}",
}

Response:

Available statuses:

  • Status 200
  • Status 400 if inner validation failed
  • Status 422 if validation failed
{
  "records": [
    {
      "id": "4030",
      "date": 1699020642,
      "give": "0.00002901",
      "receive": "1",
      "rate": "34470.87211306",
      "path": [
        {
          "from": "BTC",
          "to": "USDT",
          "rate": "34470.87211306"
        }
      ]
    }
  ],
  "total": 4,
  "limit": 1,
  "offset": 0
}
Errors:
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "fromTicker": [
      "fromTicker is invalid."
    ]
  }
}
{
  "code": 30,
  "message": "Validation failed",
  "errors": {
    "toTicker": [
      "toTicker is invalid."
    ]
  }
}