curl --request POST \
--url https://api.kraken.com/0/private/AddOrderBatch \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 1695828490,
"orders": [
{
"close": {
"ordertype": "stop-loss-limit",
"price": "37000",
"price2": "36000"
},
"ordertype": "limit",
"price": "40000",
"price2": "string",
"timeinforce": "GTC",
"type": "buy",
"cl_ord_id": "6d1b345e-2821-40e2-ad83-4ecb18a06876",
"volume": "1.2"
},
{
"ordertype": "limit",
"price": "42000",
"starttm": "string",
"timeinforce": "GTC",
"type": "sell",
"cl_ord_id": "da8e4ad59b78481c93e589746b0cf91",
"volume": "1.2"
}
],
"pair": "BTC/USD",
"validate": false,
"deadline": "2023-09-24T14:15:22Z"
}
'import requests
url = "https://api.kraken.com/0/private/AddOrderBatch"
payload = {
"nonce": 1695828490,
"orders": [
{
"close": {
"ordertype": "stop-loss-limit",
"price": "37000",
"price2": "36000"
},
"ordertype": "limit",
"price": "40000",
"price2": "string",
"timeinforce": "GTC",
"type": "buy",
"cl_ord_id": "6d1b345e-2821-40e2-ad83-4ecb18a06876",
"volume": "1.2"
},
{
"ordertype": "limit",
"price": "42000",
"starttm": "string",
"timeinforce": "GTC",
"type": "sell",
"cl_ord_id": "da8e4ad59b78481c93e589746b0cf91",
"volume": "1.2"
}
],
"pair": "BTC/USD",
"validate": False,
"deadline": "2023-09-24T14:15:22Z"
}
headers = {
"API-Key": "<api-key>",
"API-Sign": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'API-Key': '<api-key>',
'API-Sign': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
nonce: 1695828490,
orders: [
{
close: {ordertype: 'stop-loss-limit', price: '37000', price2: '36000'},
ordertype: 'limit',
price: '40000',
price2: 'string',
timeinforce: 'GTC',
type: 'buy',
cl_ord_id: '6d1b345e-2821-40e2-ad83-4ecb18a06876',
volume: '1.2'
},
{
ordertype: 'limit',
price: '42000',
starttm: 'string',
timeinforce: 'GTC',
type: 'sell',
cl_ord_id: 'da8e4ad59b78481c93e589746b0cf91',
volume: '1.2'
}
],
pair: 'BTC/USD',
validate: false,
deadline: '2023-09-24T14:15:22Z'
})
};
fetch('https://api.kraken.com/0/private/AddOrderBatch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kraken.com/0/private/AddOrderBatch"
payload := strings.NewReader("{\n \"nonce\": 1695828490,\n \"orders\": [\n {\n \"close\": {\n \"ordertype\": \"stop-loss-limit\",\n \"price\": \"37000\",\n \"price2\": \"36000\"\n },\n \"ordertype\": \"limit\",\n \"price\": \"40000\",\n \"price2\": \"string\",\n \"timeinforce\": \"GTC\",\n \"type\": \"buy\",\n \"cl_ord_id\": \"6d1b345e-2821-40e2-ad83-4ecb18a06876\",\n \"volume\": \"1.2\"\n },\n {\n \"ordertype\": \"limit\",\n \"price\": \"42000\",\n \"starttm\": \"string\",\n \"timeinforce\": \"GTC\",\n \"type\": \"sell\",\n \"cl_ord_id\": \"da8e4ad59b78481c93e589746b0cf91\",\n \"volume\": \"1.2\"\n }\n ],\n \"pair\": \"BTC/USD\",\n \"validate\": false,\n \"deadline\": \"2023-09-24T14:15:22Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("API-Sign", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": [],
"result": {
"orders": [
{
"txid": "O5OR23-ADFAD-Y2G61C",
"descr": {
"order": "buy 0.80300000 XBTUSD @ limit 28300.0",
"close": "close position @ stop loss 27000.0 -> limit 26000.0"
}
},
{
"txid": "9K6KFS-5H3PL-XBRC7A",
"descr": {
"order": "sell 0.10500000 XBTUSD @ limit 36000.0"
}
}
]
}
}Add Order Batch
Sends a collection of orders (minimum of 2 and maximum 15):
- Validation is performed on the whole batch prior to submission to the engine. If an order fails validation, the whole batch will be rejected.
- On submission to the engine, if an order fails pre-match checks (i.e. funding), then the individual order will be rejected and remainder of the batch will be processed.
- All orders in batch are limited to a single pair.
Note: See the AssetPairs endpoint for details on the available trading pairs, their price and quantity precisions, order minimums, available leverage, etc.
API Key Permissions Required: Orders and trades - Create & modify orders and Orders and trades - Cancel & close orders
curl --request POST \
--url https://api.kraken.com/0/private/AddOrderBatch \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 1695828490,
"orders": [
{
"close": {
"ordertype": "stop-loss-limit",
"price": "37000",
"price2": "36000"
},
"ordertype": "limit",
"price": "40000",
"price2": "string",
"timeinforce": "GTC",
"type": "buy",
"cl_ord_id": "6d1b345e-2821-40e2-ad83-4ecb18a06876",
"volume": "1.2"
},
{
"ordertype": "limit",
"price": "42000",
"starttm": "string",
"timeinforce": "GTC",
"type": "sell",
"cl_ord_id": "da8e4ad59b78481c93e589746b0cf91",
"volume": "1.2"
}
],
"pair": "BTC/USD",
"validate": false,
"deadline": "2023-09-24T14:15:22Z"
}
'import requests
url = "https://api.kraken.com/0/private/AddOrderBatch"
payload = {
"nonce": 1695828490,
"orders": [
{
"close": {
"ordertype": "stop-loss-limit",
"price": "37000",
"price2": "36000"
},
"ordertype": "limit",
"price": "40000",
"price2": "string",
"timeinforce": "GTC",
"type": "buy",
"cl_ord_id": "6d1b345e-2821-40e2-ad83-4ecb18a06876",
"volume": "1.2"
},
{
"ordertype": "limit",
"price": "42000",
"starttm": "string",
"timeinforce": "GTC",
"type": "sell",
"cl_ord_id": "da8e4ad59b78481c93e589746b0cf91",
"volume": "1.2"
}
],
"pair": "BTC/USD",
"validate": False,
"deadline": "2023-09-24T14:15:22Z"
}
headers = {
"API-Key": "<api-key>",
"API-Sign": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'API-Key': '<api-key>',
'API-Sign': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
nonce: 1695828490,
orders: [
{
close: {ordertype: 'stop-loss-limit', price: '37000', price2: '36000'},
ordertype: 'limit',
price: '40000',
price2: 'string',
timeinforce: 'GTC',
type: 'buy',
cl_ord_id: '6d1b345e-2821-40e2-ad83-4ecb18a06876',
volume: '1.2'
},
{
ordertype: 'limit',
price: '42000',
starttm: 'string',
timeinforce: 'GTC',
type: 'sell',
cl_ord_id: 'da8e4ad59b78481c93e589746b0cf91',
volume: '1.2'
}
],
pair: 'BTC/USD',
validate: false,
deadline: '2023-09-24T14:15:22Z'
})
};
fetch('https://api.kraken.com/0/private/AddOrderBatch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kraken.com/0/private/AddOrderBatch"
payload := strings.NewReader("{\n \"nonce\": 1695828490,\n \"orders\": [\n {\n \"close\": {\n \"ordertype\": \"stop-loss-limit\",\n \"price\": \"37000\",\n \"price2\": \"36000\"\n },\n \"ordertype\": \"limit\",\n \"price\": \"40000\",\n \"price2\": \"string\",\n \"timeinforce\": \"GTC\",\n \"type\": \"buy\",\n \"cl_ord_id\": \"6d1b345e-2821-40e2-ad83-4ecb18a06876\",\n \"volume\": \"1.2\"\n },\n {\n \"ordertype\": \"limit\",\n \"price\": \"42000\",\n \"starttm\": \"string\",\n \"timeinforce\": \"GTC\",\n \"type\": \"sell\",\n \"cl_ord_id\": \"da8e4ad59b78481c93e589746b0cf91\",\n \"volume\": \"1.2\"\n }\n ],\n \"pair\": \"BTC/USD\",\n \"validate\": false,\n \"deadline\": \"2023-09-24T14:15:22Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("API-Sign", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": [],
"result": {
"orders": [
{
"txid": "O5OR23-ADFAD-Y2G61C",
"descr": {
"order": "buy 0.80300000 XBTUSD @ limit 28300.0",
"close": "close position @ stop loss 27000.0 -> limit 26000.0"
}
},
{
"txid": "9K6KFS-5H3PL-XBRC7A",
"descr": {
"order": "sell 0.10500000 XBTUSD @ limit 36000.0"
}
}
]
}
}Authorizations
The "API-Key" header should contain your API key.
Authenticated requests should be signed with the "API-Sign" header, using a signature generated with your private key, nonce, encoded payload, and URI path.
Body
Nonce used in construction of API-Sign header
Show child attributes
Show child attributes
Asset pair id or altname
This parameter is required on requests for non-crypto pairs, i.e. use tokenized_asset for xStocks.
tokenized_asset RFC3339 timestamp (e.g. 2021-04-01T00:18:45Z) after which the matching engine should reject the new order request, in presence of latency or order queueing. min now() + 2 seconds, max now() + 60 seconds.
Validate inputs only. Do not submit order.
Broker IIBAN (Partner's Kraken IIBAN)
Was this page helpful?