Get Orderbook
curl --request GET \
--url https://api.limitless.exchange/markets/{slug}/orderbookimport requests
url = "https://api.limitless.exchange/markets/{slug}/orderbook"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.limitless.exchange/markets/{slug}/orderbook', 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://api.limitless.exchange/markets/{slug}/orderbook",
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://api.limitless.exchange/markets/{slug}/orderbook"
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://api.limitless.exchange/markets/{slug}/orderbook")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.limitless.exchange/markets/{slug}/orderbook")
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{
"adjustedMidpoint": 0.75,
"asks": [
{
"price": 0.74,
"size": 150000000,
"side": "BUY"
}
],
"bids": [
{
"price": 0.74,
"size": 150000000,
"side": "BUY"
}
],
"lastTradePrice": 0.75,
"maxSpread": "0.035",
"midpoint": 0.75,
"minSize": "100000000",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627"
}{
"message": "Market is not active"
}{
"message": "Market not found"
}{
"message": "<string>"
}Trading
Get Orderbook
Retrieve the current LIVE GTC YES-side order book for one exact active CLOB market slug. The separately produced last mined trade price may be null without failing the request.
GET
/
markets
/
{slug}
/
orderbook
Get Orderbook
curl --request GET \
--url https://api.limitless.exchange/markets/{slug}/orderbookimport requests
url = "https://api.limitless.exchange/markets/{slug}/orderbook"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.limitless.exchange/markets/{slug}/orderbook', 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://api.limitless.exchange/markets/{slug}/orderbook",
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://api.limitless.exchange/markets/{slug}/orderbook"
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://api.limitless.exchange/markets/{slug}/orderbook")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.limitless.exchange/markets/{slug}/orderbook")
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{
"adjustedMidpoint": 0.75,
"asks": [
{
"price": 0.74,
"size": 150000000,
"side": "BUY"
}
],
"bids": [
{
"price": 0.74,
"size": 150000000,
"side": "BUY"
}
],
"lastTradePrice": 0.75,
"maxSpread": "0.035",
"midpoint": 0.75,
"minSize": "100000000",
"tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627"
}{
"message": "Market is not active"
}{
"message": "Market not found"
}{
"message": "<string>"
}For real-time orderbook updates, use the WebSocket API instead of polling this endpoint. Subscribe to
subscribe_market_prices with marketSlugs. Subscribing also pushes this book once per slug as an initial orderbookUpdate, so you do not need this endpoint to seed local state.Current snapshot only, one market per request. This endpoint returns the current LIVE GTC orderbook for one exact CLOB market slug. There is no batched form that accepts multiple slugs; to follow several markets at once use the WebSocket subscription above. It does not aggregate a group slug, and AMM markets do not have an orderbook. CLOB markets are available only while their status is
CREATED or FUNDED.There is no historical orderbook endpoint. For past activity on a market, combine three sources:- Get Historical Prices for price series.
- Get Feed Events for trade events.
- Get History for your own CLOB fills (filter
strategyonLimit Buy/Limit Sell/Market Buy/Market Sell).
Units
Each level’ssize is in raw 6-decimal position-token units: 1 share = 1,000,000, so "size": 150000000 is 150 shares. Divide by 1e6 to get shares. minSize uses the same units. price is a plain decimal between 0 and 1 and is not scaled.
minSize and maxSpread are returned as decimal strings. The WebSocket orderbookUpdate frames, including the initial snapshot, use the same size units, but minSize and maxSpread can arrive there as JSON numbers, so accept either form.
Snapshot and price freshness
lastTradePrice is a nullable YES-equivalent price and is not guaranteed to represent the same point in time as the order-book levels. No bound on response freshness is guaranteed.
midpoint uses the best displayed bid and ask. adjustedMidpoint excludes individual orders smaller than minSize before price-level aggregation and midpoint calculation. Every bid level has side: "BUY"; every ask level has side: "SELL".
Complementary token prices (deriving the NO book)
This endpoint returns a single, YES-side book. ThetokenId in the response is the market’s YES position ID, and bids/asks are quoted in YES-token terms. The two outcome tokens are complementary: a YES share and a NO share always redeem together for exactly $1. Their prices therefore satisfy:
price(YES) + price(NO) = 1
NO bid @ P ≡ YES ask @ (1 - P) (someone bidding for NO is offering YES)
NO ask @ P ≡ YES bid @ (1 - P) (someone offering NO is bidding for YES)
Deriving the NO orderbook
To quote or trade the NO token, mirror the returned YES book: flip bids ↔ asks and replace every pricep with 1 - p (sizes are unchanged).
| NO book | Derived from | Best level |
|---|---|---|
| NO bids (orders to buy NO) | YES asks | best NO bid = 1 - bestYesAsk |
| NO asks (orders to sell NO) | YES bids | best NO ask = 1 - bestYesBid |
noMidpoint = 1 - yesMidpoint, and the spread is identical.
type Level = { price: number; size: number; side: "BUY" | "SELL" };
type Book = { bids: Level[]; asks: Level[] };
// Mirror the YES-side book into the NO-side book.
function deriveNoBook(yes: Book): Book {
const invert = (l: Level): Level => ({
price: 1 - l.price,
size: l.size,
side: l.side === "BUY" ? "SELL" : "BUY",
});
return {
bids: yes.asks.map(invert).sort((a, b) => b.price - a.price), // best (highest) first
asks: yes.bids.map(invert).sort((a, b) => a.price - b.price), // best (lowest) first
};
}
// To SELL NO, hit the best NO bid: 1 - bestYesAsk
// To BUY NO, lift the best NO ask: 1 - bestYesBid
def derive_no_book(yes: dict) -> dict:
"""Mirror the YES-side book into the NO-side book."""
invert = lambda l: {
"price": 1 - l["price"],
"size": l["size"],
"side": "SELL" if l["side"] == "BUY" else "BUY",
}
return {
"bids": sorted((invert(a) for a in yes["asks"]), key=lambda l: -l["price"]), # best first
"asks": sorted((invert(b) for b in yes["bids"]), key=lambda l: l["price"]), # best first
}
# To SELL NO, hit the best NO bid: 1 - best_yes_ask
# To BUY NO, lift the best NO ask: 1 - best_yes_bid
tokenId (noPositionId from Get Market) at the derived price. The price inversion only affects how you read the book, not how the order is signed.
Multi-outcome (NegRisk) markets
In a NegRisk multi-outcome market, each outcome is its own market with its own slug, its own YES/NO tokens, and its own orderbook. Fetch each outcome’s book by its slug and derive that outcome’s NO book with the same inversion above. There is no single cross-outcome book to invert. What links the outcomes is a soft pricing constraint, not a shared book. Across the N outcomes, the YES prices tend toward summing to 1 (exactly one outcome resolves YES). All the NO contracts are linked for share conversion. To assemble a full picture of a multi-outcome market, request the orderbook for each outcome slug and mirror each one independently.Errors
| Status | Meaning |
|---|---|
400 | The exact market is an AMM (Market does not support orderbook (AMM market)) or its CLOB status is not CREATED or FUNDED (Market is not active). |
404 | No exact market has the slug (Market not found). A group slug also produces this response. |
500 | The orderbook could not be read unexpectedly. |
Path Parameters
Response
Current orderbook with bids and asks