use xo_orderbook_client::orderbook::{Client, Config};
use xo_orderbook_client::orderbook::types::request::OrderBookSummaryRequest;
use xo_orderbook_client::types::U256;
let client = Client::new("https://orderbooks.xo.market", Config::default())?;
let token_id = U256::from_str_radix(
"26516164265702901957933644848127860370782874751279270726689263951695181556943",
10,
)?;
let book = client
.order_book(&OrderBookSummaryRequest { token_id })
.await?;
println!("best bid: {:?}", book.bids.first());
println!("best ask: {:?}", book.asks.first());
curl --request GET \
--url https://orderbooks.xo.market/bookimport requests
url = "https://orderbooks.xo.market/book"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/book', 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/book",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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/book"
req, _ := http.NewRequest("GET", url, nil)
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/book")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/book")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"market": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"asset_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"timestamp": "1779355812367",
"hash": "86abb2eec0fed47888ef100977aa363345a032f35a53976d88e951c28bb57ab9",
"bids": [
{
"price": "0.547",
"size": "120"
},
{
"price": "0.546",
"size": "350"
},
{
"price": "0.540",
"size": "1200"
}
],
"asks": [
{
"price": "0.553",
"size": "95"
},
{
"price": "0.554",
"size": "410"
},
{
"price": "0.560",
"size": "2000"
}
],
"min_order_size": "5",
"tick_size": "0.001",
"neg_risk": false,
"last_trade_price": "0.550"
}Get order book
Full order book for a token. Returns an empty bids/asks array
when no orders are resting. Returns 404 with the message
"No orderbook exists for the requested token id" when the
token is unknown to the engine.
use xo_orderbook_client::orderbook::{Client, Config};
use xo_orderbook_client::orderbook::types::request::OrderBookSummaryRequest;
use xo_orderbook_client::types::U256;
let client = Client::new("https://orderbooks.xo.market", Config::default())?;
let token_id = U256::from_str_radix(
"26516164265702901957933644848127860370782874751279270726689263951695181556943",
10,
)?;
let book = client
.order_book(&OrderBookSummaryRequest { token_id })
.await?;
println!("best bid: {:?}", book.bids.first());
println!("best ask: {:?}", book.asks.first());
curl --request GET \
--url https://orderbooks.xo.market/bookimport requests
url = "https://orderbooks.xo.market/book"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/book', 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/book",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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/book"
req, _ := http.NewRequest("GET", url, nil)
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/book")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/book")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"market": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"asset_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"timestamp": "1779355812367",
"hash": "86abb2eec0fed47888ef100977aa363345a032f35a53976d88e951c28bb57ab9",
"bids": [
{
"price": "0.547",
"size": "120"
},
{
"price": "0.546",
"size": "350"
},
{
"price": "0.540",
"size": "1200"
}
],
"asks": [
{
"price": "0.553",
"size": "95"
},
{
"price": "0.554",
"size": "410"
},
{
"price": "0.560",
"size": "2000"
}
],
"min_order_size": "5",
"tick_size": "0.001",
"neg_risk": false,
"last_trade_price": "0.550"
}Query Parameters
Response
OK
conditionId
Decimal U256 token id
Sorted ascending by price (best ask first).
Show child attributes
Show child attributes
Sorted descending by price (best bid first).
Show child attributes
Show child attributes
keccak256 of {bids ++ asks ++ timestamp}; bumps on every book change.
Unix milliseconds, stringified (TimestampMilliSeconds)
"0.001"
Minimum order size in human shares (decimal-string integer).
Returns "0" when the gateway has no MarketInfo for the
token yet (e.g. very fresh markets) — populated once
engine MarketInfo arrives.
Always false on XO.
Trimmed decimal; "0.000" if no trades have ever printed on this token.