xo-orderbook-client-rs
use xo_orderbook_client::orderbook::{Client, Config};
let client = Client::new("https://orderbooks.xo.market", Config::default())?;
let market = client
.market("0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb")
.await?;
for token in &market.tokens {
println!("{}: {}", token.outcome, token.price);
}curl --request GET \
--url https://orderbooks.xo.market/markets/{condition_id}import requests
url = "https://orderbooks.xo.market/markets/{condition_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/markets/{condition_id}', 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/markets/{condition_id}",
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/markets/{condition_id}"
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/markets/{condition_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/markets/{condition_id}")
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{
"condition_id": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"tokens": [
{
"token_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"outcome": "Yes",
"price": "0.5"
},
{
"token_id": "13730057904096984444199595880113152612639388204530324084054099203558669491245",
"outcome": "No",
"price": "0.5"
}
],
"minimum_tick_size": 0.001,
"neg_risk": false,
"active": true
}Markets
Get market
Get a market by its condition_id.
GET
/
markets
/
{condition_id}
xo-orderbook-client-rs
use xo_orderbook_client::orderbook::{Client, Config};
let client = Client::new("https://orderbooks.xo.market", Config::default())?;
let market = client
.market("0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb")
.await?;
for token in &market.tokens {
println!("{}: {}", token.outcome, token.price);
}curl --request GET \
--url https://orderbooks.xo.market/markets/{condition_id}import requests
url = "https://orderbooks.xo.market/markets/{condition_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://orderbooks.xo.market/markets/{condition_id}', 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/markets/{condition_id}",
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/markets/{condition_id}"
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/markets/{condition_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://orderbooks.xo.market/markets/{condition_id}")
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{
"condition_id": "0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb",
"tokens": [
{
"token_id": "26516164265702901957933644848127860370782874751279270726689263951695181556943",
"outcome": "Yes",
"price": "0.5"
},
{
"token_id": "13730057904096984444199595880113152612639388204530324084054099203558669491245",
"outcome": "No",
"price": "0.5"
}
],
"minimum_tick_size": 0.001,
"neg_risk": false,
"active": true
}