xo-orderbook-client-rs
// Requires an authenticated client.
use xo_orderbook_client::orderbook::types::request::CancelMarketOrderRequest;
use xo_orderbook_client::types::U256;
let token_id = U256::from_str_radix(
"26516164265702901957933644848127860370782874751279270726689263951695181556943",
10,
)?;
let resp = client
.cancel_market_orders(&CancelMarketOrderRequest {
market: "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb".to_owned(),
asset_id: Some(token_id),
})
.await?;
curl --request DELETE \
--url https://orderbooks.xo.market/cancel-market-orders \
--header 'Content-Type: application/json' \
--data '
{
"marketId": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"signature": "0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b",
"signatureType": 3,
"signer": "0xCAFE000000000000000000000000000000000A11"
}
'import requests
url = "https://orderbooks.xo.market/cancel-market-orders"
payload = {
"marketId": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"signature": "0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b",
"signatureType": 3,
"signer": "0xCAFE000000000000000000000000000000000A11"
}
headers = {"Content-Type": "application/json"}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
marketId: '0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb',
signature: '0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b',
signatureType: 3,
signer: '0xCAFE000000000000000000000000000000000A11'
})
};
fetch('https://orderbooks.xo.market/cancel-market-orders', 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://orderbooks.xo.market/cancel-market-orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'marketId' => '0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb',
'signature' => '0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b',
'signatureType' => 3,
'signer' => '0xCAFE000000000000000000000000000000000A11'
]),
CURLOPT_HTTPHEADER => [
"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://orderbooks.xo.market/cancel-market-orders"
payload := strings.NewReader("{\n \"marketId\": \"0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb\",\n \"signature\": \"0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b\",\n \"signatureType\": 3,\n \"signer\": \"0xCAFE000000000000000000000000000000000A11\"\n}")
req, _ := http.NewRequest("DELETE", url, payload)
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.delete("https://orderbooks.xo.market/cancel-market-orders")
.header("Content-Type", "application/json")
.body("{\n \"marketId\": \"0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb\",\n \"signature\": \"0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b\",\n \"signatureType\": 3,\n \"signer\": \"0xCAFE000000000000000000000000000000000A11\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/cancel-market-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"marketId\": \"0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb\",\n \"signature\": \"0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b\",\n \"signatureType\": 3,\n \"signer\": \"0xCAFE000000000000000000000000000000000A11\"\n}"
response = http.request(request)
puts response.read_body{
"canceled": [
"101",
"102"
],
"notCanceled": {}
}Trade
Cancel orders for a market
Cancel every order the caller has on one market.
DELETE
/
cancel-market-orders
xo-orderbook-client-rs
// Requires an authenticated client.
use xo_orderbook_client::orderbook::types::request::CancelMarketOrderRequest;
use xo_orderbook_client::types::U256;
let token_id = U256::from_str_radix(
"26516164265702901957933644848127860370782874751279270726689263951695181556943",
10,
)?;
let resp = client
.cancel_market_orders(&CancelMarketOrderRequest {
market: "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb".to_owned(),
asset_id: Some(token_id),
})
.await?;
curl --request DELETE \
--url https://orderbooks.xo.market/cancel-market-orders \
--header 'Content-Type: application/json' \
--data '
{
"marketId": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"signature": "0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b",
"signatureType": 3,
"signer": "0xCAFE000000000000000000000000000000000A11"
}
'import requests
url = "https://orderbooks.xo.market/cancel-market-orders"
payload = {
"marketId": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"signature": "0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b",
"signatureType": 3,
"signer": "0xCAFE000000000000000000000000000000000A11"
}
headers = {"Content-Type": "application/json"}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
marketId: '0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb',
signature: '0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b',
signatureType: 3,
signer: '0xCAFE000000000000000000000000000000000A11'
})
};
fetch('https://orderbooks.xo.market/cancel-market-orders', 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://orderbooks.xo.market/cancel-market-orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'marketId' => '0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb',
'signature' => '0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b',
'signatureType' => 3,
'signer' => '0xCAFE000000000000000000000000000000000A11'
]),
CURLOPT_HTTPHEADER => [
"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://orderbooks.xo.market/cancel-market-orders"
payload := strings.NewReader("{\n \"marketId\": \"0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb\",\n \"signature\": \"0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b\",\n \"signatureType\": 3,\n \"signer\": \"0xCAFE000000000000000000000000000000000A11\"\n}")
req, _ := http.NewRequest("DELETE", url, payload)
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.delete("https://orderbooks.xo.market/cancel-market-orders")
.header("Content-Type", "application/json")
.body("{\n \"marketId\": \"0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb\",\n \"signature\": \"0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b\",\n \"signatureType\": 3,\n \"signer\": \"0xCAFE000000000000000000000000000000000A11\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/cancel-market-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"marketId\": \"0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb\",\n \"signature\": \"0xa1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f901b\",\n \"signatureType\": 3,\n \"signer\": \"0xCAFE000000000000000000000000000000000A11\"\n}"
response = http.request(request)
puts response.read_body{
"canceled": [
"101",
"102"
],
"notCanceled": {}
}Body
application/json
Response
OK
Wire shape uses camelCase (canceled / notCanceled) per the
CLOB SDK contract. American spelling — one l (NOT cancelled).
Shared by DELETE /order, DELETE /orders, DELETE /cancel-all,
DELETE /cancel-market-orders.