REST Trading API

Authentication


Authentication for the REST API requires the same information as the WS Trading API. Instead of sending some initial message like Logon, each call to the REST Transfers API must contain 4 HTTP headers:

  • X-AUTH-API-KEY

  • X-AUTH-API-PAYLOAD

  • X-AUTH-API-SIGNATURE

  • X-AUTH-API-NONCE


Nonce (UNIX nanoseconds timestamp) must be unique for each request and no older than 60 seconds.

Learn how to get keys for API.


Account list


Returns a list of the accounts available for trading.

Information about the accounts can be obtained through the REST API.


GET /api/trading/accounts/

scope: trading


Response:

{

    "accounts":[

        {

            "id":8263212,

            "kind":"Spot"

        },

        {

            "id":10012833469,

            "kind":"Margin",

            "currency":"BTC"

        }

    ],

}


Response parameters

Field


Type / possible values

Status Message

id

M

number

Account number

kind

M

string

“Spot” and “Margin” types are available

Account type

currency

O

sring

Account currency. Returns for Margin accounts only


Balances (Portfolio)


Returns information about available balance.

Information can be obtained with the REST API.


GET /trading/accounts/<accountId>/balance/

Response Spot:

{

    "balances":[

        {

            "available":"9999.916",

            "onHold":"0",

            "settled":"9999.916",

            "equity":"0",

            "currency":"BAB",

            "lastUpdated":1561984110748520000

        },

        {

            "available":"9999.9055",

            "onHold":"0",

            "settled":"9999.9055",

            "equity":"0",

            "currency":"BSV",

            "lastUpdated":1561984110748520000

        },

        {

            "available":"9989.53669",

            "onHold":"0",

            "settled":"9989.53669",

            "equity":"0",

            "currency":"BTC",

            "lastUpdated":1561984110748520000

        },

        {

            "available":"10000",

            "onHold":"0",

            "settled":"10000",

            "equity":"0",

            "currency":"ETC",

            "lastUpdated":1561984110748520000

        },

        {

            "available":"9999.9312",

            "onHold":"0",

            "settled":"9999.9312",

            "equity":"0",

            "currency":"ETH",

            "lastUpdated":1561984110748520000

        },

        {

            "available":"9998.79",

            "onHold":"0",

            "settled":"9998.79",

            "equity":"0",

            "currency":"LTC",

            "lastUpdated":1561984110748520000

        },

        {

            "available":"9899.86",

            "onHold":"0",

            "settled":"9899.86",

            "equity":"0",

            "currency":"USDT",

            "lastUpdated":1561984110748520000

        },

        {

            "available":"9999.9816",

            "onHold":"0",

            "settled":"9999.9816",

            "equity":"0",

            "currency":"XRP",

            "lastUpdated":1561984110748520000

        }

    ]

}


Response Margin:

{

    "balances":[

        {

            "available":"9668.39889702",

            "onHold":"0.29616358",

            "settled":"9668.6950606",

            "equity":"9668.56764958",

            "currency":"BTC",

            "lastUpdated":1561984273883796489

        }

    ]

}


Response parameters

Field


Type / possible values

Description

balances

M

Array

Contains account balance per currency

available

M

decimal

Available for trading

onHold

M

decimal

On hold

currency

M

string

Currency

settledM

string

Settled balance
equityM

string

Equity


Retrieving trade history


Returns a list of trades. 


GET /trading/accounts/8263118/trade-history?symbol=BTC/USDT&client_order_id=EMBB8Veke&trade_id=220143254


Response:

[

{

"account":8263118,

"clOrdId":"Kw9664m22",

"orderId":"7aa7f445-89be-47ec-b649-e0671e238609",

"symbol":"BTC/USDT",

"ordType":"Limit",

"price":"8000",

"transactTime":1557916859727908000,

"execId":"9aa20f1f-5c73-408d-909d-07f74f04edfd",

"tradeId":"220143240",

"side":"Sell",

"orderQty":"1",

"leavesQty":"0",

"cumQty":"1",

"lastQty":"1",

"lastPx":"8000",

"avgPx":"0",

"calculatedCcyLastQty":"8000",

"netMoney":"8000",

"commission":"0",

"commCurrency":"USDT",

"positionEffect":"UnknownPositionEffect"

},

{

"account":8263118,

"clOrdId":"8yk33JO4b",

"orderId":"fcd4d7c2-31c9-4e4b-96bc-bb241ddb392d",

"symbol":"BTC/USDT",

"ordType":"Limit",

"price":"8000",

"transactTime":1557912994901110000,

"execId":"cef664d4-f438-4ad5-a7ad-279f725380d3",

"tradeId":"220143239",

"side":"Sell",

"orderQty":"1",

"leavesQty":"0",

"cumQty":"1",

"lastQty":"1",

"lastPx":"8000",

"avgPx":"0",

"calculatedCcyLastQty":"8000",

"netMoney":"8000",

"commission":"0",

"commCurrency":"USDT",

"positionEffect":"UnknownPositionEffect"

}

]


Response parameters


Field


Type / possible values

Status Message

OrderId

M

String / Guid


ClOrdId

M

String


TradeId

C

String


Symbol

M

String


Side

M

int

1 Buy

2 Sell


Price

C

Decimal

Conditionally required for limit orders.

OrderQty

M

Decimal

In accordance with order status matrices.

LeavesQty

M

Decimal

In accordance with order status matrices.

CumQty

M

Decimal

In accordance with order status matrices.

ExecId

M

String / Guid

Unique identifier of the execution message within a 24-hour range

LastQty

C

Decimal

In accordance with order status matrices.

LastPx

C

Decimal


CalculatedCcyLastQty

C

Decimal

Net payment of the fill, not including commission.

NetMoney

C

Decimal

Gross amount of the fill, including commission.

TransactTime

M

Long — Unix timestamp in nanoseconds

Timestamp of the event.

LastLiquidityInd

C

1 AddedLiquidity

2 RemovedLiquidity

Conditionally required when ExecType is Trade.

Commission

O

Decimal


CommCurrency

O

String


Currency

M

String

Pair base currency

SettlCurrency

M

String

Pair quote currency

PositionId

O

int


positionEffect

O

char

C Close

O Open


avgPx

O

decimal

Average price