MENU
LIVE SUPPORT
  • ISTANBUL12:56:03
  • NEW YORK7:48:06
  • LONDON12:47:17
  • MOSCOW15:47:33
  • TOKYO21:47:45

Trough ICRYPEX API, you can access market information, account movements and balance, enter market and limit orders, and cancel your orders.

TRADING COMMISSIONS BY VOLUME

API

API (APPLICATION PROGRAM INTERFACE)

It is the interface that enables the functions of an application to be accessed and used externally or remotely. API enables the application on a server to be accessed from different platforms and to produce transactions by answering the queries it asks. Icrypex provides access to the information you need with related API queries. In this way, you can buy and sell, and monitor the prices and volumes of cryptocurrencies without being connected to the Icrypex platform.

General API Information

  • Some endpoints will require an API Key.
  • The base endpoint is: https://api.icrypex.com
  • All endpoints return a JSON object.
  • Data is returned in ascending order. Oldest first, newest last.
  • All time and timestamp related fields are in milliseconds.

HTTP Return Codes

  • HTTP 4XX return codes are used for malformed requests; the issue is on the sender's side.
  • HTTP 403 return code is used when the WAF Limit (Web Application Firewall) has been violated.
  • HTTP 429 return code is used when breaking a request rate limit.
  • HTTP 5XX return codes are used for internal errors; the issue is on Server's side. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success.

Response fields description

Name Type Mandatory Description
code Number Yes Error Code,0 is success,else is fail
msg String Yes error message
timestamp Number Yes server timestamp
data Object No response data

General Information on Endpoints

  • For GET endpoints, parameters must be sent as a query string.
  • For POST endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded. You may mix parameters between both the query string and request body if you wish to do so.
  • Parameters may be sent in any order.
  • If a parameter sent in both the query string and request body, the body string parameter will be used.

LIMITS

General Info on Limits

  • The following intervalLetter values for headers:
    • SECOND => S
    • MINUTE => M
    • HOUR => H
    • DAY => D
  • intervalNum describes the amount of the interval. For example, intervalNum 5 with intervalLetter M means "Every 5 minutes".
  • A 429 will be returned when either rate limit is violated.

IP Limits

  • When a 429 is received, it's your obligation as an API to back off and not spam the API.
  • Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418).
  • IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days.
  • A Retry-After header is sent with a 418 or 429 responses and will give the number of seconds required to wait, in the case of a 418, to prevent a ban, or, in the case of a 429, until the ban is over.
  • The limits on the API are based on the IPs, not the API keys.

We recommend using the httpclient, webclient for getting data as much as possible, as this will not count to the request rate limit.

Order Rate Limits

  • The order rate limit is counted against each account.

Endpoint security type

  • Each endpoint has a security type that determines the how you will interact with it. This is stated next to the NAME of the endpoint.

    • If no security type is stated, assume the security type is NONE.
  • API-keys are passed into the Rest API via the x-access-token header or in query string via via the api_key parameter.
  • API-keys are case sensitive.
  • API-keys can be configured to only access certain types of secure endpoints.
Security Type Description
NONE Endpoint can be accessed freely.
API KEY Endpoint requires sending a valid API-Key.

Timing security

  • A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent.
  • An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000.
  • The logic is as follows:
    if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow)
    {
        // process request
    }
    else
    {
        // reject request
    }
                                
  • Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server.

It is recommended to use a small recvWindow of 5000 or less! The max cannot go beyond 60,000!

SIGNED Endpoint Examples for POST /open/v1/orders

Here is a step-by-step example of how to send a vaild signed payload.

Key Value
api_key cfDC92B191b9B3Ca3D842Ae0e01108CBKI6BqEW6xr4NrPus3hoZ9Ze9YrmWwPFV

Parameter Value
symbol BTC / USDT
side 1
type 1
quantity '0.16'
price '7500'
recvWindow 5000
timestamp 1581720670624

Example 1: As a request body

  • requestBody:symbol=BTC/USDT&side=1&type=1&quantity=0.16&price=7500&timestamp=1581720670624&recvWindow=5000&api_key=cfDC92B191b9B3Ca3D842Ae0e01108CBKI6BqEW6xr4NrPus3hoZ9Ze9YrmWwPFV
    - api_key can be send in x-access-token request header instead of query string too.

Example 2: Mixed query string and request body

  • queryString: symbol=BTC / USDT&side=1&type=1
  • requestBody: quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559
  • requestBody: symbol=BTC / USDT&side=1&type=1quantity=0.16&price=7500×tamp=1581720670624&recvWindow=5000

Public API Definitions

