xo-orderbook-client-rs
use xo_orderbook_client::orderbook::{Client, Config};
use xo_orderbook_client::orderbook::types::request::PriceHistoryRequest;
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 history = client
.price_history(&PriceHistoryRequest {
market: token_id,
interval: Some("1h".to_owned()),
fidelity: Some(60),
..Default::default()
})
.await?;
// Each point: { t: unix_seconds, p: price_string }
curl --request GET \
--url https://orderbooks.xo.market/prices-historyimport requests
url = "https://orderbooks.xo.market/prices-history"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/prices-history', 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/prices-history",
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/prices-history"
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/prices-history")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/prices-history")
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{
"history": [
{
"t": 1779355760,
"p": "0.548"
},
{
"t": 1779355770,
"p": "0.549"
},
{
"t": 1779355780,
"p": "0.550"
},
{
"t": 1779355790,
"p": "0.551"
},
{
"t": 1779355800,
"p": "0.553"
},
{
"t": 1779355810,
"p": "0.550"
}
]
}Market Data
Get price history
Time-bucketed price history for an outcome token. Field names
are t (Unix seconds) and p (price string) — NOT timestamp
/ price (the CLOB SDK uses single-character keys).
GET
/
prices-history
xo-orderbook-client-rs
use xo_orderbook_client::orderbook::{Client, Config};
use xo_orderbook_client::orderbook::types::request::PriceHistoryRequest;
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 history = client
.price_history(&PriceHistoryRequest {
market: token_id,
interval: Some("1h".to_owned()),
fidelity: Some(60),
..Default::default()
})
.await?;
// Each point: { t: unix_seconds, p: price_string }
curl --request GET \
--url https://orderbooks.xo.market/prices-historyimport requests
url = "https://orderbooks.xo.market/prices-history"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/prices-history', 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/prices-history",
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/prices-history"
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/prices-history")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/prices-history")
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{
"history": [
{
"t": 1779355760,
"p": "0.548"
},
{
"t": 1779355770,
"p": "0.549"
},
{
"t": 1779355780,
"p": "0.550"
},
{
"t": 1779355790,
"p": "0.551"
},
{
"t": 1779355800,
"p": "0.553"
},
{
"t": 1779355810,
"p": "0.550"
}
]
}