Skip to main content

Odds format

The SX Bet API represents odds as an implied probability stored as a fixed-point integer with 20 decimal places (units of 10^20).

The formula

Human-readable implied probability = percentageOdds / 10^20

Examples

percentageOdds valueImplied probabilityAmerican odds (approx)
6000000000000000000060.00%-150
5250000000000000000052.50%-111
5000000000000000000050.00%+100
4000000000000000000040.00%+150

Converting in code

ODDS_PRECISION = 10 ** 20

def to_implied(percentage_odds: int) -> float:
    """Convert raw percentageOdds to decimal implied probability (0–1)."""
    return percentage_odds / ODDS_PRECISION

def to_raw(implied: float) -> int:
    """Convert decimal implied probability to raw percentageOdds."""
    return int(implied * ODDS_PRECISION)

def implied_to_american(implied: float) -> float:
    """Convert implied probability to American odds."""
    if implied >= 0.5:
        return -(implied / (1 - implied)) * 100
    else:
        return ((1 - implied) / implied) * 100

# Examples
raw = 52631578947368421052
print(to_implied(raw))             # 0.5263...
print(implied_to_american(0.5263)) # ~-111
percentageOdds values are very large integers. Use BigInt in JavaScript to avoid precision loss when doing arithmetic.

Taker odds

When you fill an order, you automatically receive the complementary odds:
taker_implied = 1 - maker_implied
For example, if a maker posts an order with desired odds of 52.25% implied odds on outcome 1, the taker gets 47.75% implied odds on outcome 2.

Token amounts (USDC)

All stake and payout amounts are in USDC with 6 decimal places.
Human-readable USDC = rawAmount / 1000000

Examples

Raw valueHuman-readable
1000000$1.00
10000000$10.00
5500000$5.50

Converting in code

USDC_DECIMALS = 10 ** 6

def to_usdc(raw: int) -> float:
    return raw / USDC_DECIMALS

def from_usdc(amount: float) -> int:
    return int(amount * USDC_DECIMALS)

print(to_usdc(10000000))   # 10.0
print(from_usdc(5.50))       # 5500000

Calculating payout

For a given fill:
taker_payout = fill_amount / taker_implied
taker_profit = taker_payout - fill_amount
def calculate_payout(fill_amount_raw: int, maker_odds_raw: int) -> dict:
    maker_implied = maker_odds_raw / ODDS_PRECISION
    taker_implied = 1 - maker_implied
    payout_raw = fill_amount_raw / taker_implied
    profit_raw = payout_raw - fill_amount_raw
    return {
        "stake_usdc": to_usdc(fill_amount_raw),
        "payout_usdc": to_usdc(payout_raw),
        "profit_usdc": to_usdc(profit_raw),
    }

result = calculate_payout(
    fill_amount_raw=10000000,              # $10 stake
    maker_odds_raw=52631578947368421052,   # maker at 52.63%
)
# stake: $10, payout: ~$21.17, profit: ~$11.17

Markets & Sports →