What is the orderbook?
The orderbook is the collection of all active, unfilled orders for a given market. Every order in the book is a maker’s open ask to bet on a specific outcome at specific odds.
When you fetch orders from the API, you’re reading the live orderbook from the maker’s perspective.
curl "https://api.sx.bet/orders?marketHashes={marketHash}"
Orders on the SX Bet API are always from the maker’s perspective.
Reading an order
Each order in the API response contains:
{
"orderHash": "0xc19c8838b4ec0f5b6f51e8a18d6ca9c46c9b7a2e1234567890abcdef12345678",
"marketHash": "0x6750c579d780a9b04fcda4f3e0428d9e5e0a6b1c2d3e4f5a6b7c8d9e0f1a2b3",
"maker": "0xE52ed002A3d13e3DB3F5A29F7c98A49B4e5C6D7E",
"totalBetSize": "50000000",
"percentageOdds": "51000000000000000000",
"fillAmount": "0",
"expiry": 2209006800,
"apiExpiry": 1772737200,
"baseToken": "0xe2aa35C25aE3d9f4386d4Df7fE1177A3d044f2e7",
"executor": "0x8f3Bc9b2E3e98765FAC412e1d0A3B5c6d7e8F9A0",
"salt": "69837538621348917669822801580188867159099562954597560424559338173619670254332",
"isMakerBettingOutcomeOne": false,
"signature": "0x4e8b3f2a1c9d7e6b5a4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b",
"sportXeventId": "L18148217"
}
The critical fields for understanding an order:
| Field | What it tells you |
|---|
marketHash | The market this order belongs to |
isMakerBettingOutcomeOne | Which side the maker is on (true = backing outcome 1, false = outcome 2) |
percentageOdds | The maker’s implied odds — divide by 10^20 to get a decimal (e.g. 0.51 = 51%) |
totalBetSize | The maker’s total stake (USDC, 6 decimals) |
fillAmount | Already filled portion — available = totalBetSize - fillAmount |
Converting Odds to Taker’s Perspective
To bet on outcome 1 as a taker, you need to find orders where the maker is betting on outcome 2 — because you’re taking the other side.
The isMakerBettingOutcomeOne field tells you which side a maker has taken:
isMakerBettingOutcomeOne | Maker is betting on | You can use this order to bet on |
|---|
true | Outcome 1 | Outcome 2 |
false | Outcome 2 | Outcome 1 |
Let’s take a real market — Cleveland Cavaliers vs Boston Celtics (moneyline) — and trace how raw maker orders from the API become the taker orderbook you see on sx.bet.
- Outcome 1 = Cleveland Cavaliers
- Outcome 2 = Boston Celtics
Step 1: Raw maker orders from GET /orders
curl "https://api.sx.bet/orders?marketHashes=0x1a46..."
Each row is labeled so you can trace it into the taker orderbook below.
Step 2: What the taker sees on sx.bet
Those maker orders create the following orderbook for takers.
The taker’s price = 1 - (percentageOdds / 10^20). Best taker odds are at the top.
| Outcome 1 |
|---|
| Cleveland Cavaliers |
|---|
| Size | Taker Price |
|---|
| D | $292.19 | 53.25¢ |
| B | $530.00 | 54.0¢ |
| C | $4,836.78 | 54.0¢ |
| A | $758.99 | 58.0¢ |
| Outcome 2 |
|---|
| Boston Celtics |
|---|
| Size | Taker Price |
|---|
| G | $999.65 | 48.0¢ |
| H | $752.00 | 48.0¢ |
| F | $799.00 | 48.5¢ |
| E | $4,616.06 | 50.0¢ |
Converting Maker Bet Sizes to Available Liquidity
Like percentageOdds, totalBetSize and fillAmount for a given order are from the maker’s perspective. To find how much liquidity is available for a taker to fill, you will need to convert the remaining maker space (totalBetSize - fillAmount) into taker space.
remainingTakerSpace = (totalBetSize - fillAmount) * 10^20 / percentageOdds - (totalBetSize - fillAmount)
On any given bet, the maker’s stake and the taker’s stake together form the total payout pool. The maker posts an order at their implied odds (percentageOdds / 10^20), so the total pot for any filled amount is makerStake / makerOdds. The taker’s maximum stake is that total pot minus the maker’s stake.
Example
{
"totalBetSize": "10000000",
"fillAmount": "4000000",
"percentageOdds": "52500000000000000000"
}
remainingTakerSpace = (10000000 - 4000000) * 10^20 / 52500000000000000000 - (10000000 - 4000000)
≈ 5428571 (~5.43 USDC)
So while 6.00 USDC of maker stake remains, a taker can fill up to ~5.43 USDC on the other side.
In code
ODDS_PRECISION = 10 ** 20
USDC_DECIMALS = 10 ** 6
def taker_liquidity(order: dict) -> float:
remaining_maker = int(order["totalBetSize"]) - int(order["fillAmount"])
remaining_taker = remaining_maker * ODDS_PRECISION // int(order["percentageOdds"]) - remaining_maker
return remaining_taker / USDC_DECIMALS
# Example
order = {
"totalBetSize": "10000000",
"fillAmount": "4000000",
"percentageOdds": "52500000000000000000",
}
print(f"${taker_liquidity(order):.2f} available to fill") # ~$5.43