REST Account 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/<accountId>/balance/

Response:


{
        "balances":[

                {

"available":"0",

"onHold":"0",

"currency":"LTC",

"equivalent":{

"BTC":{

"ratio":"0",

"amount":"0",

"currency":"BTC",

"proportion":"0"

},

"USDT":{

"ratio":"0",

"amount":"0",

"currency":"USDT",

"proportion":"0"

}

},

"positions":[

]

},

{
"available":"5345.01",
"onHold":"0",
"currency":"BTC",
"equivalent":{
"BTC":{
"ratio":"1",
"amount":"5345.01",
"currency":"BTC",
"proportion":"0.918"
},
"USDT":{
"ratio":"4000",
"amount":"21380040",
"currency":"USDT",
"proportion":"0.776"
}
},
"positions":[
{
"currency":"USDT",
"avgPx":"2544.76",
"positionID":131496726,
"positionOpenTime":1543932459063085000,
"realizedPL":"51514743.43"
},
{
"currency":"BTC",
"avgPx":"1",
"positionID":131496726,
"positionOpenTime":1543932459063085000,
"realizedPL":"-0.00080004"
}

]

},

{

"available":"1926993.56",

"onHold":"4.67",

"currency":"USDT",

"equivalent":{

"BTC":{

"ratio":"0.00025",

"amount":"481.7495575",

"currency":"BTC",

"proportion":"0.082"

},

"USDT":{

"ratio":"1",

"amount":"1926998.23",

"currency":"USDT",

"proportion":"0.067"

}

},

"positions":[

{

"currency":"USDT",

"avgPx":"1",

"positionID":131496727,

"positionOpenTime":1543932468329095000,

"realizedPL":"0"

},

{

"currency":"BTC",

"avgPx":"0.51894572",

"positionID":131496727,

"positionOpenTime":1543932468329095000,

"realizedPL":"0"

}

]

}

],

"equivalent":{

"BTC":{

"ratio":"0",

"amount":"5826.7595575",

"currency":"BTC",

"proportion":"1"

},

"USDT":{

"ratio":"0",

"amount":"27627038.23",

"currency":"USDT",

"proportion":"1"

}

}

}


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

equivalent

M

Container

Contains available balance, calculated in other currencies

<currency>

M

Container

Target currency

ratio

M

decimal

Ratio

amount

M

decimal

Amount in target currency

currency

M

string

Target currency

proportion

M

decimal

Proportion of total amount

positions

M

Array

Contains account positions

currency

O

string

Position currency

avgPx

O

decimal

Average price

positionID

O

int

Position ID

positionOpenTime

O

long

Position opening time

realizedPL

O

decimal

Realized PL

equivalent

M

Container

Contains the total balance, calculated in one currency

<currency>

M

Container

Target currency

ratio

M

decimal

Ratio

amount

M

decimal

Amount in target currency

currency

M

string

Target currency

proportion

M

decimal

Proportion of total amount