Terminology

  • base asset refers to the asset that is the quantity of a symbol.
  • quote asset refers to the asset that is the price of a symbol.

ENUM definitions

Order status (status):
  • 1 NEW
  • 2 FILLED
  • 3 CANCELED
  • 4 PARTIALLY FILLED
  • 5 REJECTED
  • 6 EXPIRED
Order types (orderTypes, type):
  • 1 LIMIT
  • 2 MARKET
  • 3 TAKE PROFIT
  • 4 STOP LOSS
Order side (side):
  • 1 BUY
  • 2 SELL

General endpoints

Check server time

GET /open/v1/common/time

Test connectivity to the Rest API and get the current server time.

Parameters: NONE

Response:
{
    "code": 0,
    "msg": "success",
    "timestamp": 1572265137927
}
                    

Get all Supported Trading Symbol

GET /open/v1/common/symbols

This endpoint returns all Exchange's supported trading symbol.

Parameters: NONE

Response:
{
    "code": 0,
    "msg": "success",
    "data": {
        "list": [
            {
                "symbol": "ADA/BNB",
                "baseAsset": "ADA",
                "basePrecision": 8,
                "quoteAsset": "BNB",
                "quotePrecision": 8,
                "quotePrecisionShow": 8,
                "status": 1 // 0: inactive , 1: active
            }
        ]
    },
    "timestamp": 1571921637091
}
                    

Market Data endpoints

Order book

GET /open/v1/market/depth

Parameters:

Name Type Mandatory Description
symbol STRING YES
limit INT NO Default 100; max 5000. Valid limits:[5, 10, 20, 50, 100, 500]

Response:
{
    "code": 0,
    "msg": "success",
    "data": {
        "lastUpdateId": 1027024,
        "bids": [
            "4.00000000",
            "431.00000000"
        ],
        "asks": [
            "4.00000200",
            "12.00000000"
        ]
    },
    "timestamp": 1571921637091
}
                    

Recent trades list

GET /open/v1/market/trades

Get recent trades (up to last 500).

Parameters:

Name Type Mandatory Description
symbol STRING YES
fromId LONG NO ID to get trades from INCLUSIVE.
limit INT NO Default 500; max 1000.
Response:
{
    "code": 0,
    "msg": "success",
    "data": [
        {
            "id": 28457,
            "price": "4.00000100",
            "qty": "12.00000000",
            "time": 1499865549590,
            "isBuyerMaker": true,
            "isBestMatch": true
        }
    ],
    "timestamp": 1571921637091
}
                    

Compressed/Aggregate trades list

GET /open/v1/market/agg-trades

Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.

Parameters:

Name Type Mandatory Description
symbol STRING YES
fromId LONG NO ID to get aggregate trades from INCLUSIVE.
startTime LONG NO Timestamp in ms to get aggregate trades from INCLUSIVE.
endTime LONG NO Timestamp in ms to get aggregate trades until INCLUSIVE.
limit INT NO Default 500; max 1000.
  • If fromId, startTime, and endTime are not sent, the most recent aggregate trades will be returned.

Response:
{
    "code": 0,
    "msg": "success",
    "data": [
        {
            "a": 26129,
            "p": "0.01633102",
            "q": "4.70443515",
            "f": 27781,
            "l": 27781,
            "T": 1498793709153,
            "m": true,
            "M": true
        }
    ],
    "timestamp": 1571921637091
}
                    

Account endpoints

New order (SIGNED)

POST /open/v1/orders  (HMAC SHA256)

Send in a new order.

Parameters:

Name Type Mandatory Description
symbol STRING YES
side ENUM YES 1 - Buy, 2 - Sell
type ENUM YES 1 - Limit, 2 - Market, 3 - Stop Loss, 4 - Take Profit
quantity STRING NO
quoteOrderQty STRING NO
price STRING NO
clientId STRING NO Client's custom ID for the order, Server does not check it's uniqueness. Automatically generated if not sent.
stopPrice STRING NO Used with STOP LOSS, TAKE PROFIT
icebergQty STRING NO For future use.
recvWindow LONG NO The value cannot be greater than 60000
timestamp LONG YES

Additional mandatory parameters based on type:

Type Additional mandatory parameters
1 quantity, price
2 quantity, quoteOrderQty (sell) or quantity (buy)
3 quantity, stopPrice
4 quantity, stopPrice

Other info:

  • STOP LOSS and TAKE PROFIT will execute a MARKET order when the stopPrice is reached.
  • MARKET orders using quantity specifies how much a user wants to buy or sell based on the market price.
  • MARKET orders using quoteOrderQty specifies the amount the user wants to spend (when buying) of the quote asset; the correct quantity will be determined based on the market liquidity and quoteOrderQty.

