curl --request POST \
--url https://gateway.ai.exchange/orders/replace-order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"oid": "<string>",
"aid": "<string>",
"p": "<string>",
"po": true,
"q": 1
}
'import requests
url = "https://gateway.ai.exchange/orders/replace-order"
payload = {
"oid": "<string>",
"aid": "<string>",
"p": "<string>",
"po": True,
"q": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({oid: '<string>', aid: '<string>', p: '<string>', po: true, q: 1})
};
fetch('https://gateway.ai.exchange/orders/replace-order', 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://gateway.ai.exchange/orders/replace-order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'oid' => '<string>',
'aid' => '<string>',
'p' => '<string>',
'po' => true,
'q' => 1
]),
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://gateway.ai.exchange/orders/replace-order"
payload := strings.NewReader("{\n \"oid\": \"<string>\",\n \"aid\": \"<string>\",\n \"p\": \"<string>\",\n \"po\": true,\n \"q\": 1\n}")
req, _ := http.NewRequest("POST", 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.post("https://gateway.ai.exchange/orders/replace-order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"oid\": \"<string>\",\n \"aid\": \"<string>\",\n \"p\": \"<string>\",\n \"po\": true,\n \"q\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.ai.exchange/orders/replace-order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"oid\": \"<string>\",\n \"aid\": \"<string>\",\n \"p\": \"<string>\",\n \"po\": true,\n \"q\": 1\n}"
response = http.request(request)
puts response.read_body{
"oid": "<string>"
}Replace order
curl --request POST \
--url https://gateway.ai.exchange/orders/replace-order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"oid": "<string>",
"aid": "<string>",
"p": "<string>",
"po": true,
"q": 1
}
'import requests
url = "https://gateway.ai.exchange/orders/replace-order"
payload = {
"oid": "<string>",
"aid": "<string>",
"p": "<string>",
"po": True,
"q": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({oid: '<string>', aid: '<string>', p: '<string>', po: true, q: 1})
};
fetch('https://gateway.ai.exchange/orders/replace-order', 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://gateway.ai.exchange/orders/replace-order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'oid' => '<string>',
'aid' => '<string>',
'p' => '<string>',
'po' => true,
'q' => 1
]),
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://gateway.ai.exchange/orders/replace-order"
payload := strings.NewReader("{\n \"oid\": \"<string>\",\n \"aid\": \"<string>\",\n \"p\": \"<string>\",\n \"po\": true,\n \"q\": 1\n}")
req, _ := http.NewRequest("POST", 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.post("https://gateway.ai.exchange/orders/replace-order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"oid\": \"<string>\",\n \"aid\": \"<string>\",\n \"p\": \"<string>\",\n \"po\": true,\n \"q\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.ai.exchange/orders/replace-order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"oid\": \"<string>\",\n \"aid\": \"<string>\",\n \"p\": \"<string>\",\n \"po\": true,\n \"q\": 1\n}"
response = http.request(request)
puts response.read_body{
"oid": "<string>"
}Body
- Option 1
- Option 2
Request to amend a resting order's price, quantity, or time in force.
The amended order keeps the self_trade_prevention it was placed with. If
the amendment would trade against the same account's resting orders:
CancelIncoming(the default) rejects the amendment.CancelRestingcancels the account's resting orders and applies the amendment.CancelBothcancels the account's resting orders and rejects the amendment.
A rejected amendment leaves the order resting unchanged, at its previous
price and quantity, and is reported with a CancelRejected (t = "e")
event.
Optional account ID, selecting which account's cid namespace the
reference resolves against. Only meaningful when the order is given by
cid — a cid is unique per account, not globally — and superfluous
when oid is supplied (server order ids are globally unique). If
omitted, the account is inferred from the connection: the user's default
account, or the session account for an account-scoped session.
Reprice behavior for the replacement when it enters the book.
This field applies to this request only. Unlike post_only, it does not
carry over from the original order. The original order used its reprice
behavior once, when it first entered the book.
The gateway uses this field only when post_only is true on this
request. Otherwise the gateway ignores it. The default is Reject.
Example: a replace that sends neither po nor rb enters the book with
reject-on-cross and reports rb: "rej". This is true even if the
original order was placed with bo or tbl.
rej, bo, tbl