Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sx.bet/llms.txt

Use this file to discover all available pages before exploring further.

There are two ways to fetch odds depending on what you need:
EndpointUse when
GET /ordersYou need the full orderbook — all active orders, sizes, and individual order details
GET /orders/odds/bestYou only need the current best price for each outcome
All odds returned by the API are from the maker’s perspective. To get the taker odds on the opposite outcome, use: takerOdds = 1 - percentageOdds / 10^20. For example, if a maker is asking for 51% on outcome 1, a taker gets outcome 2 at 49%.
For live updates without polling, both endpoints have a corresponding WebSocket channel — covered in the Real-time best odds and Real-time orderbook sections below. Both assume a connected Centrifugo client; see Real-time Data → Getting started for auth and connection setup.

GET /orders

Use this when you need to inspect full order details — available sizes, fill status, or depth across both sides of a market. You can fetch orders for multiple markets at once, all orders for a specific event, or all orders posted by a specific maker address. See the full parameter reference →.
curl "https://api.sx.bet/orders?marketHashes=0x1a46..."
Like the percentageOdds value, totalBetSize and fillAmount are from the maker’s perspective. To calculate available taker liquidity, use: remainingTakerSpace = (totalBetSize - fillAmount) * 10^20 / percentageOdds - (totalBetSize - fillAmount)

GET /orders/odds/best

Use this when you only need the best available price on each side — for example, to check odds before placing a fill (see Filling Orders) or to scan for value across a league. Note that this endpoint only returns the best price, not available liquidity at that price. If you need to know how much you can fill at those odds, use GET /orders to fetch the full orderbook. See the full parameter reference →.
curl "https://api.sx.bet/orders/odds/best?marketHashes=0xbe62...&baseToken=0x6629..."

Real-time best odds

Subscribe to best_odds:global for live best-odds updates. Two things are specific to this channel:
  • No server-side history — recovery is unavailable, so re-seed from REST on every connect (not just failed recovery).
  • Field name differs between REST and WS — REST returns outcomeOne/outcomeTwo; WS publications use isMakerBettingOutcomeOne. Map between them when seeding state.
Each message is a complete replacement for that market/outcome, not a delta. Because there’s no history, messages can also arrive out of order — guard with updatedAt.
const sub = client.newSubscription("best_odds:global");

sub.on("publication", (ctx) => {
  for (const update of ctx.data) {
    const key = `${update.marketHash}:${update.isMakerBettingOutcomeOne}`;
    const existing = state[key];
    if (existing && update.updatedAt <= existing.updatedAt) continue;
    state[key] = update;
  }
});

sub.on("subscribed", async () => {
  const res = await fetch(`https://api.sx.bet/orders/odds/best?marketHashes=${marketHashes.join(",")}&baseToken=${baseToken}`);
  const { data } = await res.json();
  for (const market of data.bestOdds) {
    state[`${market.marketHash}:true`]  = { marketHash: market.marketHash, isMakerBettingOutcomeOne: true,  percentageOdds: market.outcomeOne.percentageOdds, updatedAt: market.outcomeOne.updatedAt };
    state[`${market.marketHash}:false`] = { marketHash: market.marketHash, isMakerBettingOutcomeOne: false, percentageOdds: market.outcomeTwo.percentageOdds, updatedAt: market.outcomeTwo.updatedAt };
  }
});

sub.subscribe();
For client setup, see Real-time Data → Getting started. Payload reference: Best Odds →.

Real-time orderbook

Subscribe to order_book:market_{marketHash} with positioned: true, recoverable: true. Two things are specific to this channel:
  • History is enabled — Centrifugo replays missed publications on reconnect, so the subscribe-to-fetch race is handled automatically. No manual buffering needed unless you want belt-and-braces.
  • REST seed uses /orders?marketHashes={hash} — fetch only when wasRecovering && recovered is false.
const sub = client.newSubscription(`order_book:market_${marketHash}`, {
  positioned: true,
  recoverable: true,
});

sub.on("publication", (ctx) => applyUpdate(ctx.data));

sub.on("subscribed", async (ctx) => {
  if (ctx.wasRecovering && ctx.recovered) return; // history filled the gap
  const res = await fetch(`https://api.sx.bet/orders?marketHashes=${marketHash}`);
  applySnapshot(await res.json());
});

sub.subscribe();
For recovery state interpretation, dedup, and the buffered variant of this pattern, see Real-time Data → Snapshot + subscribe pattern. Payload reference: Order Book Updates →.

Real-time Data →

Full WebSocket guide: auth, connection, recovery, and channel reference.

Filling Orders →

Use best odds to find orders, then submit a fill.

Best Odds Payload →

Field-by-field reference for best_odds:global messages.

Order Book Payload →

Field-by-field reference for order_book:* messages.
Last modified on May 4, 2026