Trigger order price rules against market price for both MARKET and LIMIT versions:

  • Price above market price: STOP LOSS BUY, TAKE PROFIT SELL
  • Price below market price: STOP LOSS SELL, TAKE PROFIT BUY

Response:
{
    "code": 0,
    "message": "success",
    "data": {
        "orderId": "4",
        "createTime": 1550130502385
    },
    "timestamp": 1550130502489
}
                    

Query order (SIGNED)

GET /open/v1/orders/detail (HMAC SHA256)

Check an order's status.

Parameters:

Name Type Mandatory Description
orderId LONG YES
recvWindow LONG NO The value cannot be greater than 60000
timestamp LONG YES

Response:
{
    "code": 0,
    "message": "success",
    "data": {
        "orderId": 4,
        "orderListId": -1,
        "clientId": "myOrder1",
        "symbol": "BTC/USDT",
        "side": 1,
        "type": 1,
        "price": 1,
        "status": 0 , //Terminology > ENUM definitions > Order status (status)
        "origQty": 10.88,
        "origQuoteQty": 0,
        "executedQty": 0, // for future use
        "executedPrice": 0, // for future use
        "executedQuoteQty": 0, // for future use
        "createTime": 1550130502000
    },
    "timestamp": 1550130554182
}
                    

Cancel order (SIGNED)

POST /open/v1/orders/cancel  (HMAC SHA256)

Cancel an active order.

Parameters:

Name Type Mandatory Description
orderId LONG YES
recvWindow LONG NO The value cannot be greater than 60000
timestamp LONG YES

Response:
{
    "code": 0,
    "message": "success",
    "data": {
        "orderId": 4,
        "orderListId": -1,
        "clientId": "myOrder1",
        "symbol": "BTC/USDT",
        "side": 1,
        "type": 1,
        "price": 1,
        "status": 0, // Terminology > ENUM definitions > Order status (status)
        "origQty": 10.88,
        "origQuoteQty": 0,
        "executedQty": 0, // for future use
        "executedPrice": 0, // for future use
        "executedQuoteQty": 0, // for future use
        "createTime": 1550130502000
        },
    "timestamp": 1550130554182
}
                    

All orders (SIGNED)

GET /open/v1/orders (HMAC SHA256)

Get all account orders; active, canceled, or filled.

Parameters:

Name Type Mandatory Description
symbol STRING YES
type ENUM NO 1 - Open, 2 - History
side ENUM NO
startTime LONG NO
endTime LONG NO
fromId String NO For future use.
direct ENUM NO For future use.
limit INT NO Default 500; max 1000.
recvWindow LONG NO The value cannot be greater than 60000
timestamp LONG YES
Response:
{
    "code": 0,
    "msg": "success",
    "data": {
        "list": [
            {
                "orderId": "21",
                "clientId": "uuid",
                "symbol": "ADA/USDT",
                "symbolType": 1,
                "side": 1,
                "type": 1,
                "price": "0.1",
                "origQty": "10",
                "origQuoteQty": "1",
                "executedQty": "0", // for future use
                "executedPrice": "0", // for future use
                "executedQuoteQty": "0", // for future use
                "timeInForce": 1,
                "stopPrice": "0.0000000000000000",
                "icebergQty": "0.0000000000000000", // for future use
                "status": 0, //Terminology > ENUM definitions > Order status (status)
                "isWorking": 0,
                "createTime": 1572692016811
            }
        ]
    },
    "timestamp": 1572860756458
}
                    

Account information (SIGNED)

GET /open/v1/account/spot (HMAC SHA256)

Get current account information.

Parameters:

Name Type Mandatory Description
recvWindow LONG NO The value cannot be greater than 60000
timestamp LONG YES
Response:
{
    "code": 0,
    "msg": "success",
    "data": {
        "list": [
            {
                "makerCommission": "10.00000000",
                "takerCommission": "10.00000000",
                "buyerCommission": "0.00000000",
                "sellerCommission": "0.00000000",
                "asset": "ADA",
                "free": "272.5550000000000000",
                "locked": "3.0000000000000000"
            }
        ]
    },
    "timestamp": 1572514387348
}
                    

Account Asset information (SIGNED)

GET /open/v1/account/spot/asset (HMAC SHA256)

Get current account information for a specific asset.

Parameters:

Name Type Mandatory Description
asset STRING YES
recvWindow LONG NO The value cannot be greater than 60000
timestamp LONG YES
Response:
{
    "code": 0,
    "msg": "success",
    "data": {
        "asset": "ADA",
        "free": "272.5550000000000000",
        "locked": "3.0000000000000000"
    },
    "timestamp": 1572514387348
}
                    

