Information
- The base endpoint is https://api.narkasa.com
- All endpoints return JSON object or array
- All time and timestamp related fields are in milliseconds.
- All time and timestamp used UTC.
HTTP 4XX
return codes are used for invalid requests, the issue is on the client side.HTTP 429
return codes is used for request rate limitHTTP 5XX
return codes are used for internal errors, the issue is on the server side.- Any endpoint can return an ERROR, the error payload is as follows:
{
"code": 20001,
"msg": "Invalid API key or secret."
}
- Specific error codes and messages defined all methods inside.
- For
GET
endpoints, parameters must be sent as aquerystring
- For
POST
,PUT
,DELETE
endpoints, parameters send bothquerystring
or/andbody
. If you send both of them we choicebody
parameters value.
Limits
/api
requests are limited to 10 request per second.- A
HTTP 429
will be returned when either rate limit is violated. - When a
HTTP 429
is recieved, it`s your obligation as an API to back off and not spam the API. - If you repeatly violating rate limits when you will be automated IP BAN from 5 minutes to 1 day.
Security
- Signed Security
A signed
endpoint require signature
parameter
Endpoints use HMAC SHA256
signatures. Use your apiSecret
as the key and all parameters signed.
- Timestamp Security
A signed
endpoint require timestamp
parameter.
An additional parameter windowSize
, IF sent to specify the number of milliseconds after timestamp the request is valid for. If windowSize
is not sent, it defaults to 10000
.
serverTime
and timestamp
parameter difference bigger than windowSize
the request is invalid.
let windowSize = 10000;
if (serverTime - timestamp <= windowSize) {
//accept request
} else {
// reject request with code: "20004"
}
- Example Signed Request
a signed
request request example is as follows:
Key | Value |
---|---|
apiKey | Y0AhbfGmVA8FG7kPN6a9PB7UOpwnlvKG4bI5Jc57awpKv4uKN9UX114EPRTcKuhX |
apiSecret | 7v5TnUBX92lgKWlODJbRn3FIoriHNihB3PHFi591Do5ip9DLrCvx0bn9dHZKFZRS |
- Get Time
[linux]$ date +%s"
1578398112
Linux date output is second. We always used milliseconds. So you must multiply output 1000
HMAC signature:
[linux]$ echo -n "timestamp=1578398112000" | openssl dgst -sha256 -hmac "7v5TnUBX92lgKWlODJbRn3FIoriHNihB3PHFi591Do5ip9DLrCvx0bn9dHZKFZRS"
(stdin)= c9445c8f619a64524d58378dbc40d9bfa5148de895cd8c7df8ae769630c5b67c
- Signed Test Request:
[linux]$ curl -H "X-APNK-APIKEY: Y0AhbfGmVA8FG7kPN6a9PB7UOpwnlvKG4bI5Jc57awpKv4uKN9UX114EPRTcKuhX" -X POST "https://api.narkasa.com/v3/api/balance/wallet?timestamp=1578398112000&windowSize=1000&signature=c9445c8f619a64524d58378dbc40d9bfa5148de895cd8c7df8ae769630c5b67c"
{
//Response
"code":"00000"
}
General Endpoints
Connectivity Test
Connectivity test to the REST API.
- Method
GET
- Parameters
NONE
- Request
v3/api/ping
{
//Response
"code":"00000",
"data":"PONG"
}
- Example
curl https://api.narkasa.com/v3/api/ping
Check Server Time
Get the current server time
- Method
GET
- Parameters
NONE
- Request
v3/api/time
{
//request
"code":"00000",
"data":1578405048608
}
- Example
curl https://api.narkasa.com/v3/api/time
API Authentication Test
API Authentication test method.
- Method
POST
- Parameters
Parameter | Type | Required | Description |
---|---|---|---|
x-apnk-apikey | STRING | YES | Private API key Must be Request Header |
timestamp | LONG | YES | Request datetime timestamp(ms) |
signature | STRING | YES | Request hashed signature with API secret |
windowSize | INT | NO | Allowable client and server time diff |
- Request
v3/api/balance/wallet
{
//Response
"code":"00000",
}
- Example
[linux]$ curl -H "X-APNK-APIKEY: Y0AhbfGmVA8FG7kPN6a9PB7UOpwnlvKG4bI5Jc57awpKv4uKN9UX114EPRTcKuhX" -X POST "https://api.narkasa.com/v3/api/balance/wallet?timestamp=1578398112000&windowSize=1000&signature=790e8e78a273f1e755f2e07d0c10e6034b6f653daf086755d9b31f40c9bfc689"
Websocket Data Streams
- The base endpoint is wss://api.narkasa.com/v3
- Streams can be access either in a single raw stream or a combined stream
- All symbols for streams are UPPERCASE
All messages should be send STRINGIFY
The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams.
Subscribe a stream
Subscription specific message for symbol
- Request
{ method: "SUBSCRIBE", params: [ { type: "allTickers" } ] }
- Response
{ "method":"SUBSCRIBE", "status":"success", "type":"allTickers" }
Unsubscribe a stream
Unsubscription specific message for symbol
- Request
{ method: "UNSUBSCRIBE", params: [ { type: "allTickers" } ] }
- Response
{ "method":"UNSUBSCRIBE", "status":"success", "type":"allTickers" }
Listing Subscriptions
Listing all active subscriptions
- Request
{ "method":"LIST_SUBSCRIPTIONS" }
- Response
{ "method":"LIST_SUBSCRIPTIONS", "status":"success", "result":[ { "type":"orderBook", "symbol":"BTCUSDT" }, { "type":"depth", "symbol":"BTCUSDT" }, ... ] }
Market Endpoints
Get All Markets 24h
Get all available markets last 24h statistics
- Method:
GET
- Parameters:
NONE
- Request
v3/api/market/markets
{
//Response
"code":"00000",
"markets":
[
{
"symbol": "BTCTRY",
"name": "Bitcoin",
"firstSymbol": "BTC",
"secondSymbol": "TRY",
"changeAmount": 498,
"changePercent": 0.83,
"last": 60000,
"firstBid": 59999,
"firstAsk": 60001,
"open": 59502,
"high": 61000,
"low": 59000,
"avg": 60002,
"volume": 2,
"openTime": 1577738760005,
"tradeCount": 23
}
]
}
- Example
curl https://api.narkasa.com/v3/api/market/markets
- Possible Return Codes
Code | Meaning |
---|---|
00000 | Success |
90000 | Unexpected Error |
Get Symbol 24h Statistics
Get symbol market last 24h statistics
- Method
GET
- Parameters
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
- Request
v3/api/market/24h
{
//Response
"code": "00000",
"market": {
"symbol": "BTCTRY",
"changeAmount": 498,
"changePercent": 0.83,
"last": 60000,
"firstBid": 59999,
"firstAsk": 60001,
"open": 59502,
"high": 61000,
"low": 59000,
"avg": 60002,
"volumeQty": 2,
"volume": 120004,
"openTime": 1577738760005,
"tradeCount": 23
}
}
Example
curl https://api.narkasa.com/v3/api/market/24h?symbol=BTCTRY
Possible Return Codes
Code | Meaning |
---|---|
00000 | Success |
10037 | Invalid symbol |
90000 | Unexpected Error |
Get Symbol Detailed Info
Get actual order book for a symbol
- Method
GET
- Parameters
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
- Request
v3/api/market/info
{
//Response
{
"code":"00000",
"info":{
"symbol":"BTCTRY",
"firstSymbol":"BTC",
"secondSymbol":"TRY",
"firstSymbolMaxLength":6,
"secondSymbolMaxLength":0,
"minTradeTotal":10,
"minAmount":0.000001,
"commission":0.2,
"enable":"true",
"cancelEnable":"true",
"orderEnable":"true",
"commissionTaker":0.2,
"commissionMaker":0.2,
"commissionPercentage":true,
"commissionTierBased":false,
"precision":{
"price":0,
"amount":6,
"total":0
}
}
}
}
Example
curl https://api.narkasa.com/v3/api/market/info?symbol=BTCTRY
Possible Return Codes
Code | Meaning |
---|---|
00000 | Success |
10037 | Invalid symbol |
90000 | Unexpected Error |
Get Symbol Candlestick Data
Get selected markets candle
- Method:
GET
- Parameters:
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
startDate | LONG | NO |
endDate | LONG | NO |
interval | STRING | NO |
- Request
v3/api/market/candles
{
//Response
"code":"00000",
"candles":
[
{
"open": 48657,
"low": 48000,
"high": 48999,
"close": 48980,
"volume": 2,
"openTime": 1577738760005,
"closetime": 1577738820005
},
]
}
- Example
curl https://api.narkasa.com/v3/api/market/candles?symbol=BTCTRY&interval=m1
- Possible Return Codes
Code | Meaning |
---|---|
00000 | Success |
10037 | Invalid symbol |
90000 | Unexpected Error |
- Intervals
m1 |
m3 |
m5 |
m15 |
m30 |
h1 |
h2 |
h4 |
d1 |
Get Symbol Orderbook
Get actual order book first buy and sell order for a symbol
- Method
GET
- Parameters
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
- Request
v3/api/market/orderbook
{
//Response
"code":"00000",
"book":
{
"bids":
[
{
"price": 47002,
"amount": 0.0446
}
],
"asks":
[
{
"price": 47003,
"amount": 0.23
}
]
}
}
- Example
curl https://api.narkasa.com/v3/api/market/orderbook?symbol=BTCTRY
- Possible Return Codes
Code | Meaning |
---|---|
00000 | Success |
10037 | Invalid symbol |
90000 | Unexpected Error |
Get Symbol Order Depth
Get actual order book first buy and sell order for a symbol
- Method
GET
- Parameters
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
- Request
v3/api/market/depth
{
//Response
"code":"00000",
"book":
{
"bids":
[
{
"price": 47002,
"amount": 0.0446,
"count": 4,
},
{
"price": 47001,
"amount": 0.012,
"count": 5,
},
{
"price": 47000,
"amount": 0.012,
"count": 2,
}
...
],
"asks":
[
{
"price": 47003,
"amount": 0.23,
"count": 2,
},
{
"price": 47004,
"amount": 0.0123,
"count": 2,
}{
"price": 47005,
"amount": 0.017,
"count": 2,
}
...
]
}
}
Example
curl https://api.narkasa.com/v3/api/market/depth?symbol=BTCTRY
Possible Return Codes
Code | Meaning |
---|---|
00000 | Success |
10037 | Invalid symbol |
90000 | Unexpected Error |
Get Symbol Trade History
Get last trades for a symbol
- Method
GET
- Parameters
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
- Request
v3/api/market/trades
{
//Response
"code":"00000",
"trades":
[
{
"price": 47003,
"amount": 0.23,
"time": 1577891201415,
"type": 0 //BUYER IS MAKER
}
]
}
- Example
curl https://api.narkasa.com/v3/api/market/trades?symbol=BTCTRY
- Possible Return Codes
Code | Meaning |
---|---|
00000 | Success |
10037 | Invalid symbol |
90000 | Unexpected Error |
Market Data Streams
All Tickers 24H Statistics
Handling all market updates with 24h statistics, you can subscribe allTickers
channel.
- This updates period, if available
2000 ms
- When subscribe All Tickers you can handle all market changes.
- This message only send if a market any value has changed.
We send only updated market statistic. If you need all markets data you can use our REST services.
Subscription Request
{ method: "SUBSCRIBE", params: [ { type: "allTickers" } ] }
- Subscription Response
{ "method":"SUBSCRIBE", "status":"success", "type":"allTickers" }
{
//Example allTickers payload
"type":"allTickers",
"symbol":"BTCTRY",
"changeAmount":1,
"changePercent":0.0018,
"firstBid":54500,
"firstAsk":54501,
"open":54500,
"high":54501,
"low":54500,
"avg":54500.5,
"last":54501,
"volume":54501,
"volumeQty":1,
"openTime":1587923986290,
"tradeCount":2
}
Market 24H Statistics
Handling specific market updates with 24h statistics, you can subscribe ticker
channel.
- This updates period, if available
2000 ms
- When subscribe a market ticker, you can handle market all changes.
- This message only send if market any value has changed.
We send only subscription market statistic. If you need all markets updates you can subscribe
allTickers
services or or you can use our REST services.Subscription Request
{ method: "SUBSCRIBE", params: [ { type: "ticker", symbol: "BTCTRY" } ] }
- Subscription Response
{ "method":"SUBSCRIBE", "status":"success", "type":"ticker", "symbol":"BTCTRY" }
{
//Example allTickers payload
"type":"ticker",
"symbol":"BTCTRY",
"changeAmount":0,
"firstBid":54500,
"firstAsk":54501,
"open":54500,
"high":54500,
"low":54500,
"avg":54500,
"last":54500,
"volume":54500,
"volumeQty":1,
"tradeCount":1
}
Market Candlestick Updates
Handling market candlestick updates, you can subscribe candles
channel for a specific market.
- This updates period, if available
1000 ms
- When subscribe Candles you can handle market candlestick data updates.
- This message only send if a candlestick close price has changed.
We send only actual candlestick data for interval. If you need more candlestick data you can use our REST services.
Subscription Request
{ method: "SUBSCRIBE", params: [ { type: "candles",symbol: "BTCTRY","interval": "m5" } ] }
- Subscription Response
{ "method":"SUBSCRIBE", "status":"success", "type":"candles", "symbol":"BTCTRY", "interval":"m5", }
- Available Intervals
m1 |
m3 |
m5 |
m15 |
m30 |
h1 |
h2 |
h4 |
d1 |
{
//Example candles payload
"type":"candles",
"symbol":"BTCTRY",
"interval":"m5",
"kline":{
"openTime":1588010100000,
"open":54500,
"low":54500,
"high":54500,
"close":54500,
"volume":0.0005,
"closeTime":1588010323000
}
}
Market Order Book Updates
Handling market first buy and sell price/amount updates, you can subscribe orderBook
channel for a specific market.
- This updates period, if available
250 ms
- When subscribe order book you can handle markets first buy and first sell price and amount data.
- This message only send if market first buy or sell order amount or price has changed.
If you need more depth data you can subscribe
depth
services or you can use our REST services.Subscription Request
{ method: "SUBSCRIBE", params: [ { type: "orderBook",symbol: "BTCTRY" } ] }
- Subscription Response
{ "method":"SUBSCRIBE", "status":"success", "type":"orderBook", "symbol":"BTCTRY", }
{
//Example orderBook payload
"type":"orderBook",
"symbol":"BTCTRY",
"bidPrice":54500,
"bidAmount":0.001,
"askPrice":54501,
"askAmount":0.001
}
Market Depth Updates
Handling market depth updates, you can subscribe depth
channel for a specific market.
- This updates period, if available
500 ms
- When subscribe Depth you can handle market depth data updates.
This message only send if a depth has changed.
Subscription Request
{ method: "SUBSCRIBE", params: [ { type: "depth",symbol: "BTCTRY" } ] }
- Subscription Response
{ "method":"SUBSCRIBE", "status":"success", "type":"depth", "symbol":"BTCTRY", }
{
//Example depth payload
"type":"depth",
"symbol":"BTCTRY",
"depth":{
"bids":[
{"price":54500,"amount":0.001,"count":1},
{"price":54499,"amount":0.001,"count":1},
{"price":54498,"amount":0.001,"count":1}
...],
"asks":[
{"price":54501,"amount":0.001,"count":1},
{"price":54502,"amount":0.001,"count":1},
{"price":54503,"amount":0.001,"count":1}
...]
}
}
Market Trade Updates
Handling specific market trades, you can subscribe trade
channel.
- This updates period
REAL-TIME
- When subscribe a market trade, you can handle market trades.
We send only subscription market actual trades. If you need more trade data you can use our REST services.
Subscription Request
{ method: "SUBSCRIBE", params: [ { type: "trade", symbol: "BTCTRY" } ] }
- Subscription Response
{ "method":"SUBSCRIBE", "status":"success", "type":"trade", "symbol":"BTCTRY" }
- Trade Type Reference
Value | Meaning |
---|---|
0 | Buyer is maker |
1 | Buyer is taker |
{
//Example allTickers payload
"type":"trade",
"symbol":"BTCTRY",
"amount":0.0005,
"price":54500,
"tradeType":1,
"time":1588010323279
}
Signed Market Endpoints
New Limit Buy Order
Create new limit buy order
- Method:
POST
Parameters:
Parameters must send with body
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
price | FLOAT | YES |
amount | FLOAT | YES |
- Request
v3/api/market/limit-buy
{
//Response
"code": "00000",
"order":{
"status": "NEW",
"orderId": "ce82ac3aed3e8b1cecc6fcd36ddc49936866c49bfa4f4f32fbfc12a005e995c9b3b52e2b",
"market":"BTCUSDT",
"orderType": "LIMIT",
"side": "BUY",
"price": 9500,
"amount": 0.001,
"filledAmount": 0,
"time": 1578405048608
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10031 | Insufficient balance |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10062 | Buy Price is not lower than %40 |
20000 | Authorization required |
20007 | Price must be float and higher than 0 |
20009 | Amount must be float and higher than 0 |
90000 | Unexpected Error |
00000 | Success |
New Limit Sell Order
Create new limit sell order
- Method:
POST
Parameters:
Parameters must send with body
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
price | FLOAT | YES |
amount | FLOAT | YES |
- Request
v3/api/market/limit-sell
{
//Response
"code": "00000",
"order":{
"status": "NEW",
"orderId": "ce82ac3aed3e8b1cecc6fcd36ddc49936866c49bfa4f4f32fbfc12a005e995c9b3b52e2b",
"market":"BTCUSDT",
"orderType": "LIMIT",
"side": "SELL",
"price": 9500,
"amount": 0.001,
"filledAmount": 0,
"time": 1578405048608
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10031 | Insufficient balance |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10061 | Sell Price is not higher than %250 |
20000 | Authorization required |
20007 | Price must be float and higher than 0 |
20009 | Amount must be float and higher than 0 |
90000 | Unexpected Error |
00000 | Success |
New Market Buy Order
Create new market buy order
- Method:
POST
Parameters:
Parameters must send with body
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
amount | FLOAT | YES |
- Request
v3/api/market/market-buy
{
//Response
"code": "00000",
"order":{
"status": "FILLED",
"market":"BTCUSDT",
"orderType": "MARKET",
"side": "BUY",
"amount": 0.001,
"filledAmount": 0.001,
"time": 1578405048608
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10031 | Insufficient balance |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10042 | Market order not available |
20000 | Authorization required |
20009 | Amount must be float and higher than 0 |
90000 | Unexpected Error |
00000 | Success |
New Market Sell Order
Create new market sell order
- Method:
POST
Parameters:
Parameters must send with body
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
amount | FLOAT | YES |
- Request
v3/api/market/market-sell
{
//Response
"code": "00000",
"order":{
"status": "FILLED",
"market":"BTCUSDT",
"orderType": "MARKET",
"side": "SELL",
"amount": 0.001,
"filledAmount": 0.001,
"time": 1578405048608
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10031 | Insufficient balance |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10042 | Market order not available |
20000 | Authorization required |
20009 | Amount must be float and higher than 0 |
90000 | Unexpected Error |
00000 | Success |
New Stop Limit Buy Order
Create new stop limit buy order
- Method:
POST
Parameters:
Parameters must send with body
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
price | FLOAT | YES |
target | FLOAT | YES |
amount | FLOAT | YES |
- Request
v3/api/market/stop-limit-buy
{
//Response
"code": "00000",
"order":{
"status": "NEW",
"orderId": "ce82ac3aed3e8b1cecc6fcd36ddc49936866c49bfa4f4f32fbfc12a005e995c9b3b52e2b",
"market":"BTCUSDT",
"orderType": "STOP LIMIT",
"stopType": "GREATER",
"side": "BUY",
"target": 9525,
"price": 9500,
"amount": 0.001,
"time": 1578405048608
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10031 | Insufficient balance |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10062 | Buy Price is not lower than %40 |
20000 | Authorization required |
20007 | Price must be float and higher than 0 |
20008 | Target must be float and higher than 0 |
20009 | Amount must be float and higher than 0 |
90000 | Unexpected Error |
00000 | Success |
New Stop Limit Sell Order
Create new stop limit sell order
- Method:
POST
Parameters:
Parameters must send with body
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
price | FLOAT | YES |
target | FLOAT | YES |
amount | FLOAT | YES |
- Request
v3/api/market/stop-limit-sell
{
//Response
"code": "00000",
"order":{
"status": "NEW",
"orderId": "ce82ac3aed3e8b1cecc6fcd36ddc49936866c49bfa4f4f32fbfc12a005e995c9b3b52e2b",
"market":"BTCUSDT",
"orderType": "STOP LIMIT",
"stopType": "LESS",
"side": "SELL",
"target": 9300,
"price": 9305,
"amount": 0.001,
"time": 1578405048608
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10031 | Insufficient balance |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10061 | Sell Price is not higher than %250 |
20000 | Authorization required |
20007 | Price must be float and higher than 0 |
20008 | Target must be float and higher than 0 |
20009 | Amount must be float and higher than 0 |
90000 | Unexpected Error |
00000 | Success |
New Fast Buy Order
Create new fast buy order
- Method:
POST
Parameters:
Parameters must send with body
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
total | FLOAT | YES |
- Request
v3/api/market/fast-buy
{
//Response
"code": "00000",
"order":{
"status": "FILLED",
"market":"BTCUSDT",
"orderType": "FAST",
"side": "BUY",
"total": 100,
"filledTotal": 100,
"time": 1578405048608
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10031 | Insufficient balance |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10060 | Fast order not available |
20000 | Authorization required |
20012 | Total must be float and higher than 0 |
90000 | Unexpected Error |
00000 | Success |
New Fast Sell Order
Create new fast sell order
- Method:
POST
Parameters:
Parameters must send with body
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
amount | FLOAT | YES |
- Request
v3/api/market/fast-sell
{
//Response
"code": "00000",
"order":{
"status": "FILLED",
"market":"BTCUSDT",
"orderType": "FAST",
"side": "SELL",
"amount": 0.001,
"filledAmount": 0.001,
"time": 1578405048608
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10031 | Insufficient balance |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10060 | Fast order not available |
20000 | Authorization required |
20009 | Amount must be float and higher than 0 |
90000 | Unexpected Error |
00000 | Success |
Get User Active Orders
Get User Active Orders
- Method:
GET
- Parameters:
NONE
- Request
v3/api/market/user-orders
{
//Response
"code": "00000",
"orders": [
{
"market": "BTCTRY",
"price": 47016,
"targetPrice": 0,
"amount": 0.42,
"filledAmount": 0,
"side": 1,
"time": 1580131799413,
"orderType": 0,
"orderId": "ce82ac3aed3e8b1cecc6fcd36ddc49936866c49bfa4f4f32fbfc12a005e995c9b3b52e2b"
}
]
}
- Side
Value | Meaning |
---|---|
0 | Buy |
1 | Sell |
- Order Type
Value | Meaning |
---|---|
0 | Limit |
1 | Market |
2 | Stop Loss |
3 | Fast |
- Stop Type
Value | Meaning |
---|---|
0 | Less |
1 | Greater |
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10038 | Market disabled |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
Cancel An Active Order
Cancel An Active Order
- Method:
POST
- Parameters:
Parameter | Type | Required |
---|---|---|
orderId | STRING | YES |
- Request
v3/api/market/cancel-order
{
//Response
"code":"00000"
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10075 | Order not found |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
Get User Trades
Get User Trade History
- Method:
GET
- Parameters:
NONE
- Request
v3/api/market/user-trades
{
//Response
"code": "00000",
"trades": [
{
symbol: "BTCUSDT",
price: 9800,
amount: 0.0012,
side: 1,
orderType: 0
commission: 0.02352
commissionSymbol: "USDT"
time: 1591875237869
}
]
}
- Side
Value | Meaning |
---|---|
0 | Buy |
1 | Sell |
- Order Type
Value | Meaning |
---|---|
0 | Limit |
1 | Market |
2 | Stop Loss |
3 | Fast |
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10038 | Market disabled |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
Signed Balance Endpoints
Get User Wallet
Get User Wallet
- Method:
GET
- Request
v3/api/balance/wallet
{
//Response
"code": "00000",
"wallet": [
{
"symbol": "TRY",
"total": 0,
"available": 0,
"reserved": 0,
}
]
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
Get All Currencies
Get all available currencies
- Method:
GET
- Parameters:
NONE
- Request
v3/api/balance/currencies
{
//Response
"code": "00000",
"currencies": [
{
"id": "cc8dfd30b230de18ec95a88438dc49c13868c49afd484832aaae1ea70fbb92cce6b12e72",
"symbol": "TRY",
"name": "Türk Lirası"
},
]
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
Get Withdraw Addresses
Get available address and nodes for a symbol
- Method:
POST
- Parameters:
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
- Request
v3/api/balance/withdraw
{
//Response
"code": "00000",
"currency": {
"id": "ce87ad6fef308b43ec95a9d73cdc49933f3bc4c3aa471f32f9a81ef206ee94cee5bd7f73",
"symbol": "BTC",
"name": "Bitcoin",
"enable": true,
"minimumWithdrawAmount": 0.0001,
"maxLength": 8,
"channels": [
{
"name": "BTC",
"enable": false,
"commission": 0.0005,
"addressList": [
{
"id": "9d80ac3ae93f8e48ec9bf9826bdc49913b68c4c3aa1b4b32a9ab4af40fbc9e9de2b22b2f",
"name": "123123123123",
"address": "123123123123"
}
]
}
]
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10028 | Withdraw disabled |
10037 | Invalid symbol |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
Create Withdraw
Create new withdraw for a symbol
- Method:
POST
- Parameters:
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
amount | FLOAT | YES |
address | STRING | YES |
secondParameter | STRING | NO (Only need secondary address identifier required, like XRP, XMR etc) |
node | STRING | YES |
- Request
v3/api/balance/create-withdraw
{
//Response
"code": "00000"
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
10026 | Identity verification required |
10028 | Withdraw disabled |
10029 | Invalid withdraw channel |
10030 | Amount is lower than minimum withdraw limit |
10031 | Insufficient balance |
10035 | Channel monthly limit exceeded |
10037 | Invalid symbol |
10051 | Requested action is not available for your country |
10054 | Step-1 verified user monthly withdraw limit exceeded |
10055 | Step-2 verified user monthly withdraw limit exceeded |
10063 | Withdraw address is not valid |
10064 | Extra parameter is not valid(Tag, Memo etc...) |
20000 | Authorization required |
90000 | Unexpected Error |
90001 | Invalid Request |
00000 | Success |
Get Last 5 Withdraw
Get last 5 withdraw actions
- Method:
GET
- Parameters:
NONE
- Request
v3/api/balance/withdraw-history'
{
//Response
"code": "00000",
"history": [
{
"id": "cdd0af3eee648a4eec93a88268dc49936b68c49aad4b4d32adab4fae56e6c29db1e47179",
"symbol": "BTC",
"maxLength": 8,
"amount":0.00213
"time": 1578943895994,
"state": 13,
"real":false,
"information": "",
"txid": "",
"explorer": "https://www.blockchain.com/en/explorer"
},
}
- Withdraw State Codes
Value | Meaning |
---|---|
11 | Pending |
13 | Resuming |
14 | Completed |
21 | Pending |
22 | Validating |
23 | Resuming |
24 | Completed |
98 | Rejected |
99 | Cancelled |
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
Get Deposit Addresses
Get available address and nodes for a symbol
- Method:
POST
- Parameters:
Parameter | Type | Required |
---|---|---|
symbol | STRING | YES |
- Request
v3/api/balance/deposit
{
//Response
"code": "00000",
"currency": {
"id": "cc8dfd30b230de18ec95a88438dc49c13868c49afd484832aaae1ea70fbb92cce6b12e72",
"symbol": "TRY",
"name": "Türk Lirası",
"enable": true,
"minimumDepositAmount": 10,
"maxLength": 2,
"channels": [
{
"name": "VAKIFBANK",
"address": "TR 34 0001 5001 5800 7308 8132 39",
"enable": true
}
]
}
}
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Mail not registered |
10026 | Identity verification required |
10027 | Deposit disabled |
10037 | Invalid symbol |
10051 | Requested action is not available for your country |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
Get Last 5 Deposit
Get last 5 deposit actions
- Method:
GET
- Parameters:
NONE
- Request
v3/api/balance/deposit-history'
{
//Response
"code": "00000",
"history": [
{
"id": "cdd0af3eee648a4eec93a88268dc49936b68c49aad4b4d32adab4fae56e6c29db1e47179",
"symbol": "BTC",
"maxLength": 8,
"totalConfirmation": 6,
"activeConfirmation": 3,
"amount":0.00213
"time": 1578943895994,
"state": 3,
"real":false,
"information": "",
"txid": "",
"explorer": "https://www.blockchain.com/en/explorer"
},
}
- Deposit State Codes
Value | Meaning |
---|---|
11 | Pending |
12 | Validating |
13 | Resuming |
14 | Completed |
- Possible Return Codes
Code | Meaning |
---|---|
10010 | Account not registered |
20000 | Authorization required |
90000 | Unexpected Error |
00000 | Success |
User Data Streams
Binding User Data Streams
- Binding user streams you need to
apiKey
andapiSecret
. - User data stream payloads are not guaranteed to be in order during heavy periods.
Starting User Data Stream
- Before use
USER_STREAMS
method you should hashedapiKey
with yourapiSecret
and namedsignature
. USER_STREAMS
methods payload has two parameters.Parameters:
Parameter | Type | Required |
---|---|---|
apiKey | STRING | YES |
signature | STRING | YES |
When you generate your signature
, using apiKey
and apiSecret
you can send USER_STREAMS
request.
- Signature Example
apiKey: Y0AhbfGmVA8FG7kPN6a9PB7UOpwnlvKG4bI5Jc57awpKv4uKN9UX114EPRTcKuhX apiSecret: 7v5TnUBX92lgKWlODJbRn3FIoriHNihB3PHFi591Do5ip9DLrCvx0bn9dHZKFZRS
[linux]$ echo -n "Y0AhbfGmVA8FG7kPN6a9PB7UOpwnlvKG4bI5Jc57awpKv4uKN9UX114EPRTcKuhX" | openssl dgst -sha256 -hmac "7v5TnUBX92lgKWlODJbRn3FIoriHNihB3PHFi591Do5ip9DLrCvx0bn9dHZKFZRS"
(stdin)= d36256b4002dc7d604e739651ef8506e0fbdc9c03dffe17124f32e0c8e63ff02
- Request
{ "method": "USER_STREAMS", "signature": "d36256b4002dc7d604e739651ef8506e0fbdc9c03dffe17124f32e0c8e63ff02", "apiKey": "Y0AhbfGmVA8FG7kPN6a9PB7UOpwnlvKG4bI5Jc57awpKv4uKN9UX114EPRTcKuhX" }
- Response
{ "method":"USER_STREAMS", "status":"success" }
If
status
is not equalsuccess
you can handle errormessage
payload parameter.Failed Response Example
{ "method":"USER_STREAMS", "status":"failed", "message":"Unauthorized Access" }
User Available Balance Update
- This updates period
REAL-TIME
- When successfully bind user data streams you can handle your available balance updates.
- When your available balance is changed we send a payload with
type
parameter valuebalanceUpdate
.
{
//Example balanceUpdate payload
"type":"balanceUpdate",
"symbol":"BTC",
"available": 0.01245
}
User Reserved Balance Update
- This updates period
REAL-TIME
- When successfully bind user data streams you can handle your reserved balance updates.
- When your reserved balance is changed we send a payload with
type
parameter valuereservedUpdate
.
{
//Example reservedUpdate payload
"type":"reservedUpdate",
"symbol":"BTC",
"reserved": 0.01245
}
User Order Update Messages
- This updates period
REAL-TIME
- When successfully bind user data streams you can handle your order updates.
- When you have a new order, order filled amounts changed or order cancelled we send a payload with
type
parameter valueorderUpdate
. - Order updates states you can handle with
status
parameters. - When message
status
isCANCELLED_ALL
. We don't send any more parameters. Because your all active orders cancelled. - When message
orderType
is not equal2
stopType
andtargetPrice
values is not important. This parameters only used whenorderType
is equal2
{
//Example orderUpdate payload
"type":"orderUpdate",
"order":{
"status": "NEW",
"market":"BTCUSDT",
"orderType": 0,
"side": 0,
"price": 7350,
"amount": 0.0001,
"filledAmount": 0,
"stopType": 0,
"targetPrice": 0,
"orderId": "6b11cf1414090a84bf7d6435763b92fd6a107b35cd150931af8c4d8e762e3b0b",
"time": 1578405048608
}
}
- Status Type Reference
Value |
---|
NEW |
PARTIALLY_FILLED |
FILLED |
CANCELLED |
CANCELLED_ALL |
- Order Type Reference
Value | Meaning |
---|---|
0 | LIMIT ORDER |
1 | MARKET ORDER |
2 | STOP LIMIT ORDER |
3 | FAST ORDER |
- Order Side Reference
Value | Meaning |
---|---|
0 | BUY ORDER |
1 | SELL ORDER |
- Stop Type Reference
Value | Meaning |
---|---|
0 | LESS THAN TARGET PRICE |
1 | GREATER THAN TARGET PRICE |
Error Codes
Code | Meaning |
---|---|
00000 | Success |
10010 | Account not registered |
10026 | Identity verification required |
10028 | Withdraw disabled |
10029 | Invalid withdraw channel |
10030 | Amount is lower than minimum withdraw limit |
10031 | Insufficient balance |
10035 | Channel monthly limit exceeded |
10037 | Invalid symbol |
10038 | Market disabled |
10039 | Order total is under limit |
10040 | Order amount is under limit |
10041 | Wash trading cancelled |
10042 | Market order not available |
10051 | Requested action is not available for your country |
10054 | Step-1 verified user monthly withdraw limit exceeded |
10055 | Step-2 verified user monthly withdraw limit exceeded |
10060 | Fast order not available |
10061 | Sell Price is not higher than %250 |
10062 | Buy Price is not lower than %40 |
20000 | Authorization required |
20001 | Invalid API key or secret |
20002 | Unauthorized IP |
20003 | Timestamp parameter is missing |
20004 | Timestamp difference limit exceeded |
20005 | Missing parameters |
20006 | Invalid Symbol |
20007 | Price must be float and higher than 0 |
20008 | Target must be float and higher than 0 |
20009 | Amount must be float and higher than 0 |
20010 | Address can not be empty |
20011 | API is not allowed to this action |
20012 | Total must be float and higher than 0 |
90000 | Unexpected Error |
90001 | Invalid Request |