Order book
curl --request GET \
--url https://relay.bayse.markets/v1/pm/booksimport requests
url = "https://relay.bayse.markets/v1/pm/books"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://relay.bayse.markets/v1/pm/books', 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://relay.bayse.markets/v1/pm/books",
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://relay.bayse.markets/v1/pm/books"
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://relay.bayse.markets/v1/pm/books")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/pm/books")
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[
{
"marketId": "660e8400-e29b-41d4-a716-446655440001",
"outcomeId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"timestamp": "2025-01-15T10:30:00Z",
"bids": [
{ "price": 0.70, "quantity": 200, "total": 140.0 },
{ "price": 0.69, "quantity": 450, "total": 310.5 },
{ "price": 0.68, "quantity": 300, "total": 204.0 },
{ "price": 0.67, "quantity": 600, "total": 402.0 },
{ "price": 0.65, "quantity": 1000, "total": 650.0 }
],
"asks": [
{ "price": 0.72, "quantity": 150, "total": 108.0 },
{ "price": 0.73, "quantity": 300, "total": 219.0 },
{ "price": 0.74, "quantity": 250, "total": 185.0 },
{ "price": 0.75, "quantity": 500, "total": 375.0 },
{ "price": 0.77, "quantity": 800, "total": 616.0 }
],
"lastTradedPrice": 0.71,
"lastTradedSide": "BUY"
}
]
Market data
Order book
Get the live order book for one or more outcomes (CLOB markets only)
GET
/
v1
/
pm
/
books
Order book
curl --request GET \
--url https://relay.bayse.markets/v1/pm/booksimport requests
url = "https://relay.bayse.markets/v1/pm/books"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://relay.bayse.markets/v1/pm/books', 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://relay.bayse.markets/v1/pm/books",
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://relay.bayse.markets/v1/pm/books"
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://relay.bayse.markets/v1/pm/books")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/pm/books")
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[
{
"marketId": "660e8400-e29b-41d4-a716-446655440001",
"outcomeId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"timestamp": "2025-01-15T10:30:00Z",
"bids": [
{ "price": 0.70, "quantity": 200, "total": 140.0 },
{ "price": 0.69, "quantity": 450, "total": 310.5 },
{ "price": 0.68, "quantity": 300, "total": 204.0 },
{ "price": 0.67, "quantity": 600, "total": 402.0 },
{ "price": 0.65, "quantity": 1000, "total": 650.0 }
],
"asks": [
{ "price": 0.72, "quantity": 150, "total": 108.0 },
{ "price": 0.73, "quantity": 300, "total": 219.0 },
{ "price": 0.74, "quantity": 250, "total": 185.0 },
{ "price": 0.75, "quantity": 500, "total": 375.0 },
{ "price": 0.77, "quantity": 800, "total": 616.0 }
],
"lastTradedPrice": 0.71,
"lastTradedSide": "BUY"
}
]
Authentication
No authentication required.Query parameters
One or more outcome UUIDs to fetch order books for (comma-separated). Outcome IDs are returned by List events and Get event.
Example request
curl "https://relay.bayse.markets/v1/pm/books?outcomeId[]=c3d4e5f6-a7b8-9012-cdef-123456789012&depth=5¤cy=USD"
const params = new URLSearchParams();
params.append('outcomeId[]', 'c3d4e5f6-a7b8-9012-cdef-123456789012');
params.append('outcomeId[]', 'd4e5f6a7-b8c9-0123-defa-234567890123');
params.append('depth', '5');
const response = await fetch(
`https://relay.bayse.markets/v1/pm/books?${params}`
);
const books = await response.json();
import requests
resp = requests.get(
'https://relay.bayse.markets/v1/pm/books',
params={
'outcomeId[]': [
'c3d4e5f6-a7b8-9012-cdef-123456789012',
'd4e5f6a7-b8c9-0123-defa-234567890123',
],
'depth': 5,
'currency': 'USD',
},
)
books = resp.json()
req, _ := http.NewRequest("GET", "https://relay.bayse.markets/v1/pm/books", nil)
q := req.URL.Query()
q.Add("outcomeId[]", "c3d4e5f6-a7b8-9012-cdef-123456789012")
q.Add("outcomeId[]", "d4e5f6a7-b8c9-0123-defa-234567890123")
q.Add("depth", "5")
q.Add("currency", "USD")
req.URL.RawQuery = q.Encode()
resp, _ := http.DefaultClient.Do(req)
Response
Returns an array of order books, one per requested outcome. Each book contains the top bids (buy orders) and asks (sell orders) at the requested depth.[
{
"marketId": "660e8400-e29b-41d4-a716-446655440001",
"outcomeId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"timestamp": "2025-01-15T10:30:00Z",
"bids": [
{ "price": 0.70, "quantity": 200, "total": 140.0 },
{ "price": 0.69, "quantity": 450, "total": 310.5 },
{ "price": 0.68, "quantity": 300, "total": 204.0 },
{ "price": 0.67, "quantity": 600, "total": 402.0 },
{ "price": 0.65, "quantity": 1000, "total": 650.0 }
],
"asks": [
{ "price": 0.72, "quantity": 150, "total": 108.0 },
{ "price": 0.73, "quantity": 300, "total": 219.0 },
{ "price": 0.74, "quantity": 250, "total": 185.0 },
{ "price": 0.75, "quantity": 500, "total": 375.0 },
{ "price": 0.77, "quantity": 800, "total": 616.0 }
],
"lastTradedPrice": 0.71,
"lastTradedSide": "BUY"
}
]
This endpoint is only meaningful for CLOB markets. AMM markets do not have an order book.