Get public orders book [Private]
Get a list of order prices by pair (e.g. BTC_USDT
). Returns a list of order prices, 2 arrays for Bids and Asks; lowest first for Asks, highest first for Bids; leveled by order prices, but no more levels than specified by the level
parameter.
To call any private endpoint, headers should include authorization key(s).
You may use a single API key or a public-private key pair based on your current tasks. Here you may find typical Header configurations for both options.
Method name: | /v4/order/private/book/{pairs} |
Request type: | GET |
Data dictionary
Name | Type | Parameter type | Required | Range | Description |
---|---|---|---|---|---|
pair | string | PATH | YES | - | A trading pair as per the list from Get all traded markets endpoint |
level | int | QUERY | NO | 5, 10, 20, 50, 100, 500, 1000 | Amount of price levels for existing orders in the response |
Parameter
level
defaults to 1000 if not provided.
Exemplary request
Example path | Description |
---|---|
/v4/order/private/book/BTC_USDT?level=5 | Returns a list of order prices for BTC_USDT ; 5 lowest for Asks and 5 highest fir Bids |
/v4/order/private/book/BTC_USDT | Returns a list of order prices for BTC_USDT ; 1000 lowest for Asks and 1000 highest fir Bids |
const apiKey = "YOUR_API_KEY"; // put here your Api key
const url = "https://api.kuna.io";
const path = "/v4/order/private/book/BTC_USDT?level=5";
const options = {
headers: {
accept: "application/json",
"Content-Type": "application/json",
"api-key": apiKey,
},
};
fetch(url + path, options)
.then((response) => response.json())
.then((showResponse) => console.log(showResponse.data));
import requests
apiKey = "YOUR_API_KEY"; # put here your Api key
url = "https://api.kuna.io"
path = "/v4/order/private/book/BTC_USDT?level=5"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"api-key": apiKey,
}
request = requests.get(url + path, headers=headers)
print(request.json())
How to call public endpoints here
Response
{
"asks": [ // An array of sell orders
[
"16950", // Sell price, level 1
"0.001" // Sell quantity, level 1
],
[
"17000", // Sell price, level 2
"0.01" // Sell quantity, level 2
]
],
"bids": [ // An array of buy orders
[
"16700", // Sell price, level 1
"0.01" // Sell quantity, level 1
],
[
"16000", // Sell price, level 2
"0.001" // Sell quantity, level 2
]
]
}
Updated about 1 year ago