Create a new order [Private]

Create a new order. Returns an id of your newly created order.

📘

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/create
Request type:POST

Data dictionary

NameTypeParameter typeRequiredRangeDescription
idstringBODYNO-id must be a UUID format. If you do not specify id, it will be generated automatically.
typeenumBODYYESLimit, Market, StopLossLimit, TakeProfitLimitType of an order.
orderSideenumBODYYESBid, AskBid for buying base asset, Ask for selling base asset (e.g. for BTC_USDT trading pair, BTC is the base asset).
pairstringBODYYES-A trading pair as per the list from Get all traded markets endpoint.
quantitystringBODYYES-Quantity of the base asset to buy/sell (e.g. for BTC_USDT trading pair, BTC is the base asset).
Precision depends on the asset as per Get all traded markets endpoint.
pricestringBODYYES-Target exchange price to buy/sell the base asset.
quoteQuantitystringBODYYES*-The max quantity of the quote asset to use for selling/buying (e.g. for BTC_USDT trading pair, USDT is the quote asset).
This field is only available for Market orders.
Precision depends on the asset as per Get all traded markets endpoint.
stopPricestringBODYYES*-It is a trigger for the limit price: when the coin's market price reaches stopPrice, a limit order is automatically placed.

📘

You need to know:

It is possible to choose between quantity and quoteQuantity for Market order, but you cannot use both at the same time.

StopLossLimit is needed to sell an asset below the market price and to buy above the market price. TakeProfitLimit is needed to sell an asset above the market price and to buy below the market price.

Maximum number of opened orders - 100.

To get any changes in open orders is possible via WebSocket API.

Exemplary request

Order typeAvailable parameters
Limittype, orderSide, pair, quantity, price
Markettype, orderSide, pair, quantity or quoteQuantity
StopLossLimittype, orderSide, pair, quantity, price, stopPrice
TakeProfitLimittype, orderSide, pair, quantity, price, stopPrice

Body examples

// Body to create a Market order to buy BTC using "quantity"
{
  "type": "Market",
  "orderSide": "Bid",
  "pair": "BTC_USDT",
  "quantity": "0.06" 
} // I want to buy 0.06 BTC

// Body to create a Market order to buy BTC using "quoteQuantity"
{
  "type": "Market",
  "orderSide": "Bid",
  "pair": "BTC_USDT",
  "quoteQuantity": "20.00"
} // I want to buy BTC for 20 USDT
// Body to create a Limit order to buy BTC
{
  "type": "Limit",
  "orderSide": "Bid",
  "pair": "BTC_USDT",
  "price": "26440.46",
  "quantity": "0.06",     
} // I want to buy 0.06 BTC for 26440.46 USDT

// Body to create a Limit order to sell BTC
{
  "type": "Limit",
  "orderSide": "Ask",
  "pair": "BTC_USDT",
  "price": "26440.46",
  "quantity": "0.06",   
} // I want to sell 0.06 BTC for 26440.46 USDT
// Example 1. BTC price is 29000 USDT. You think the price will go even lower, so you decide to open a StopLossLimit order to sell BTC for USDT to minimize the loss
{
  "type": "StopLossLimit",
  "orderSide": "Ask",
  "pair": "BTC_USDT",
  "price": "26440",
  "stopPrice": "27440"
  "quantity": "0.06",   
} // I want to open a limit order to sell 0.06 BTC for 26440 USDT when BTC market price reaches 27440 USDT

// Example 2. BTC price is 29000 USDT. You think the price will go even higher, so you decide to open a StopLossLimit order to buy BTC for USDT
{
  "type": "StopLossLimit",
  "orderSide": "Bid",
  "pair": "BTC_USDT",
  "price": "30000",
  "stopPrice": "29500"
  "quantity": "0.06", 
} // I want to open a limit order to buy 0.06 BTC for 30000 USDT when BTC market price reaches 29500 USDT
// Example 1. BTC price is 29000 USDT. You think the price will go even lower, so you decide to open a TakeProfitLimit order to buy BTC for USDT for a better price
{
  "type": "TakeProfitLimit",
  "orderSide": "Bid",
  "pair": "BTC_USDT",
  "price": "22500",
  "stopPrice": "23000"
  "quantity": "0.06", 
} // I want to open a limit order to buy 0.06 BTC for 22500 USDT when BTC market price reaches 23000 USDT

// Example 2. BTC price is 29000 USDT. You think the price will go even higher, so you decide to open a TakeProfitLimit order to sell BTC for USDT for a better price
{
  "type": "TakeProfitLimit",
  "orderSide": "Ask",
  "pair": "BTC_USDT",
  "price": "30000",
  "stopPrice": "29500"
  "quantity": "0.06",   
} // I want to open a limit order to sell 0.06 BTC for 30000 USDT when BTC market price reaches 29500 USDT
// Create a limit order to buy BTC
const apiKey = "YOUR_API_KEY";

const url = "https://api.kuna.io";
const path = "/v4/order/private/create";
const body = {
  type: "Limit",
  orderSide: "Bid",
  pair: "BTC_USDT",
  quantity: "0.06",
  price: "26440.46",
};

const options = {
  method: "POST",
  headers: {
    accept: "application/json",
    "Content-Type": "application/json",
    "api-key": apiKey,
  },
  body: JSON.stringify(body),
};

fetch(url + path, options)
  .then((response) => response.json())
  .then((showResponse) => console.log(showResponse.data));
# Create a limit order to buy BTC
import requests

api_key = "YOUR_API_KEY"

url = "https://api.kuna.io"
path = "/v4/order/private/create"
headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "api-key": api_key,
}
body = {
    "type": "Limit",
    "orderSide": "Bid",
    "pair": "BTC_USDT",
    "quantity": "0.06",
    "price": "26440.46",
}

request = requests.post(url + path, headers=headers, json=body)
print(request.json())

How to call private endpoints here

Swagger here

Response

{
    "id": "b0fcb54c-2278-4f16-a300-02765faad8b0",     // ID  of your newly created order
    "type": "Limit",                                  // Type of an order
    "quantity": "0.06",                               // Original order quantity
    "executedQuantity": "0",                          // Traded quantity in stock (>0 if traded)
    "pair": "BTC_USDT",                               // Traded pair
    "price": "26440.46",                              // Price of the trade
    "status": "Open",                                 // The status of the order
    "createdAt": "2023-07-11T08:01:30.550Z",          // Date-time of order creation, UTC
    "updatedAt": "2023-07-11T08:01:30.550Z"           // Date-time of the last update of the order, UTC
  }