xo-orderbook-client-rs
use xo_orderbook_client::orderbook::{Client, Config};
use xo_orderbook_client::orderbook::types::request::SpreadRequest;
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.spread(&SpreadRequest { token_id }).await?;
println!("spread: {}", resp.spread);
curl --request GET \
--url https://orderbooks.xo.market/spreadimport requests
url = "https://orderbooks.xo.market/spread"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/spread', 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/spread",
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/spread"
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/spread")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/spread")
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{
"spread": "0.006"
}
Market Data
Get spread
best_ask - best_bid as a trimmed decimal string. Note: the
empty-book default is a bare "0" (not "0.000").
GET
/
spread
xo-orderbook-client-rs
use xo_orderbook_client::orderbook::{Client, Config};
use xo_orderbook_client::orderbook::types::request::SpreadRequest;
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.spread(&SpreadRequest { token_id }).await?;
println!("spread: {}", resp.spread);
curl --request GET \
--url https://orderbooks.xo.market/spreadimport requests
url = "https://orderbooks.xo.market/spread"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/spread', 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/spread",
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/spread"
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/spread")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/spread")
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{
"spread": "0.006"
}