Account trade list (SIGNED)

GET /open/v1/orders/trades  (HMAC SHA256)

Get trades for a specific account and symbol.

Parameters:

Name Type Mandatory Description
symbol STRING YES
orderId String NO
startTime LONG NO
endTime LONG NO
fromId LONG NO TradeId to fetch from. Default gets most recent trades.
direct ENUM NO For future use.
limit INT NO Default 500; max 1000.
recvWindow LONG NO The value cannot be greater than 60000
timestamp LONG YES

Notes:

  • if field "fromId" is defined, this field "direct" becomes mandatory.
Response:
{
    "code": 0,
    "msg": "success",
    "data": {
        "list": [
            {
                "tradeId": "3",
                "orderId": "2",
                "symbol": "ADA / USDT",
                "price": "0.04398",
                "qty": "250",
                "quoteQty": "10.995",
                "commission": "0.25",
                "commissionAsset": "ADA",
                "isBuyer": 1,
                "isMaker": 0,
                "isBestMatch": 1,
                "time": "1572920872276"
            }
        ]
    },
    "timestamp": 1573723498893
}
                    

Sample Codes

JAVA CODE

  • 1. ASYNC CALL

    import java.net.URI;
    import java.net.URISyntaxException;
    import java.net.http.HttpClient;
    import java.net.http.HttpClient.Redirect;
    import java.net.http.HttpClient.Version;
    import java.net.http.HttpRequest;
    import java.net.http.HttpResponse;
    import java.net.http.HttpResponse.BodyHandlers;
    public class HttpClientApp {
    public void invoke() throws URISyntaxException {
    
      HttpClient client = HttpClient.newBuilder()
          .version(Version.HTTP_2)
          .followRedirects(Redirect.NORMAL)
          .build();
    
      HttpRequest request = HttpRequest.newBuilder()
         .uri(new URI("https://customerapi/open/v1/orders/list?symbol=BTC/TRY&type=1×tamp=1639842985658&api_key=cfDC92B191b9B1223Ae0e01108CBKI6Bqewr26xr4NrPusef23d49Ze9YrmWwPFV"))
         .GET()
         .timeout(Duration.ofSeconds(10))
         .build();
    
    
      client.sendAsync(request, BodyHandlers.ofString())
        .thenApply(HttpResponse::body)
        .thenAccept(System.out::println)
        .join();
    }
    }
                                
  • 2. SYNC CALL

    public class HttpClientApp {
    public void invokePost() {
    
      try {
       String requestBody = prepareRequest();
       HttpClient client = HttpClient.newHttpClient();
       HttpRequest request = HttpRequest
         .newBuilder()
         .uri(URI.create("https://customerapi/open/v1/orders?symbol=BTC/TRY&type=2&side=1&quantity=0.01×tamp=1639842985658&api_key=cfDC92B191b9B1223Ae0e01108CBKI6Bqewr26xr4NrPusef23d49Ze9YrmWwPFV"))
         .POST(HttpRequest.BodyPublishers.ofString(requestBody))
         .header("Accept", "application/json")
         .build();
       HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
       System.out.println(response.body());
      } catch (IOException | InterruptedException e) {
       e.printStackTrace();
      }
    }
                                

C#.NET CODE

  • 1. Use HttpClient

    using System;
    using System.Net.Http;
    using System.Net.Http.Headers;
    namespace ConsoleProgram
    {
        public class Class1
        {
            private const string URL = "https://customerapi/open/v1/orders";
            private string urlParameters = "?symbol=BTC/TRY&type=2&side=1&quantity=0.01×tamp=1639842985658&api_key=cfDC92B191b9B1223Ae0e01108CBKI6Bqewr26xr4NrPusef23d49Ze9YrmWwPFV";
            static void Main(string[] args)
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(URL);
                // Add an Accept header for JSON format.
                client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));
                // List data response.
                HttpResponseMessage response = client.GetAsync(urlParameters).Result;  // Blocking call! Program will wait here until a response is received or a timeout occurs.
                if (response.IsSuccessStatusCode)
                {
                    // Parse the response body.
                    var dataObjects = response.Content.ReadAsAsync<string>().Result;  //Make sure to add a reference to System.Net.Http.Formatting.dll
    
                }
                else
                {
                    Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
                }
                // Make any other calls using HttpClient here.
                // Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
                client.Dispose();
            }
        }
    }
                                
  • Use WebClient

    // Public API : Get order book
     using (WebClient wc = new WebClient())
    {
    
         try
         {
             string url = https://customerapi/open/v1/market/depth?symbol=BTC/TRY;
             string result = wc.DownloadString(url);
                                    <!--returns =>
                                       {"code":0,"msg":"success",
                                       "Data":{"lastupdateid":1639776794754,
                                       "bids":
                                       [
                                           {"price":"661858.48000000","amount":"0.00500000"},
                                           {"price":"661858.48000000","amount":"0.01000000"}
                                       ],
                                       "asks":
                                       [
                                           {"price":"24400.00000000","amount":"0.01000000"},
                                           {"price":"24400.00000000","amount":"0.01000000"}
                                       ]
                                       },
                                       "timestamp":1639776794856
                                       }-->
         }
         catch (Exception ex)
         {
             // Error
         }
    }
     // Private API (Requires api_key in query string or in request header): Get open orders
    using (WebClient wc = new WebClient())
    {
         try
         {
             string url = "https://customerapi/open/v1/orders/list?symbol=BTC/TRY&type=1×tamp=1639842985658&api_key=cfDC92B191b9B1223Ae0e01108CBKI6Bqewr26xr4NrPusef23d49Ze9YrmWwPFV";
             //api_key parameter can be sent in <x-access-token> request header too
             string result = wc.DownloadString(url);
             //returns =>
                                    <!--{"code": 0,"msg": "success
                                        data":{"list":
                                        [
                                            {
                                            "orderId": "119",
                                            "clientId": "174832",
                                            "symbol": "BTC / TRY",
                                            "symbolType": 1,
                                            "side": 1,
                                            "type": 1,
                                            "price": "1.123",
                                            "origQty": "10",
                                            "origQuoteQty": "1",
                                            "executedQty": "0",
                                            "executedPrice": "0",
                                            "executedQuoteQty": "0",
                                            "timeInForce": 0,
                                            "stopPrice": "0.0000000000000000",
                                            "icebergQty": "0.0000000000000000",
                                            "status": 0,
                                            "isWorking": 0,
                                            "createTime": 1572692016811
                                            }
                                        ]
                                    },
                                    "timestamp": 1572860756458
                                    }-->
             }
         catch (Exception ex)
         {
         // Error
         }
    }
    // Private API (Requires api_key in query string or in request header) : Insert new market order
    using (WebClient wc = new WebClient())
    {
    try
    {
         string url = "https://customerapi/open/v1/orders?symbol=BTC/TRY&type=2&side=1&quantity=0.01×tamp=1639842985658&api_key=cfDC92B191b9B1223Ae0e01108CBKI6Bqewr26xr4NrPusef23d49Ze9YrmWwPFV";
         //api_key parameter can be sent in <x-access-token> request header too.
         string result = wc.DownloadString(url);
         //returns =>
                                        <!--{"code": 0,"msg": "success",
                                            "data":
                                            {
                                                "orderId": "1",
                                                "createTime": 1572692016811
                                            },
                                            "timestamp": 1572860756458
                                        }-->
         }
         catch (Exception ex)
         {
         // Error
         }
    }
     // Private API (Requires api_key in query string  ror in equest header): Delete order
    using (WebClient wc = new WebClient())
    {
    try
    {
         string url = https://customerapi/open/v1/orders/cancel?orderid=119×tamp=1639842985658&api_key=cfDC92B191b9B1223Ae0e01108CBKI6Bqewr26xr4NrPusef23d49Ze9YrmWwPFV;
         //api_key parameter can be sent in <x-access-token> request header too.
         string result = wc.DownloadString(url);
         //returns =>
                                            <!--{"code": 0,"msg": "success",
                                                "data":
                                                {
                                                    "orderId": 119,
                                                    "orderListId": -1,
                                                    "clientId": "14522",
                                                    "symbol": "BTC / TRY",
                                                    "side": 1,
                                                    "type": 1,
                                                    "price": 12,454,
                                                    "status": 0,
                                                    "origQty": 10.88,
                                                    "origQuoteQty": 0,
                                                    "executedQty": 0,
                                                    "executedPrice": 0,
                                                    "executedQuoteQty": 0,
                                                    "createTime": 1550130502000
                                                },
                                                "timestamp": 1572860756458
                                            }-->
         }
         catch (Exception ex)
         {
         // Error
         }
    }
                                

WE SUPPORT TURKISH SPORTS

We support Turkish sports with our sponsorships of Beşiktaş Icrypex Basketball Team, 1907 Fenerbahçe Disabled Stars, Altay Sports Club and Göztepe Sports Club. ICRYPEX will continue to stand by Turkish sports.

  • Beşiktaş
  • Altay
  • Göztepe
  • Fenerbahçe