curl --request PATCH \
--url https://api.ondoperps.xyz/v1/perps/stop_order/{orderID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"triggerPrice": "195.00",
"version": 0
}
'import requests
url = "https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}"
payload = {
"triggerPrice": "195.00",
"version": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({triggerPrice: '195.00', version: 0})
};
fetch('https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'triggerPrice' => '195.00',
'version' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}"
payload := strings.NewReader("{\n \"triggerPrice\": \"195.00\",\n \"version\": 0\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.patch("https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"triggerPrice\": \"195.00\",\n \"version\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"triggerPrice\": \"195.00\",\n \"version\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": {
"orderId": "3f1c2b9a7d4e4f6a8b0c1d2e3f4a5b6c",
"side": "sell",
"price": "0",
"market": "AAPL-USD.P",
"filledSize": "0",
"lastFillSize": "0",
"filledCost": "0",
"fee": "0",
"status": "untriggered",
"createdAt": "2025-03-05T14:30:00Z",
"type": "stopMarket",
"closePosition": true,
"stopOrderType": "stopLoss",
"triggerPrice": "195.00",
"version": 1
}
}{
"success": false,
"error": "Description of the error",
"error_code": "amend_no_change"
}{
"success": false,
"error": "Description of the error",
"error_code": "auth_missing"
}{
"success": false,
"error": "Description of the error",
"error_code": "feature_disabled"
}{
"success": false,
"error": "Description of the error",
"error_code": "order_not_found"
}{
"success": false,
"error": "the stop order is at version 1, not 0: it was amended since",
"error_code": "amend_version_mismatch"
}{
"success": false,
"error": "Description of the error",
"error_code": "too_many_requests"
}Amend Stop Order
Changes the trigger price, and for some stop orders the quantity, of a take profit or stop loss in place. The stop order keeps its orderId. The orderID path parameter is the stop order’s internal order ID: Set Stop Order returns it as orderId, and Get Orders lists stop orders with their IDs.
Send triggerPrice, quantity, or both, with the stop order’s current version. A field you omit keeps its current value. A take profit and a stop loss are separate stop orders, so changing both takes two requests.
Which stop orders. You can amend a stop order that has not triggered:
- A position take profit or stop loss set with Set Stop Order (
status: untriggered). - A take profit or stop loss attached to an order with
takeProfitorstopLoss, while that order rests on the book, filled or not (status: pending), and after the order has fully filled and the stop order is armed (status: untriggered).
A stop order that has triggered or been canceled returns order_not_amendable, as does an order that is not a stop order: amend a limit order with Amend Order (PATCH /v1/perps/orders/{orderID}).
Versions. Every amend increments the stop order’s version. A stop order that was never amended is at version 0 and omits the field. If the stop order was amended after the version you send, the request returns 409 amend_version_mismatch and changes nothing. Read the stop order again before you retry.
Trigger price. A new trigger price must be aligned to the market’s price increment. An untriggered stop order is checked as a new one is: a trigger price that the mark price has already reached, or that crosses the position’s other stop order, returns invalid_stop_order. A pending stop order is checked against its order’s limit price, as when the order was placed: for a buy order, a take profit above the price and a stop loss below it (for a sell order, the other way round), or the request returns stop_order_crosses_order_price. A pending stop order arms at its new trigger price when its order fills, and a later price amend of the order must stay between its trigger prices.
Quantity. quantity applies to an untriggered stop order that closes part of the position: one set with a quantity, or one attached to an order that has filled. It must be aligned to the market’s size increment and no larger than the position. A stop order that closes the whole position has no quantity, and a pending stop order always has its order’s total size, so both return amend_field_not_supported for quantity. To change a pending stop order’s size, amend its order’s size.
Each amend counts as one order addition against your account’s order-action rate limit. The amended stop order is published on ordersPerps in its current status, never as a cancel. Subscribe to orderAmendsPerps to receive each amend with the stop order’s previous trigger price and size.
curl --request PATCH \
--url https://api.ondoperps.xyz/v1/perps/stop_order/{orderID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"triggerPrice": "195.00",
"version": 0
}
'import requests
url = "https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}"
payload = {
"triggerPrice": "195.00",
"version": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({triggerPrice: '195.00', version: 0})
};
fetch('https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'triggerPrice' => '195.00',
'version' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}"
payload := strings.NewReader("{\n \"triggerPrice\": \"195.00\",\n \"version\": 0\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.patch("https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"triggerPrice\": \"195.00\",\n \"version\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ondoperps.xyz/v1/perps/stop_order/{orderID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"triggerPrice\": \"195.00\",\n \"version\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": {
"orderId": "3f1c2b9a7d4e4f6a8b0c1d2e3f4a5b6c",
"side": "sell",
"price": "0",
"market": "AAPL-USD.P",
"filledSize": "0",
"lastFillSize": "0",
"filledCost": "0",
"fee": "0",
"status": "untriggered",
"createdAt": "2025-03-05T14:30:00Z",
"type": "stopMarket",
"closePosition": true,
"stopOrderType": "stopLoss",
"triggerPrice": "195.00",
"version": 1
}
}{
"success": false,
"error": "Description of the error",
"error_code": "amend_no_change"
}{
"success": false,
"error": "Description of the error",
"error_code": "auth_missing"
}{
"success": false,
"error": "Description of the error",
"error_code": "feature_disabled"
}{
"success": false,
"error": "Description of the error",
"error_code": "order_not_found"
}{
"success": false,
"error": "the stop order is at version 1, not 0: it was amended since",
"error_code": "amend_version_mismatch"
}{
"success": false,
"error": "Description of the error",
"error_code": "too_many_requests"
}Authorizations
Path Parameters
Body
Send triggerPrice, quantity, or both. Any other field returns amend_field_not_supported.
New quantity of an untriggered stop order that closes part of the position, aligned to the market's size increment and no larger than the position. Omit to keep the current quantity. A stop order that closes the whole position, and a pending stop order, which has its order's size, return amend_field_not_supported.
"0.5"
Response
Amended stop order