xo-orderbook-client-rs
// XO-only endpoint — no dedicated SDK method. Hit it directly
// via reqwest using the same host the SDK is configured with.
use serde::Deserialize;
#[derive(Deserialize)]
struct PositionsResponse {
cash_balance: String,
positions: Vec<Position>,
}
#[derive(Deserialize)]
struct Position { token_id: String, balance: String, reserved: String }
let resp: PositionsResponse = reqwest::Client::new()
.get(format!("{}/positions", client.host()))
.query(&[("address", "0xCAFE000000000000000000000000000000000A11")])
.send().await?
.json().await?;
curl --request GET \
--url https://orderbooks.xo.market/positionsimport requests
url = "https://orderbooks.xo.market/positions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/positions', 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/positions",
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/positions"
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/positions")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/positions")
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{
"cash_balance": "12345678",
"positions": [
{
"token_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"balance": "50000000",
"reserved": "20000000"
},
{
"token_id": "13730057904096984444199595880113152612639388204530324084054099203558669491245",
"balance": "30000000",
"reserved": "0"
}
]
}Account
Get positions
Get the caller’s positions. balance is total shares held;
reserved is the subset earmarked against open SELL orders.
Free disposable balance is balance - reserved.
GET
/
positions
xo-orderbook-client-rs
// XO-only endpoint — no dedicated SDK method. Hit it directly
// via reqwest using the same host the SDK is configured with.
use serde::Deserialize;
#[derive(Deserialize)]
struct PositionsResponse {
cash_balance: String,
positions: Vec<Position>,
}
#[derive(Deserialize)]
struct Position { token_id: String, balance: String, reserved: String }
let resp: PositionsResponse = reqwest::Client::new()
.get(format!("{}/positions", client.host()))
.query(&[("address", "0xCAFE000000000000000000000000000000000A11")])
.send().await?
.json().await?;
curl --request GET \
--url https://orderbooks.xo.market/positionsimport requests
url = "https://orderbooks.xo.market/positions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/positions', 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/positions",
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/positions"
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/positions")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/positions")
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{
"cash_balance": "12345678",
"positions": [
{
"token_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"balance": "50000000",
"reserved": "20000000"
},
{
"token_id": "13730057904096984444199595880113152612639388204530324084054099203558669491245",
"balance": "30000000",
"reserved": "0"
}
]
}