xo-orderbook-client-rs
use xo_orderbook_client::orderbook::{Client, Config};
use xo_orderbook_client::orderbook::types::request::LastTradePriceRequest;
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 resp = client
.last_trade_price(&LastTradePriceRequest { token_id })
.await?;
// Defaults to price="0.5", side="" when the token has never traded.
curl --request GET \
--url https://orderbooks.xo.market/last-trade-priceimport requests
url = "https://orderbooks.xo.market/last-trade-price"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/last-trade-price', 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/last-trade-price",
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/last-trade-price"
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/last-trade-price")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/last-trade-price")
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{
"price": "0.553",
"side": "BUY"
}Market Data
Get last trade price
Last trade price and side. Defaults to "0.5" (NOT "0.000")
and side "" when no trade has printed — matching the
canonical CLOB sentinel. Compare with /book’s
last_trade_price: "0.000" empty default.
GET
/
last-trade-price
xo-orderbook-client-rs
use xo_orderbook_client::orderbook::{Client, Config};
use xo_orderbook_client::orderbook::types::request::LastTradePriceRequest;
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 resp = client
.last_trade_price(&LastTradePriceRequest { token_id })
.await?;
// Defaults to price="0.5", side="" when the token has never traded.
curl --request GET \
--url https://orderbooks.xo.market/last-trade-priceimport requests
url = "https://orderbooks.xo.market/last-trade-price"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/last-trade-price', 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/last-trade-price",
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/last-trade-price"
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/last-trade-price")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/last-trade-price")
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{
"price": "0.553",
"side": "BUY"
}