Fetch orderbook stats
curl --request GET \
--url https://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_statsimport requests
url = "https://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats', 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://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats",
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://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats"
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://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats")
.asString();require 'uri'
require 'net/http'
url = URI("https://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats")
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{
"ask_depth": 123,
"asset_id": "<string>",
"bid_depth": 123,
"openpx_ts": "2023-11-07T05:31:56Z",
"best_ask": 123,
"best_bid": 123,
"exchange_ts": "2023-11-07T05:31:56Z",
"imbalance": 123,
"mid": 123,
"spread_bps": 123,
"weighted_mid": 123
}{
"kind": "Authentication",
"message": "<string>"
}Orderbook
fetch_orderbook_stats
Snapshot stats: top-of-book, mid, spread (bps), size-weighted mid, top-10 imbalance, and total depth.
GET
/
v1
/
orderbook
/
fetch_orderbook_stats
Fetch orderbook stats
curl --request GET \
--url https://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_statsimport requests
url = "https://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats', 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://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats",
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://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats"
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://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats")
.asString();require 'uri'
require 'net/http'
url = URI("https://github.com/openpx-trade/openpx/v1/orderbook/fetch_orderbook_stats")
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{
"ask_depth": 123,
"asset_id": "<string>",
"bid_depth": 123,
"openpx_ts": "2023-11-07T05:31:56Z",
"best_ask": 123,
"best_bid": 123,
"exchange_ts": "2023-11-07T05:31:56Z",
"imbalance": 123,
"mid": 123,
"spread_bps": 123,
"weighted_mid": 123
}{
"kind": "Authentication",
"message": "<string>"
}Snapshot stats: top-of-book, mid, spread (bps), size-weighted mid, top-10 imbalance, and total depth.
Query Parameters
Response
Success.
Top-of-book snapshot stats for one asset.
Total resting ask size in contracts (e.g. 1000.0).
Orderable asset id (e.g. "KXBTCD-25APR1517").
Total resting bid size in contracts (e.g. 1000.0).
Wall-clock time OpenPX served the response (UTC).
Best ask as YES probability (e.g. 0.63).
Best bid as YES probability (e.g. 0.61).
Upstream snapshot time in UTC; null when not provided.
Top-10 imbalance in [-1, 1] (positive = bid-heavy) (e.g. 0.12).
Mid price as YES probability (e.g. 0.62).
Spread in basis points relative to mid (e.g. 400.0).
Size-weighted mid using the top-10 levels (e.g. 0.62).

