Trough ICRYPEX API, you can access market information, account movements and balance, enter market and limit orders, and cancel your orders.
Trough ICRYPEX API, you can access market information, account movements and balance, enter market and limit orders, and cancel your orders.
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.
4XX
return codes are used for malformed requests; the issue is on the sender's side.403
return code is used when the WAF Limit (Web Application Firewall) has been violated.429
return code is used when breaking a request rate limit.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.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 |
GET,POST
endpoints, parameters must be sent as a query string
. intervalLetter
values for headers:
intervalNum
describes the amount of the interval. For example, intervalNum
5 with intervalLetter
M means "Every 5 minutes".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. We recommend using the httpclient, webclient for getting data as much as possible, as this will not count to the request rate limit.
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.
x-access-token
header or in query string via via the api_key
parameter. Security Type | Description |
---|---|
NONE | Endpoint can be accessed freely. |
API KEY | Endpoint requires sending a valid API-Key. |
SIGNED
endpoint also requires a parameter, timestamp
, to be sent which should be the millisecond timestamp of when the request was created and sent.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.if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) { // process request } else { // reject request }
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!
Here is a step-by-step example of how to send a vaild signed payload.
Key | Value |
---|---|
api_key | cfDC92B191b9B3Ca3D842Ae0e01108CBKI6BqEW6xr4NrPus3hoZ9Ze9YrmWwPFV |
Parameter | Value | |
---|---|---|
symbol | BTC/TRY | |
side | 1 | 1 - Buy 2 - Sell |
type | 1 | 1 - Limit, 2 - Market, 3 - Take Profit, 4 - Stop Loss |
quantity | '0.16' | |
price | '7500' | |
recvWindow | 5000 | |
timestamp | 1581720670624 |
x-access-token
request header instead of query string too.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.GET /open/v1/common/time
Test connectivity to the Rest API and get the current server time.
Parameters: NONE
{ "code": 0, "msg": "success", "timestamp": 1572265137927 }
GET /open/v1/common/symbols
This endpoint returns all Exchange's supported trading symbol.
Parameters: NONE
{ "code": 0, "msg": "success", "data": { "list": [ { "symbol": "BTC/TRY", "baseAsset": "",BTC "baseAssetname": "Bitcoin", "basePrecision": 8, "quoteAsset": "TRY", "quatoAssetname": "Turkish Lira", "quotePrecision": 8, "quotePrecisionShow": 8, "status": 1 // 0: inactive , 1: active, "description": "Bitcoin, eşten eşe ağ teknolojisini kullanarak herhangi..." } ] }, "timestamp": 1571921637091 }
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] |
{ "code": 0, "msg": "success", "data": { "lastUpdateId": 1027024, "bids": [ "price": "4.00000000", "amount": "431.00000000" ], "asks": [ "price":"4.00000200", "amount":"12.00000000" ] }, "timestamp": 1571921637091 }
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. |
{ "code": 0, "msg": "success", "data": [ { "id": 238457, // transaction id "price": "4.00000100", "qty": "12.00000000", // Quantity "time": 1499865549590, "isBuyerMaker": true, "isBestMatch": true } ], "timestamp": 1571921637091 }
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. |
{ "code": 0, "msg": "success", "data": [ { "a": 261429, // transaction id "p": "0.01633102", // Price "q": "4.70443515", // Quantity "f": 27781, // first fill order id "l": 27781, // last fill order id "T": 1498793709153, // Fill Datetime "m": true, // is Maker "M": true } ], "timestamp": 1571921637091 }
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 - Take Profit, 4 - Stop Loss |
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:
STOP LOSS
BUY
, TAKE PROFIT
SELL
STOP LOSS
SELL
, TAKE PROFIT
BUY
{ "code": 0, "message": "success", "data": { "orderId": "452367", "createTime": 1550130502385 }, "timestamp": 1550130502489 }
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 |
{ "code": 0, "message": "success", "data": { "orderId": 456123, "orderListId": -1, // Future use "clientId": "142334", // Customer Id "symbol": "BTC/TRY", "side": 1, // Buy : 1 - Sell : 2 "type": 1, // 1 - Limit, 2 - Market, 3 - Take Profit, 4 - Stop Loss "price": 110, "status": 0 , //Terminology > ENUM definitions > Order status (status) "origQty": 10.88, // Base Quantity "origQuoteQty": 0, // Quato Quantity "executedQty": 0, // for future use "executedPrice": 0, // for future use "executedQuoteQty": 0, // for future use "createTime": 1550130502000 }, "timestamp": 1550130554182 }
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 |
{ "code": 0, "message": "success", "data": { "orderId": 456712, "orderListId": -1, "clientId": "myOrder1", "symbol": "BTC/TRY", "side": 1, // Buy : 1 - Sell : 2 "type": 1, // 1 - Limit, 2 - Market, 3 - Take Profit, 4 - Stop Loss "price": 1, "status": 0, // Terminology > ENUM definitions > Order status (status) "origQty": 10.88, // Base Quantity "origQuoteQty": 0, // Quato Quantity "executedQty": 0, // for future use "executedPrice": 0, // for future use "executedQuoteQty": 0, // for future use "createTime": 1550130502000 }, "timestamp": 1550130554182 }
GET /open/v1/orders/list (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 |
{ "code": 0, "msg": "success", "data": { "list": [ { "orderId": "213456", "clientId": "13242", // Customer ID "symbol": "BTC/TRY", "symbolType": 1, // for future use "side": 1, // Buy : 1 - Sell : 2 "type": 1, // 1 - Limit, 2 - Market, 3 - Take Profit, 4 - Stop Loss "price": "0.1", "origQty": "10", // Base Quantity "origQuoteQty": "1", // Quato Quantity "executedQty": "0", // for future use "executedPrice": "0", // for future use "executedQuoteQty": "0", // for future use "timeInForce": 1, // for future use "stopPrice": "0.0000000000000000", // Price for Stop Loss or Take Profit Order Tpes "icebergQty": "0.0000000000000000", // for future use "status": 0, //Terminology > ENUM definitions > Order status (status) "isWorking": 0, "createTime": 1572692016811 } ] }, "timestamp": 1572860756458 }
GET /open/v1/openOrders (HMAC SHA256)
Get account all or symbol based open orders.
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | |
recvWindow | LONG | NO | The value cannot be greater than 60000
|
timestamp | LONG | YES |
{ "code": 0, "msg": "success", "data": { "list": [ { "orderId": "213456", "clientId": "13453", // Customer ID "symbol": "BTC/TRY", "symbolType": 1, // for future use "side": 1,/ / Buy : 1 - Sell : 2 "type": 1,// 1 - Limit, 2 - Market, 3 - Take Profit, 4 - Stop Loss "price": "0.1", "origQty": "10", // Base Quantity "origQuoteQty": "1",/ / Quato Quantity "executedQty": "0", // for future use "executedPrice": "0", // for future use "executedQuoteQty": "0", // for future use "timeInForce": 1, // for future use "stopPrice": "0.0000000000000000", // Price for Stop Loss or Take Profit Order Tpes "icebergQty": "0.0000000000000000", // for future use "status": 0, //Terminology > ENUM definitions > Order status (status) "isWorking": 0, "createTime": 1572692016811 } ] }, "timestamp": 1572860756458 }
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 |
{ "code": 0, "msg": "success", "data": { "list": [ { "makerCommission": "10.00000000", "takerCommission": "10.00000000", "buyerCommission": "0.00000000", "sellerCommission": "0.00000000", "asset": "BTC", "free": "0.5550000000000000", "locked": "0000000000000000" } ] }, "timestamp": 1572514387348 }
GET /open/v1/accountSnapshot (HMAC SHA256)
Get time based account information.
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
type | STRING | NO | Currently support only SPOT |
startTime | LONG | NO | |
endTime | LONG | NO | |
recvWindow | LONG | NO | The value cannot be greater than 60000
|
timestamp | LONG | YES |
{ "code": 0, "msg": "success", "snapShotVos":[{ "balances": [ { "asset": "BTC", "free": "0.5550000000000000", "locked": "0000000000000000" }, { "asset": "LTC", "free": "200.430000000000000", "locked": "0000000000000000" }]}] "type": "SPOT", "timestamp": 1572514387348 }
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 |
{ "code": 0, "msg": "success", "data": { "asset": "BTC", "free": "0.5550000000000000", "locked": "0000000000000000" }, "timestamp": 1572514387348 }
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:
{ "code": 0, "msg": "success", "data": { "list": [ { "tradeId": "X-241568", "orderId": "241568", "symbol": "BTC/TRY", "price": "0.04398", "qty": "0.0001", "quoteQty": "520.989", "commission": "0.000025", "commissionAsset": "BTC", "isBuyer": 1, "isMaker": 0, "isBestMatch": 1, "time": "1572920872276" } ] }, "timestamp": 1573723498893 }
is:wss://stream-cloud.icrypex.com
and after connection is succeeded, with URLs below, a blank data must be sent to access streaming/ws?<streamName>(example; wss://stream-cloud.icrypex.com/ws?btc/[email protected])
/stream?streams=<streamName1>\<streamName2>\<streamName3>(example; wss://stream-cloud.icrypex.com/stream?streams=btc/[email protected]\ltc/[email protected])
{"stream":"<streamName>","data":<rawPayload>}
stream-cloud.icrypex.com
is only valid for 24 hours; expect to be disconnected at the 24 hour markid
used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth.result
received is null
this means the request sent was a success for non-query requests (e.g. Subscribing/Unsubscribing).{ "method": "SUBSCRIBE", "params": [ "btc/[email protected]", "btc/[email protected]" ], "id": 1 }
{ "result": null, "id": 1 }
{ "method": "UNSUBSCRIBE", "params": [ "btc/[email protected]" ], "id": 312 }
{ "result": null, "id": 312 }
{ "method": "LIST_SUBSCRIPTIONS", "id": 3 }
{ "result": [ "btc/[email protected]" ], "id": 3 }
Currently, the only property can be set is to set whether combined stream payloads are enabled are not. The combined
property is set to false
when connecting using /ws/
("raw streams") and true
when connecting using /stream/
.
{ "method": "SET_PROPERTY", "params": [ "combined", true ], "id": 5 }
{ "result": null, "id": 5 }
{ "method": "GET_PROPERTY", "params": [ "combined" ], "id": 2 }
{ "result": true, // Indicates that combined is set to true. "id": 2 }
Error Message |
---|
{"code": 0, "msg": "Unknown property"} |
{"code": 1, "msg": "Invalid value type: expected Boolean"} |
{"code": 2, "msg": "Invalid request: property name must be a string"} |
{"code": 2, "msg": "Invalid request: request ID must be an unsigned integer"} |
{"code": 2, "msg": "Invalid request: unknown variant of SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS, SET_PROPERTY, GET_ PROPERTY"} Possible typo in the provided method or provided method was neither of the expected values |
{"code": 2, "msg": "Invalid request: too many parameters"} |
{"code": 2, "msg": "Invalid request: property name must be a string"} |
{"code": 2, "msg": "Invalid request: missing field method "} |
{"code":3,"msg":"Invalid JSON format "} |
The Aggregate Trade Streams push trade information that is aggregated for a single taker order.
Stream Name: <symbol>@aggTrade
Update Speed: Real-time
{ "e": "aggTrade", // Event type "E": 123456789, // Event time "s": "BTC/TRY", // Symbol "a": 123445, // Aggregate trade ID "p": "0.001", // Price "q": "100", // Quantity "f": 100, // First trade ID "l": 105, // Last trade ID "T": 123456785, // Trade time "m": true, // Is the buyer the market maker? "M": true // Ignore }
The Trade Streams push raw trade information; each trade has a unique buyer and seller.
Stream Name: <symbol>@trade
Update Speed: Real-time
{ "e": "trade", // Event type "E": 123456789, // Event time "s": "BTC/TRY", // Symbol "t": 12345, // Trade ID "p": "0.001", // Price "q": "100", // Quantity "b": 88, // Buyer order ID "a": 50, // Seller order ID "T": 123456785, // Trade time "m": true, // Is the buyer the market maker? "M": true // Ignore }
24hr rolling window mini-ticker statistics. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs.
Stream Name: <symbol>@miniTicker
Update Speed: 1000ms
{ "e": "24hrMiniTicker", // Event type "E": 123456789, // Event time "s": "BTC/TRY", // Symbol "c": "0.0025", // Close price "o": "0.0010", // Open price "h": "0.0025", // High price "l": "0.0010", // Low price "v": "10000", // Total traded base asset volume "q": "18" // Total traded quote asset volume }
24hr rolling window mini-ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array.
Stream Name: [email protected]
Update Speed: 1000ms
[ { "e": "24hrMiniTicker", // Event type "E": 123456789, // Event time "s": "BTC/TRY", // Symbol "c": "0.0025", // Close price "o": "0.0010", // Open price "h": "0.0025", // High price "l": "0.0010", // Low price "v": "10000", // Total traded base asset volume "q": "18" // Total traded quote asset volume } ]
24hr rolling window ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array.
Stream Name: <symbol>@Ticker
Update Speed: 2000ms
{ "e": "24hrTicker", // Event type "E": 123456789, // Event time "s": "BNBBTC", // Symbol "p": "0.0015", // Price change "P": "250.00", // Price change percent "w": "0.0018", // Weighted average price "x": "0.0009", // First trade(F)-1 price (first trade before the 24hr rolling window) "c": "0.0025", // Last price "Q": "10", // Last quantity "b": "0.0024", // Best bid price "B": "10", // Best bid quantity "a": "0.0026", // Best ask price "A": "100", // Best ask quantity "o": "0.0010", // Open price "h": "0.0025", // High price "l": "0.0010", // Low price "v": "10000", // Total traded base asset volume "q": "18", // Total traded quote asset volume "O": 0, // Statistics open time "C": 86400000, // Statistics close time "F": 0, // First trade ID "L": 18150, // Last trade Id "n": 18151 // Total number of trades }
Best price/qty on the order book for a symbol or symbols..
Stream Name: <symbol>@bookTicker
Update Speed: 500ms
{ "u": 823453, // Last Update id "s": "BTC/TRY", // Symbol "b": "0.0025", // Best bid price "B": "0.0010", // Best bid Amount "a": "0.0025", // Best ask price "A": "0.0010", // Best ask amount }
Stream Name: <symbol>@depth
Update Speed: 1000ms
{ "lastUpdateId": 160, // Last update ID "bids": [ // Bids to be updated [ "Price": "0.0024", // Price level to be updated "Amount": "10" // Quantity ] ], "asks": [ // Asks to be updated [ "Price": "0.0026", // Price level to be updated "Amount": "100" // Quantity ] ] }
Order book price and quantity depth updates used to locally manage an order book.
Stream Name: <symbol>@depth
Update Speed: 200ms
{ "e": "depthUpdate", // Event type "E": 123456789, // Event time "s": "BTC/TRY", // Symbol "U": 157, // First update ID in event "u": 160, // Final update ID in event "b": [ // Bids to be updated [ "Price": "0.0024", // Price level to be updated "Amount": "10" // Quantity ] ], "a": [ // Asks to be updated [ "Price": "0.0026", // Price level to be updated "Amount": "100" // Quantity ] ] }
wss://stream-cloud.icrypex.com/ws?btc/[email protected]
.https://api.icrypex.com/open/v1/market/depth?symbol=BTC/TRY&limit=1000
.u
is <= lastUpdateId
in the snapshot.U <= lastUpdateId+1
AND u >= lastUpdateId+1
.U
should be equal to the previous event's u+1
.using WebSocketSharp; WebSocket ws = null; private void WSSConenct() { try { // for subscribe trades first connect to wss://stream-cloud.icrypex.com and then send {"method": "SUBSCRIBE","params":["btc/[email protected]","ltc/[email protected]"],"id": 2} // for subscribe last orders first connect to wss://stream-cloud.icrypex.com and then send{ "method": "SUBSCRIBE","params":["btc/[email protected]","ltc/[email protected]"],"id": 2} // for subscribe aggregate trades first connect to wss://stream-cloud.icrypex.com and then {"method": "SUBSCRIBE","params":["btc/[email protected]","ltc/[email protected]"],"id": 2} // for subscribe miniticker first connect to wss://stream-cloud.icrypex.com and then { "method": "SUBSCRIBE","params":["btc/[email protected]","ltc/[email protected]"],"id": 2} // for subscribe diff miniticker first connect to wss://stream-cloud.icrypex.com and then { "method": "SUBSCRIBE","params":["[email protected]"],"id": 2} // for single stream connect with total URL (for example; wss://stream-cloud.icrypex.com/ws?btc/[email protected]) and then send dummy data to start stream // for combined stream connect with total URL (for example; wss://stream-cloud.icrypex.com/stream?streams=btc/[email protected]\ltc/[email protected]\eth/[email protected]) and then send dummy data to start stream string ConnectionURL = "wss://stream-cloud.icrypex.com/ws?btc/[email protected]"; ws = new WebSocket(ConnectionURI); ws.OnMessage += WebSocketDataReceived; ws.OnOpen += WebSocketOpened; ws.OnError += WebSocketError; ws.OnClose += WebSocketClose; ws.Connect(); if (ws != null) ws.Send(""); } catch (Exception ex) { // Error } } private void WebSocketError(object sender, ErrorEventArgs e) { textBox3.AppendText(Environment.NewLine + Environment.NewLine + "Connection to server lost : " + e.Message); ws.Close(); ws = null; } private void WebSocketClose(object sender, CloseEventArgs e) { textBox3.AppendText(Environment.NewLine + Environment.NewLine + "Connection closed with the server"); ws = null; } private void WebSocketDataReceived(object sender, MessageEventArgs e) { textBox3.AppendText(Environment.NewLine + Environment.NewLine + e.Data); }
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://api.icrypex.com/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(); } }
public class HttpClientApp { public void invokePost() { try { String requestBody = prepareRequest(); HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest .newBuilder() .uri(URI.create("https://api.icrypex.com/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(); } }
using System; using System.Net.Http; using System.Net.Http.Headers; namespace ConsoleProgram { public class Class1 { private const string URL = "https://api.icrypex.com/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(); } } }
// Public API : Get order book using (WebClient wc = new WebClient()) { try { string url = https://api.icrypex.com/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://api.icrypex.com/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": "119234", "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://api.icrypex.com/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": "123456", "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://api.icrypex.com/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": 119234, "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 the Turkish sports and our sportspeople via our sponsorships agreements with 1907 Fenerbahçe Wheelchair Basketball Team, Erden Eruç, Emir Tanju and Turkish Automobile Sports Federation! In this very rewarding and helpful journey of ours, we will continue to enrich and strengthen the Turkish sports thanks to the new steps we take in reaching brand new sponsorship agreements.