Trading
Edit Order
Sends a request to edit the order parameters of a live order. When an order has been successfully modified, the original order will be cancelled and a new order will be
created with the adjusted parameters a new txid will be returned in the response.
Note: The new AmendOrder endpoint resolves the caveats listed below and has additional performance gains.
Caveats for EditOrder:
- Triggered stop loss or take profit orders are not supported.
- Orders with conditional close terms attached are not supported.
- Orders where the executed volume is greater than the newly supplied volume will be rejected.
cl_ord_idis not supported.- Existing executions are associated with the original order and not copied to the amended order.
- Queue position will not be maintained.
API Key Permissions Required: Orders and trades - Create & modify orders and Orders and trades - Cancel & close orders
POST
/
private
/
EditOrder
Edit Order
curl --request POST \
--url https://api.kraken.com/0/private/EditOrder \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 1695828490,
"pair": "XBTUSD",
"txid": "OHYO67-6LP66-HMQ437",
"volume": "1.25",
"price": "27500",
"price2": "26500"
}
'import requests
url = "https://api.kraken.com/0/private/EditOrder"
payload = {
"nonce": 1695828490,
"pair": "XBTUSD",
"txid": "OHYO67-6LP66-HMQ437",
"volume": "1.25",
"price": "27500",
"price2": "26500"
}
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,
pair: 'XBTUSD',
txid: 'OHYO67-6LP66-HMQ437',
volume: '1.25',
price: '27500',
price2: '26500'
})
};
fetch('https://api.kraken.com/0/private/EditOrder', 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/EditOrder"
payload := strings.NewReader("{\n \"nonce\": 1695828490,\n \"pair\": \"XBTUSD\",\n \"txid\": \"OHYO67-6LP66-HMQ437\",\n \"volume\": \"1.25\",\n \"price\": \"27500\",\n \"price2\": \"26500\"\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": {
"status": "ok",
"txid": "OFVXHJ-KPQ3B-VS7ELA",
"originaltxid": "OHYO67-6LP66-HMQ437",
"volume": "0.00030000",
"price": "19500.0",
"price2": "32500.0",
"orders_cancelled": 1,
"descr": {
"order": "buy 0.00030000 XXBTZGBP @ limit 19500.0"
}
}
}Authorizations
Body
application/json
Price:
- Limit price for
limitandicebergorders - Trigger price for
stop-loss,stop-loss-limit,take-profit,take-profit-limit,trailing-stopandtrailing-stop-limitorders
Notes:
- Relative Prices: Either
priceorprice2can be preceded by+,-, or#to specify the order price as an offset relative to the last traded price.+adds the amount to, and-subtracts the amount from the last traded price.#will either add or subtract the amount to the last traded price, depending on the direction and order type used. Prices can also be suffixed with a%to signify the relative amount as a percentage, rather than an absolute price difference. - Trailing Stops: Must use a relative price for this field, namely the
+prefix, from which the direction will be automatic based on if the original order is a buy or sell (no need to use-or#). The%suffix also works for these order types to use a relative percentage price.
Secondary Price:
- Limit price for
stop-loss-limit,take-profit-limitandtrailing-stop-limitorders Note: - Trailing Stops: Must use a relative price for this field, namely one of the
+or-prefixes. This will provide the offset from the trigger price to the limit price, i.e. +0 would set the limit price equal to the trigger price. The%suffix also works for this field to use a relative percentage limit price.
⌘I
Edit Order
curl --request POST \
--url https://api.kraken.com/0/private/EditOrder \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 1695828490,
"pair": "XBTUSD",
"txid": "OHYO67-6LP66-HMQ437",
"volume": "1.25",
"price": "27500",
"price2": "26500"
}
'import requests
url = "https://api.kraken.com/0/private/EditOrder"
payload = {
"nonce": 1695828490,
"pair": "XBTUSD",
"txid": "OHYO67-6LP66-HMQ437",
"volume": "1.25",
"price": "27500",
"price2": "26500"
}
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,
pair: 'XBTUSD',
txid: 'OHYO67-6LP66-HMQ437',
volume: '1.25',
price: '27500',
price2: '26500'
})
};
fetch('https://api.kraken.com/0/private/EditOrder', 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/EditOrder"
payload := strings.NewReader("{\n \"nonce\": 1695828490,\n \"pair\": \"XBTUSD\",\n \"txid\": \"OHYO67-6LP66-HMQ437\",\n \"volume\": \"1.25\",\n \"price\": \"27500\",\n \"price2\": \"26500\"\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": {
"status": "ok",
"txid": "OFVXHJ-KPQ3B-VS7ELA",
"originaltxid": "OHYO67-6LP66-HMQ437",
"volume": "0.00030000",
"price": "19500.0",
"price2": "32500.0",
"orders_cancelled": 1,
"descr": {
"order": "buy 0.00030000 XXBTZGBP @ limit 19500.0"
}
}
}