cancel_all_orders
cancel_all_orders cancel_by
The cancel_all_orders cancels the active orders created by the Komodo DeFi Framework API node by specified condition.
Arguments
| Structure | Type | Description |
|---|---|---|
| cancel_by | object | A standard CancelBy object. Orders matching this filter are cancelled. |
Response
| Structure | Type | Description |
|---|---|---|
| cancelled | array of strings (uuids) | uuids of cancelled orders |
| currently_matching | array of strings (uuids) | uuids of the orders being matched with other orders; these are not cancelled even if they fit cancel condition |
📌 Examples
Command (All orders)
POST cancel_all_orders
{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "All"
}
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "All"
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "All"
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "All"
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "All"
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","method":"cancel_all_orders","cancel_by":{"type":"All"}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "All"
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Command (Cancel by pair)
POST cancel_all_orders
{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Pair",
"data": {
"base": "DOC",
"rel": "MARTY"
}
}
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Pair",
"data": {
"base": "DOC",
"rel": "MARTY"
}
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Pair",
"data": {
"base": "DOC",
"rel": "MARTY"
}
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Pair",
"data": {
"base": "DOC",
"rel": "MARTY"
}
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Pair",
"data": {
"base": "DOC",
"rel": "MARTY"
}
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","method":"cancel_all_orders","cancel_by":{"type":"Pair","data":{"base":"DOC","rel":"MARTY"}}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Pair",
"data": {
"base": "DOC",
"rel": "MARTY"
}
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Command (Cancel by coin)
POST cancel_all_orders
{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Coin",
"data": {
"ticker": "DOC"
}
}
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Coin",
"data": {
"ticker": "DOC"
}
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Coin",
"data": {
"ticker": "DOC"
}
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Coin",
"data": {
"ticker": "DOC"
}
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Coin",
"data": {
"ticker": "DOC"
}
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","method":"cancel_all_orders","cancel_by":{"type":"Coin","data":{"ticker":"DOC"}}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "cancel_all_orders",
"cancel_by": {
"type": "Coin",
"data": {
"ticker": "DOC"
}
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response (1 order cancelled)
{
"result": {
"cancelled": ["2aae69d1-0167-493e-ad15-c6a8b43546d6"],
"currently_matching": []
}
}Response (1 order cancelled and 1 is currently matching)
{
"result": {
"cancelled": ["2aae69d1-0167-493e-ad15-c6a8b43546d6"],
"currently_matching": ["e9a6f422-e378-437f-bb74-ba4307a90e68"]
}
}