API
Rest API
Rest API Introduction
Rest API allow clients to control their account using HTTP requests.
There are available requests for all users via the Public API and separately only for registered clients via Private API.
Available requests:
The number of requests to API is limited to 1 request per second. If an IP address or account exceeds this limit the JSON response:{"message":"Request limit"} will be returned.
Public API
Public API Introduction
API is available via server endpoint: /{endpoint}/{symbol}
All API calls accept requests sent via HTTP GET with parameters appended to the URL and return response as JSON.
Ticker
By sending a GET request to ticker endpoint you can get actual price on the market for specified symbol.
request endpoint: /ticker/{SYMBOL}
Response - JSON:
Name Type Description
mid Double Average of the bid and ask price
bid Double Highest buy order price
ask Double Lowest sell order price
last Double Price of the last executed order
timestamp Long UNIX timestamp in milliseconds
Response example:
{"mid":11001.48,"bid":10983.24,"ask":11019.73,"last":10982.24,"timestamp":1517313386661}
Order book
By sending a GET request to orders endpoint you can obtain active orders for specified symbol.
request endpoint: /orders/{SYMBOL}
Response - JSON:
Name Type Description
mid Double Average of the bid and ask price
bid Double Highest buy order price
ask Double Lowest sell order price
last Double Price of the last executed order
timestamp Long UNIX timestamp in milliseconds
Response example:
{"mid":11001.48,"bid":10983.24,"ask":11019.73,"last":10982.24,"timestamp":1517313386661}
Transactions
By sending a GET request to transactions endpoint you can get a list of historical transactions limited by 100. To obtain previous transactions you can send a request with time parameter for a return list of historical transactions before specified time.
request endpoint: /transactions/{SYMBOL}
Response - JSON:
Name Type Description
timestamp Long UNIX timestamp in milliseconds
bids JSON Array List of active buy orders, each order contain "price" and "volume"
asks JSON Array List of active sell orders, each order contain "price" and "volume"
Response example:
{"timestamp":1517314172433, "bids":[{"price":11030.23, "volume":6.1438452}, {"price":11025.14, "volume":1.75741139}], "asks":[{"price":11061, "volume":2.64905172}, {"price":11069.88, "volume":3.31586561}]}
Private API
Private API Introduction
API is available via server endpoint: /api/{endpoint}
To send a request to the Private API you have to generate a new key on the platform under the "API" tab on the exchange platform.
Each key description:
  • API-key - key to include in requests header.
  • Secret-key - key used to calculate request signature using HMAC-SHA256.
  • Permissions - operations available for generated key.
All requests are required to include HTTP headers:
  • API-key - API key generated on the platform.
  • API-nonce - long value increased with every request.
  • Permissions - API-hmac - HMAC-SHA256 calculated from request body and secret key, converted to it's hexadecimal representation.
Steps to generate proper requests:
  1. Create request in JSON format and set all needed parameters.
  2. Serialize JSON to string.
  3. Sign JSON request using HMAC-SHA256.
  4. Create new nonce (eg. Unix timestamp).
  5. Put the HTTP request headers (api-key, api-nonce, api-hmac).
  6. Send POST request to the endpoint.
