OrderBook
In case of a system failure and delays in real time orderbook data, this endpoint will return HTTP 503 in order to prevent false market data feed to clients.
Get a list of all open orders for a product.
  • 2 parameters are used for orderbook.
    • pairSymbol and limit
  • If limit parameter is not set, default 100 orders are listed.
There are 2 possible options:
Without limit parameter
https://api.btcturk.com/api/v2/orderbook?pairSymbol=BTCUSDT
Default 100 orders of BTCUSDT
With limit parameter
https://api.btcturk.com/api/v2/orderbook?pairSymbol=BTCUSDT&limit=200
200 orders of BTCUSDT
get
https://api.btcturk.com/
api/v2/orderbook
OrderBook

Code Example

C#
PHP
Python
1
// You can download ApiClient .net core complete library from github https://github.com/BTCTrader/broker-api-csharp-v2
2
3
var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
4
5
var publicKey = configuration["publicKey"];
6
var privateKey = configuration["privateKey"];
7
var resourceUrl = configuration["resourceUrl"];
8
9
var apiClientV1 = new ApiClientV1(publicKey, privateKey, resourceUrl);
10
var orderbook = apiClientV1.GetOrderBook("BTCTRY");
11
12
if (orderbook.Result.Success)
13
{
14
var bestBidPrice = orderbook.Result.Data.Bids[0][0];
15
var bestBidAmount = orderbook.Result.Data.Bids[0][1];
16
Console.WriteLine("Best bid price:" + bestBidPrice);
17
Console.WriteLine("Best bid amount:" + bestBidAmount);
18
}
19
else
20
{
21
Console.WriteLine(orderbook.Result.ToString());
22
}
Copied!
1
<?php
2
$base = "https://api.btcturk.com";
3
$method = "/api/v2/orderbook?pairSymbol=BTCTRY&limit=100";
4
$uri = $base.$method;
5
6
$ch = curl_init();
7
curl_setopt($ch, CURLOPT_URL, $uri);
8
curl_setopt($ch, CURLOPT_HTTP_VERSION, "CURL_HTTP_VERSION_1_2");
9
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
10
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
11
$result = curl_exec($ch);
12
13
if (curl_errno($ch)) {
14
print_r(curl_error($ch));
15
}
16
$answer = json_decode($result);
17
print_r($answer);
Copied!
1
import time, base64, hmac, hashlib, requests, json
2
3
base = "https://api.btcturk.com"
4
method = "/api/v2/orderbook?pairSymbol=BTCTRY"
5
uri = base+method
6
7
result = requests.get(url=uri)
8
result = result.json()
9
print(json.dumps(result, indent=2))
Copied!
Copy link