xo-orderbook-client-rs
// No dedicated single-trade method in the SDK. Filter the
// paginated trades feed by id client-side.
use xo_orderbook_client::orderbook::types::request::TradesRequest;
let trade_id = "0xc0ffee0000000000000000000000000000000000000000000000000000000a11";
let page = client
.trades(&TradesRequest { id: Some(trade_id.to_owned()), ..Default::default() }, None)
.await?;
let trade = page.data.into_iter().find(|t| t.id == trade_id);curl --request GET \
--url https://orderbooks.xo.market/trades/{id} \
--header 'XO_API_KEY: <api-key>'import requests
url = "https://orderbooks.xo.market/trades/{id}"
headers = {"XO_API_KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {XO_API_KEY: '<api-key>'}};
fetch('https://orderbooks.xo.market/trades/{id}', 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/trades/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"XO_API_KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://orderbooks.xo.market/trades/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("XO_API_KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://orderbooks.xo.market/trades/{id}")
.header("XO_API_KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/trades/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["XO_API_KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "0xc0ffee0000000000000000000000000000000000000000000000000000000a11",
"market": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"outcome": "Yes",
"side": "BUY",
"price": "0.553",
"size": "15000000",
"status": "CONFIRMED",
"match_time": "1779355812",
"last_update": "1779355820",
"bucket_index": 0,
"transaction_hash": "0xdeadbeef000000000000000000000000000000000000000000000000000000c0",
"taker_order_id": "0xfeed00000000000000000000000000000000000000000000000000000000000a",
"asset_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"fee_rate_bps": "0",
"owner": "346629a1-8226-5a85-823f-3a25ae818e10",
"maker_address": "0xBEEF000000000000000000000000000000000B22",
"trader_side": "TAKER",
"maker_orders": [
{
"order_id": "77",
"maker_address": "0xBEEF000000000000000000000000000000000B22",
"owner": "9c4f0d6b-5a3e-5b8c-9e1d-2f3a4b5c6d7e",
"matched_amount": "15000000",
"price": "0.553",
"fee_rate_bps": "0",
"asset_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"outcome": "Yes"
}
]
}Trade
Get trade by ID
Get a trade by id.
GET
/
trades
/
{id}
xo-orderbook-client-rs
// No dedicated single-trade method in the SDK. Filter the
// paginated trades feed by id client-side.
use xo_orderbook_client::orderbook::types::request::TradesRequest;
let trade_id = "0xc0ffee0000000000000000000000000000000000000000000000000000000a11";
let page = client
.trades(&TradesRequest { id: Some(trade_id.to_owned()), ..Default::default() }, None)
.await?;
let trade = page.data.into_iter().find(|t| t.id == trade_id);curl --request GET \
--url https://orderbooks.xo.market/trades/{id} \
--header 'XO_API_KEY: <api-key>'import requests
url = "https://orderbooks.xo.market/trades/{id}"
headers = {"XO_API_KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {XO_API_KEY: '<api-key>'}};
fetch('https://orderbooks.xo.market/trades/{id}', 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/trades/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"XO_API_KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://orderbooks.xo.market/trades/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("XO_API_KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://orderbooks.xo.market/trades/{id}")
.header("XO_API_KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/trades/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["XO_API_KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "0xc0ffee0000000000000000000000000000000000000000000000000000000a11",
"market": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"outcome": "Yes",
"side": "BUY",
"price": "0.553",
"size": "15000000",
"status": "CONFIRMED",
"match_time": "1779355812",
"last_update": "1779355820",
"bucket_index": 0,
"transaction_hash": "0xdeadbeef000000000000000000000000000000000000000000000000000000c0",
"taker_order_id": "0xfeed00000000000000000000000000000000000000000000000000000000000a",
"asset_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"fee_rate_bps": "0",
"owner": "346629a1-8226-5a85-823f-3a25ae818e10",
"maker_address": "0xBEEF000000000000000000000000000000000B22",
"trader_side": "TAKER",
"maker_orders": [
{
"order_id": "77",
"maker_address": "0xBEEF000000000000000000000000000000000B22",
"owner": "9c4f0d6b-5a3e-5b8c-9e1d-2f3a4b5c6d7e",
"matched_amount": "15000000",
"price": "0.553",
"fee_rate_bps": "0",
"asset_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"outcome": "Yes"
}
]
}Authorizations
L2 HMAC request signature. See Authentication.
Path Parameters
Response
OK
0x-prefixed 32-byte trade id
conditionId
Available options:
BUY, SELL Available options:
MATCHED, MINED, CONFIRMED, RETRYING, FAILED Unix seconds, stringified (TimestampSeconds)
Unix seconds, stringified
Hardcoded 0 until per-trade buckets are introduced
Compatibility field. Always "0" — signed orders no longer carry
a fee rate. See the Fees guide for how settlement fees are charged.
UUIDv5 of the authenticated caller's user id
Available options:
MAKER, TAKER Show child attributes
Show child attributes