Name Type Description
timestamp Long UNIX timestamp in milliseconds
transactionID Long Transaction ID
price Double Price of executed transaction
volume Double Volume of executed transaction
side Int Order side: 0 - buy, 1 - sell
[{"timestamp":1516886921146, "transactionID":78629697, "price":11105, "volume":0.93668069, "side":1}, {"timestamp":1516886921145, "transactionID":78629697, "price":11117.33, "volume":0.06331931, "side":1}]
hex(HMAC_SHA256(jsonRequest, key=secret-key))
New order
By sendng a POST request to order endpoint you can place new order on the market.
request endpoint: /api/order
Request parameters:
Name Type Description Required
nonce Long Repeated number send in the request header Y
amount Double Quantity of main currency Y
price Double Price, not required if market order N
ordSide Int Order side: 0 - buy, 1 - sell Y
ordType Int Order type: 0 - market, 1 - limit, 2 - stop Y
symbol String Symbol Y
Request example:
{"amount":0.1, "price":5, "nonce":10000, "ordSide":0, "ordType":1, "symbol": "BTCUSD"}
Response - JSON:
Name Type Description
orderId Long Order ID
message String Request result
Response message and HTTP code depends on request result:
Code Message
200 "Order added"
406 "Instrument not supported {symbol}"
406 "You are not allowed to trade on instrument {symbol}"
406 "Quantity must be at least {minSize} {currency}"
406 "Insufficient funds!"
Response example:
{"orderId":100034, "message":"Order added"}
Order status
By sending a POST request to status endpoint you can get actual status of the specified order.
request endpoint: /api/status
Request parameters:
Name Type Description Required
nonce Long Repeated number send in the request header Y
orderId Long Order ID Y
Request example:
{"nonce":10000, "orderId":100001}
Response - JSON:
Name Type Description
orderId Long Order ID
orderStatus String Order status
Possible status: "Filled", "Pending", "Cancelled", "Not found".
Pending orders
By sending a POST request to pending endpoint you can obtain list of your active orders. To get pending orders only for specified symbol set symbol parameter.
request endpoint: /api/pending
Request parameters:
Name Type Description Required
nonce Long Repeated number send in the request header Y
symbol String Symbol N
Request example:
{"nonce":10000, "symbol":"BTCUSD"}
Response - JSON:
Name Type Description
orderId Long Order ID
symbol String Symbol
lastChanged Long UNIX timestamp of the last modification
ordSide Int Order side: 0 - buy, 1 - sell
ordType Int Order type: 0 - market, 1 - limit, 2 - stop
startVolume Long Original volume
currentVolume Long Remaining volume
price Long Price
Response example:
[{"orderId":100035, "symbol":"BTCUSD", "lastChanged":1517323092610, "ordType":1, "ordSide":0, "startVolume":0.1, "currentVolume":0.1, "price":5}]
Cancel order
By sending a POST request to cancel endpoint you can cancel order with specified order Id.
request endpoint: /api/cancel
Request parameters:
Name Type Description Required
nonce Long Repeated number send in the request header Y
orderid Long Order ID to cancel Y
Request example:
{"nonce":10000, "orderId":100001}
Response - JSON:
Name Type Description
userId Long User ID
orderId Long Cancelled order ID
message String Result of the request
Response message and HTTP code depends on request result:
Code Message
200 "Cancelled upon request!"
407 "Invalid order Id"
407 "Order does not belong to client: {userId}"
Response example:
{"userId":8000, "orderId":100001, "message":"Cancelled upon request"}
Transactions history
By sending a POST request to history endpoint you can get list of your historiacal transactions limited by 100. To check previouse orders you can use time parameter to get transactions before specified time.
request endpoint: /api/history
Request parameters:
Name Type Description Required
nonce Long Repeated number send in the request header Y
time Long UNIX timestamp in milliseconds N
symbol String Symbol N
Request example:
{"nonce":10000, "time":1516886921146, "symbol":"BTCUSD"}
Response - JSON Array with values represented by JSON:
Name Type Description
orderId Long Order ID
symbol String Symbol
ordSide Int Order side: 0 - buy, 1 - sell
ordType Int Order type: 0 - market, 1 - limit, 2 - stop
date Long Unix timestamp of order execution
startVolume Long Volume
price Long Price
Response example:
[{"orderId":100038, "symbol":"BTCUSD", "ordType":1, "ordSide":0, "date":1516284409020, "volume":1, "price":9605.38}, {"orderId":100038, "symbol":"BTCUSD", "ordType":1, "ordSide":0, "date":1516284407253, "volume":1, "price":9605.32}]
Balance
By sending a POST request to balance endpoint you can obtain all available balances for your account. Specify currency parameter to get balances for one currency.
request endpoint: /api/balance
Request parameters:
Name Type Description Required
nonce Long Repeated number send in the request header Y
currency String Currency shortcut, specify if you want to get balance only for this currency N
Request example:
{"nonce":10000, "currency":"BTC"}
Response - JSON Array with available balances, values are represented by JSON:
Name Type Description
userId Long User ID
symbol String Symbol
volume Double Available volume for this currency
lockedVolume Double Locked volume for this currency
Response example for BTC:
{"userId":8000, "symbol":"BTC", "volume":12.2, "lockedVolume":1}
Request example for all client's balances:
{"nonce":10000, "currency":"BTC"}
Response example for all client's balances:
[{"userId":8000, "symbol":"BTC", "volume":12.2, "lockedVolume":1},{"userId":8000, "symbol":"USD", "volume":9999.74, "lockedVolume":0}]
Fee
By sending a POST request to conditions/fee endpoint you can check your maker and taker fee in percents.
request endpoint: /api/conditions/fee
Request parameters:
Name Type Description Required
nonce Long Repeated number send in the request header Y
Request example:
{"nonce":10000}
Response - JSON:
Name Type Description
userId Long User ID
maker Double Maker fee in percents
taker Double Taker fee in percents
Response example:
{"userId":8000, "maker":1, "taker":2}
Minimal order size
By sending a POST request to conditions/min endpoint you can get minimal order size either for all symbols or for only one specified by symbol parameter.
request endpoint: /api/conditions/size
Request parameters:
Name Type Description Required
nonce Long Repeated number send in the request header Y
symbol String Symbol N
Request example:
{"nonce":10000, "symbol":"BTCUSD"}
Response - JSON Array with values represented by JSON:
Name Type Description
userId Long User ID
symbol String Symbol
minOrderSize JSON JSON with minimal order size for base currency and quote currency
Errors
Name Code Description
Invalid request parameters 401 Missing required parameters or invalid value
Permission denied 402 Api key is not authorised to this operation
Unknown client 403 Client not defined in system
Unknown currency 404 Currency not defined in system
Empty list 405 Empty result
New order rejected 406 New order rejected (eg. Insufficient funds)
Cancel order error 407 Error occured during cancelling order (eg. Invalid order ID)
Unknown symbol 408 Symbol not defined in system
Invalid order price or amount 409 Invalid order price or amount
Invalid order typ 410 Order type can be: 0 - market, 1 - limit, 2 - stop
Invalid order side 411 Order side can be: 0 - buy, 1 - sell
Endpoint not found 501 Endpoint not found
Missing headers 502 Missing headers
Requests limit 503 Exceeded request limit
Invalid HMAC 504 Invalid HMAC
Unknown api-key 505 Api key not defined in system
Invalid nonce 506 Nonce must be greater than last used nonce
Internal error 507 Internal server error