Skip to main content
The SX Bet API uses raw integers for odds and token amounts. Here’s everything you need to convert them.

Quick reference

ValueRaw formatConvert to human-readable
OddsInteger, scaled by 10^20raw / 10^20 → implied probability (0–1)
USDCInteger, 6 decimalsraw / 1,000,000 → dollar amount
TimestampsUnix secondsStandard Unix timestamp

Odds

SX Bet stores odds as implied probability scaled to avoid floating point: percentageOdds = implied × 10^20

Raw ↔ implied probability

ODDS_PRECISION = 10 ** 20

raw_to_implied = lambda raw: raw / ODDS_PRECISION
implied_to_raw = lambda implied: int(implied * ODDS_PRECISION)

# 52631578947368421052 → 0.5263 (52.63%)

Maker → taker odds

On SX Bet, makers post odds at a specific implied probability. The taker automatically receives the complementary side — the two sides always sum to 1 (no house spread):
taker_implied = 1 - maker_implied
taker_raw = 10^20 - maker_raw
Example: Maker posts at 50125000000000000000 (~50.125%). Taker receives 49875000000000000000 (~49.875%).

Implied ↔ American

Favorite (implied ≥ 0.5):  American = -(implied / (1 - implied)) × 100
Underdog (implied < 0.5):  American = ((1 - implied) / implied) × 100
def implied_to_american(implied: float) -> float:
    if implied >= 0.5:
        return -(implied / (1 - implied)) * 100
    return ((1 - implied) / implied) * 100

def american_to_implied(american: float) -> float:
    if american < 0:
        return (-american) / (-american + 100)
    return 100 / (american + 100)

Implied ↔ Decimal

decimal = 1 / implied
implied = 1 / decimal

Token amounts

USDC on SX Network uses 6 decimal places, so all token amounts in the API are integers representing millionths of a dollar. For example, 10000000 is 10.00 USDC, and 1500000 is 1.50 USDC.
USDC_DECIMALS = 10 ** 6

raw_to_usdc = lambda raw: raw / USDC_DECIMALS
usdc_to_raw = lambda amount: int(round(amount * USDC_DECIMALS))

raw_to_usdc(10_000_000)   # → 10.0
usdc_to_raw(10.00)        # → 10000000