Get private trades history [Private]
Get a list of trades by pair (e.g. BTC_USDT
). Returns an array of your trades with details on each trade, 10 trades maximum, newest first.
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/trade/private/history |
Request type: | GET |
Data dictionary
Name | Type | Parameter type | Required | Range | Description |
---|---|---|---|---|---|
pair | string | QUERY | NO | - | A trading pair as per the list from Get all traded markets endpoint. |
orderId | string | QUERY | NO | - | UUID of an order, to receive trades for this order only. |
sort | enum | QUERY | NO | asc , desc | Sort the resulting list newest-on-top (desc ) or oldest-on-top (asc ). |
You need to know:
If
pair
andorderId
were not specified, returns the latest 10 trades for any trade pair and any order.
Exemplary request
To properly test this endpoint, you need to have trades in your account. The easiest way is to create 2 alike order of different order side (Ask/Bid) and let them close each other. Use Create a new order endpoint to create a new order. Once done, please use this endpoint:
Example path | Description |
---|---|
/v4/trade/private/history | Returns the latest 10 trades for any trade pair and any order. |
/v4/trade/private/history?pair=BTC_USDT | Returns information of your trades in BTC_USDT pair. |
/v4/trade/private/history?orderId=3eaaed5d-0b59-47b9-9f5b-524af0395fb3 | Returns information about your order with its trades. |
const apiKey = "YOUR_API_KEY"; // put here your Api key
const url = "https://api.kuna.io";
const path = "/v4/trade/private/history?pair=BTC_USDT";
const options = {
method: "GET",
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
api_key = "YOUR_API_KEY" # put here your Api key
url = "https://api.kuna.io"
path = "/v4/trade/private/history?pair=BTC_USDT"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"api-key": api_key,
}
request = requests.get(url + path, headers=headers)
print(request.json())
How to call private endpoints here
Response
[
{
id: "edb17459-c9bf-4148-9ae6-7367d7f55d71", // Unique identifier of a trade
orderId: "a80bec3f-4ffa-45c1-9d78-f6301e9748fe", // Unique identifier of an order associated with the trade
pair: "BTC_USDT", // Traded pair, base asset first, followed by quoted asset
quantity: "1.5862", // Traded quantity of base asset
price: "19087", // Price of the trade
isTaker: true, // Various fees for Makers and Takers; "Market" orders are always `true`
fee: "0.0039655", // Exchange commission fee
feeCurrency: "BTC", // Currency of the commission
isBuyer: true, // Buy or sell the base asset
quoteQuantity: "30275.7994", // Quote asset quantity spent to fulfill the base amount
createdAt: "2022-09-29T13:43:53.824Z", // Date-time of trade execution, UTC
},
]
Updated over 1 year ago