Batch order management
This endpoint allows sending limit or stop order(s) and/or cancelling open order(s) and/or editing open order(s) for a currently listed Futures contract in batch.
When editing an order, if the trailingStopMaxDeviation and trailingStopDeviationUnit
parameters are sent unchanged, the system will recalculate a new stop price upon successful
order modification.
curl --request POST \
--url https://futures.kraken.com/derivatives/api/v3/batchorder \
--header 'APIKey: <api-key>' \
--header 'Authent: <api-key>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'json={
"batchOrder": [
{
"order": "send",
"order_tag": "1",
"orderType": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"size": 1,
"limitPrice": 1,
"cliOrdId": "my_another_client_id"
},
{
"order": "send",
"order_tag": "2",
"orderType": "stp",
"symbol": "PF_XBTUSD",
"side": "buy",
"size": 1,
"limitPrice": 2,
"stopPrice": 3
},
{
"order": "cancel",
"order_id": "e35d61dd-8a30-4d5f-a574-b5593ef0c050"
},
{
"order": "cancel",
"cliOrdId": "my_client_id"
}
]
}' \
--data ProcessBefore=2023-11-08T19:56:35.441899Zimport requests
url = "https://futures.kraken.com/derivatives/api/v3/batchorder"
payload = {
"json": "{
\"batchOrder\": [
{
\"order\": \"send\",
\"order_tag\": \"1\",
\"orderType\": \"lmt\",
\"symbol\": \"PF_XBTUSD\",
\"side\": \"buy\",
\"size\": 1,
\"limitPrice\": 1,
\"cliOrdId\": \"my_another_client_id\"
},
{
\"order\": \"send\",
\"order_tag\": \"2\",
\"orderType\": \"stp\",
\"symbol\": \"PF_XBTUSD\",
\"side\": \"buy\",
\"size\": 1,
\"limitPrice\": 2,
\"stopPrice\": 3
},
{
\"order\": \"cancel\",
\"order_id\": \"e35d61dd-8a30-4d5f-a574-b5593ef0c050\"
},
{
\"order\": \"cancel\",
\"cliOrdId\": \"my_client_id\"
}
]
}",
"ProcessBefore": "2023-11-08T19:56:35.441899Z"
}
headers = {
"APIKey": "<api-key>",
"Authent": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
APIKey: '<api-key>',
Authent: '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
json: '{\n "batchOrder": [\n {\n "order": "send",\n "order_tag": "1",\n "orderType": "lmt",\n "symbol": "PF_XBTUSD",\n "side": "buy",\n "size": 1,\n "limitPrice": 1,\n "cliOrdId": "my_another_client_id"\n },\n {\n "order": "send",\n "order_tag": "2",\n "orderType": "stp",\n "symbol": "PF_XBTUSD",\n "side": "buy",\n "size": 1,\n "limitPrice": 2,\n "stopPrice": 3\n },\n {\n "order": "cancel",\n "order_id": "e35d61dd-8a30-4d5f-a574-b5593ef0c050"\n },\n {\n "order": "cancel",\n "cliOrdId": "my_client_id"\n }\n ]\n}',
ProcessBefore: '2023-11-08T19:56:35.441899Z'
})
};
fetch('https://futures.kraken.com/derivatives/api/v3/batchorder', 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://futures.kraken.com/derivatives/api/v3/batchorder"
payload := strings.NewReader("json=%7B%0A%20%20%22batchOrder%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22order%22%3A%20%22send%22%2C%0A%20%20%20%20%20%20%22order_tag%22%3A%20%221%22%2C%0A%20%20%20%20%20%20%22orderType%22%3A%20%22lmt%22%2C%0A%20%20%20%20%20%20%22symbol%22%3A%20%22PF_XBTUSD%22%2C%0A%20%20%20%20%20%20%22side%22%3A%20%22buy%22%2C%0A%20%20%20%20%20%20%22size%22%3A%201%2C%0A%20%20%20%20%20%20%22limitPrice%22%3A%201%2C%0A%20%20%20%20%20%20%22cliOrdId%22%3A%20%22my_another_client_id%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22order%22%3A%20%22send%22%2C%0A%20%20%20%20%20%20%22order_tag%22%3A%20%222%22%2C%0A%20%20%20%20%20%20%22orderType%22%3A%20%22stp%22%2C%0A%20%20%20%20%20%20%22symbol%22%3A%20%22PF_XBTUSD%22%2C%0A%20%20%20%20%20%20%22side%22%3A%20%22buy%22%2C%0A%20%20%20%20%20%20%22size%22%3A%201%2C%0A%20%20%20%20%20%20%22limitPrice%22%3A%202%2C%0A%20%20%20%20%20%20%22stopPrice%22%3A%203%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22order%22%3A%20%22cancel%22%2C%0A%20%20%20%20%20%20%22order_id%22%3A%20%22e35d61dd-8a30-4d5f-a574-b5593ef0c050%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22order%22%3A%20%22cancel%22%2C%0A%20%20%20%20%20%20%22cliOrdId%22%3A%20%22my_client_id%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D&ProcessBefore=2023-11-08T19%3A56%3A35.441899Z")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("APIKey", "<api-key>")
req.Header.Add("Authent", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"result": "success",
"batchStatus": [
{
"status": "placed",
"order_tag": "1",
"order_id": "022774bc-2c4a-4f26-9317-436c8d85746d",
"dateTimeReceived": "2019-09-05T16:41:35.173Z",
"orderEvents": [
{
"type": "PLACE",
"order": {
"orderId": "022774bc-2c4a-4f26-9317-436c8d85746d",
"type": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"quantity": 1000,
"filled": 0,
"limitPrice": 9400,
"reduceOnly": false,
"timestamp": "2019-09-05T16:41:35.173Z",
"lastUpdateTimestamp": "2019-09-05T16:41:35.173Z"
}
}
]
},
{
"status": "edited",
"order_id": "9c2cbcc8-14f6-42fe-a020-6e395babafd1",
"orderEvents": [
{
"type": "EDIT",
"old": {
"orderId": "9c2cbcc8-14f6-42fe-a020-6e395babafd1",
"type": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"quantity": 102,
"filled": 0,
"limitPrice": 8500,
"reduceOnly": false,
"timestamp": "2019-09-04T11:45:48.884Z",
"lastUpdateTimestamp": "2019-09-04T11:45:48.884Z"
},
"new": {
"orderId": "9c2cbcc8-14f6-42fe-a020-6e395babafd1",
"type": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"quantity": 1000,
"filled": 0,
"limitPrice": 9400,
"reduceOnly": false,
"timestamp": "2019-09-04T11:45:48.884Z",
"lastUpdateTimestamp": "2019-09-05T16:41:40.996Z"
}
}
]
},
{
"status": "cancelled",
"order_id": "566942c8-a3b5-4184-a451-622b09493129",
"orderEvents": [
{
"type": "CANCEL",
"uid": "566942c8-a3b5-4184-a451-622b09493129",
"order": {
"orderId": "566942c8-a3b5-4184-a451-622b09493129",
"type": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"quantity": 100,
"filled": 0,
"limitPrice": 8500,
"reduceOnly": false,
"timestamp": "2019-09-02T12:54:08.005Z",
"lastUpdateTimestamp": "2019-09-02T12:54:08.005Z"
}
}
]
}
],
"serverTime": "2019-09-05T16:41:40.996Z"
}Authorizations
General API key with full access
Authentication string
Body
This parameter is required to be encoded as a JSON string.
Show child attributes
Show child attributes
{
"batchOrder": [
{
"order": "send",
"order_tag": "1",
"orderType": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"size": 1,
"limitPrice": 1,
"cliOrdId": "my_another_client_id"
},
{
"order": "send",
"order_tag": "2",
"orderType": "stp",
"symbol": "PF_XBTUSD",
"side": "buy",
"size": 1,
"limitPrice": 2,
"stopPrice": 3
},
{
"order": "cancel",
"order_id": "e35d61dd-8a30-4d5f-a574-b5593ef0c050"
},
{
"order": "cancel",
"cliOrdId": "my_client_id"
}
]
}
The time before which the request should be processed, otherwise it is rejected.
"2023-11-08T19:56:35.441899Z"
Response
- Success Response
- Errors
A structure containing information on the send order request.
Show child attributes
Show child attributes
success "success"
Server time in Coordinated Universal Time (UTC)
"2020-08-27T17:03:33.196Z"
curl --request POST \
--url https://futures.kraken.com/derivatives/api/v3/batchorder \
--header 'APIKey: <api-key>' \
--header 'Authent: <api-key>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'json={
"batchOrder": [
{
"order": "send",
"order_tag": "1",
"orderType": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"size": 1,
"limitPrice": 1,
"cliOrdId": "my_another_client_id"
},
{
"order": "send",
"order_tag": "2",
"orderType": "stp",
"symbol": "PF_XBTUSD",
"side": "buy",
"size": 1,
"limitPrice": 2,
"stopPrice": 3
},
{
"order": "cancel",
"order_id": "e35d61dd-8a30-4d5f-a574-b5593ef0c050"
},
{
"order": "cancel",
"cliOrdId": "my_client_id"
}
]
}' \
--data ProcessBefore=2023-11-08T19:56:35.441899Zimport requests
url = "https://futures.kraken.com/derivatives/api/v3/batchorder"
payload = {
"json": "{
\"batchOrder\": [
{
\"order\": \"send\",
\"order_tag\": \"1\",
\"orderType\": \"lmt\",
\"symbol\": \"PF_XBTUSD\",
\"side\": \"buy\",
\"size\": 1,
\"limitPrice\": 1,
\"cliOrdId\": \"my_another_client_id\"
},
{
\"order\": \"send\",
\"order_tag\": \"2\",
\"orderType\": \"stp\",
\"symbol\": \"PF_XBTUSD\",
\"side\": \"buy\",
\"size\": 1,
\"limitPrice\": 2,
\"stopPrice\": 3
},
{
\"order\": \"cancel\",
\"order_id\": \"e35d61dd-8a30-4d5f-a574-b5593ef0c050\"
},
{
\"order\": \"cancel\",
\"cliOrdId\": \"my_client_id\"
}
]
}",
"ProcessBefore": "2023-11-08T19:56:35.441899Z"
}
headers = {
"APIKey": "<api-key>",
"Authent": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
APIKey: '<api-key>',
Authent: '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
json: '{\n "batchOrder": [\n {\n "order": "send",\n "order_tag": "1",\n "orderType": "lmt",\n "symbol": "PF_XBTUSD",\n "side": "buy",\n "size": 1,\n "limitPrice": 1,\n "cliOrdId": "my_another_client_id"\n },\n {\n "order": "send",\n "order_tag": "2",\n "orderType": "stp",\n "symbol": "PF_XBTUSD",\n "side": "buy",\n "size": 1,\n "limitPrice": 2,\n "stopPrice": 3\n },\n {\n "order": "cancel",\n "order_id": "e35d61dd-8a30-4d5f-a574-b5593ef0c050"\n },\n {\n "order": "cancel",\n "cliOrdId": "my_client_id"\n }\n ]\n}',
ProcessBefore: '2023-11-08T19:56:35.441899Z'
})
};
fetch('https://futures.kraken.com/derivatives/api/v3/batchorder', 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://futures.kraken.com/derivatives/api/v3/batchorder"
payload := strings.NewReader("json=%7B%0A%20%20%22batchOrder%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22order%22%3A%20%22send%22%2C%0A%20%20%20%20%20%20%22order_tag%22%3A%20%221%22%2C%0A%20%20%20%20%20%20%22orderType%22%3A%20%22lmt%22%2C%0A%20%20%20%20%20%20%22symbol%22%3A%20%22PF_XBTUSD%22%2C%0A%20%20%20%20%20%20%22side%22%3A%20%22buy%22%2C%0A%20%20%20%20%20%20%22size%22%3A%201%2C%0A%20%20%20%20%20%20%22limitPrice%22%3A%201%2C%0A%20%20%20%20%20%20%22cliOrdId%22%3A%20%22my_another_client_id%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22order%22%3A%20%22send%22%2C%0A%20%20%20%20%20%20%22order_tag%22%3A%20%222%22%2C%0A%20%20%20%20%20%20%22orderType%22%3A%20%22stp%22%2C%0A%20%20%20%20%20%20%22symbol%22%3A%20%22PF_XBTUSD%22%2C%0A%20%20%20%20%20%20%22side%22%3A%20%22buy%22%2C%0A%20%20%20%20%20%20%22size%22%3A%201%2C%0A%20%20%20%20%20%20%22limitPrice%22%3A%202%2C%0A%20%20%20%20%20%20%22stopPrice%22%3A%203%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22order%22%3A%20%22cancel%22%2C%0A%20%20%20%20%20%20%22order_id%22%3A%20%22e35d61dd-8a30-4d5f-a574-b5593ef0c050%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22order%22%3A%20%22cancel%22%2C%0A%20%20%20%20%20%20%22cliOrdId%22%3A%20%22my_client_id%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D&ProcessBefore=2023-11-08T19%3A56%3A35.441899Z")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("APIKey", "<api-key>")
req.Header.Add("Authent", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"result": "success",
"batchStatus": [
{
"status": "placed",
"order_tag": "1",
"order_id": "022774bc-2c4a-4f26-9317-436c8d85746d",
"dateTimeReceived": "2019-09-05T16:41:35.173Z",
"orderEvents": [
{
"type": "PLACE",
"order": {
"orderId": "022774bc-2c4a-4f26-9317-436c8d85746d",
"type": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"quantity": 1000,
"filled": 0,
"limitPrice": 9400,
"reduceOnly": false,
"timestamp": "2019-09-05T16:41:35.173Z",
"lastUpdateTimestamp": "2019-09-05T16:41:35.173Z"
}
}
]
},
{
"status": "edited",
"order_id": "9c2cbcc8-14f6-42fe-a020-6e395babafd1",
"orderEvents": [
{
"type": "EDIT",
"old": {
"orderId": "9c2cbcc8-14f6-42fe-a020-6e395babafd1",
"type": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"quantity": 102,
"filled": 0,
"limitPrice": 8500,
"reduceOnly": false,
"timestamp": "2019-09-04T11:45:48.884Z",
"lastUpdateTimestamp": "2019-09-04T11:45:48.884Z"
},
"new": {
"orderId": "9c2cbcc8-14f6-42fe-a020-6e395babafd1",
"type": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"quantity": 1000,
"filled": 0,
"limitPrice": 9400,
"reduceOnly": false,
"timestamp": "2019-09-04T11:45:48.884Z",
"lastUpdateTimestamp": "2019-09-05T16:41:40.996Z"
}
}
]
},
{
"status": "cancelled",
"order_id": "566942c8-a3b5-4184-a451-622b09493129",
"orderEvents": [
{
"type": "CANCEL",
"uid": "566942c8-a3b5-4184-a451-622b09493129",
"order": {
"orderId": "566942c8-a3b5-4184-a451-622b09493129",
"type": "lmt",
"symbol": "PF_XBTUSD",
"side": "buy",
"quantity": 100,
"filled": 0,
"limitPrice": 8500,
"reduceOnly": false,
"timestamp": "2019-09-02T12:54:08.005Z",
"lastUpdateTimestamp": "2019-09-02T12:54:08.005Z"
}
}
]
}
],
"serverTime": "2019-09-05T16:41:40.996Z"
}