curl --request POST \
--url https://api.kraken.com/0/private/ClosedOrders \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 1234567,
"trades": true,
"cl_ord_id": "9cc788d8-9c00-4b25-94d3-26d93603948d",
"start": 1695728276,
"end": 1695828276,
"closetime": "open"
}
'import requests
url = "https://api.kraken.com/0/private/ClosedOrders"
payload = {
"nonce": 1234567,
"trades": True,
"cl_ord_id": "9cc788d8-9c00-4b25-94d3-26d93603948d",
"start": 1695728276,
"end": 1695828276,
"closetime": "open"
}
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: 1234567,
trades: true,
cl_ord_id: '9cc788d8-9c00-4b25-94d3-26d93603948d',
start: 1695728276,
end: 1695828276,
closetime: 'open'
})
};
fetch('https://api.kraken.com/0/private/ClosedOrders', 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/ClosedOrders"
payload := strings.NewReader("{\n \"nonce\": 1234567,\n \"trades\": true,\n \"cl_ord_id\": \"9cc788d8-9c00-4b25-94d3-26d93603948d\",\n \"start\": 1695728276,\n \"end\": 1695828276,\n \"closetime\": \"open\"\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": {
"closed": {
"O37652-RJWRT-IMO74O": {
"refid": "None",
"userref": 1,
"status": "canceled",
"reason": "User requested",
"opentm": 1688148493.7708,
"closetm": 1688148610.0482,
"starttm": 0,
"expiretm": 0,
"descr": {
"pair": "XBTGBP",
"type": "buy",
"ordertype": "stop-loss-limit",
"price": "23667.0",
"price2": "0",
"leverage": "none",
"order": "buy 0.00100000 XBTGBP @ limit 23667.0",
"close": ""
},
"vol": "0.00100000",
"vol_exec": "0.00000000",
"cost": "0.00000",
"fee": "0.00000",
"price": "0.00000",
"stopprice": "0.00000",
"limitprice": "0.00000",
"misc": "",
"oflags": "fciq",
"trigger": "index"
},
"O6YDQ5-LOMWU-37YKEE": {
"refid": "None",
"userref": 36493663,
"status": "canceled",
"reason": "User requested",
"opentm": 1688148493.7708,
"closetm": 1688148610.0477,
"starttm": 0,
"expiretm": 0,
"descr": {
"pair": "XBTEUR",
"type": "buy",
"ordertype": "take-profit-limit",
"price": "27743.0",
"price2": "0",
"leverage": "none",
"order": "buy 0.00100000 XBTEUR @ limit 27743.0",
"close": ""
},
"vol": "0.00100000",
"vol_exec": "0.00000000",
"cost": "0.00000",
"fee": "0.00000",
"price": "0.00000",
"stopprice": "0.00000",
"limitprice": "0.00000",
"misc": "",
"oflags": "fciq",
"trigger": "index"
}
},
"count": 2
}
}Get Closed Orders
Retrieve information about orders that have been closed (filled or cancelled). 50 results are returned at a time, the most recent by default.
Note: If an order’s tx ID is given for start or end time, the order’s opening time (opentm) is used
API Key Permissions Required: Orders and trades - Query closed orders & trades
curl --request POST \
--url https://api.kraken.com/0/private/ClosedOrders \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 1234567,
"trades": true,
"cl_ord_id": "9cc788d8-9c00-4b25-94d3-26d93603948d",
"start": 1695728276,
"end": 1695828276,
"closetime": "open"
}
'import requests
url = "https://api.kraken.com/0/private/ClosedOrders"
payload = {
"nonce": 1234567,
"trades": True,
"cl_ord_id": "9cc788d8-9c00-4b25-94d3-26d93603948d",
"start": 1695728276,
"end": 1695828276,
"closetime": "open"
}
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: 1234567,
trades: true,
cl_ord_id: '9cc788d8-9c00-4b25-94d3-26d93603948d',
start: 1695728276,
end: 1695828276,
closetime: 'open'
})
};
fetch('https://api.kraken.com/0/private/ClosedOrders', 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/ClosedOrders"
payload := strings.NewReader("{\n \"nonce\": 1234567,\n \"trades\": true,\n \"cl_ord_id\": \"9cc788d8-9c00-4b25-94d3-26d93603948d\",\n \"start\": 1695728276,\n \"end\": 1695828276,\n \"closetime\": \"open\"\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": {
"closed": {
"O37652-RJWRT-IMO74O": {
"refid": "None",
"userref": 1,
"status": "canceled",
"reason": "User requested",
"opentm": 1688148493.7708,
"closetm": 1688148610.0482,
"starttm": 0,
"expiretm": 0,
"descr": {
"pair": "XBTGBP",
"type": "buy",
"ordertype": "stop-loss-limit",
"price": "23667.0",
"price2": "0",
"leverage": "none",
"order": "buy 0.00100000 XBTGBP @ limit 23667.0",
"close": ""
},
"vol": "0.00100000",
"vol_exec": "0.00000000",
"cost": "0.00000",
"fee": "0.00000",
"price": "0.00000",
"stopprice": "0.00000",
"limitprice": "0.00000",
"misc": "",
"oflags": "fciq",
"trigger": "index"
},
"O6YDQ5-LOMWU-37YKEE": {
"refid": "None",
"userref": 36493663,
"status": "canceled",
"reason": "User requested",
"opentm": 1688148493.7708,
"closetm": 1688148610.0477,
"starttm": 0,
"expiretm": 0,
"descr": {
"pair": "XBTEUR",
"type": "buy",
"ordertype": "take-profit-limit",
"price": "27743.0",
"price2": "0",
"leverage": "none",
"order": "buy 0.00100000 XBTEUR @ limit 27743.0",
"close": ""
},
"vol": "0.00100000",
"vol_exec": "0.00000000",
"cost": "0.00000",
"fee": "0.00000",
"price": "0.00000",
"stopprice": "0.00000",
"limitprice": "0.00000",
"misc": "",
"oflags": "fciq",
"trigger": "index"
}
},
"count": 2
}
}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
Whether or not to include trades related to position in output
Restrict results to given user reference
Restrict results to given client order id
Starting unix timestamp or order tx ID of results (exclusive)
Ending unix timestamp or order tx ID of results (inclusive)
Result offset for pagination
Which time to use to search
open, close, both Whether or not to consolidate trades by individual taker trades
Whether or not to include page count in result (true is much faster for users with many closed orders)
Optional parameter for viewing xStocks data.
rebased: Display in terms of underlying equity.base: Display in terms of SPV tokens.
rebased, base Was this page helpful?