sxbet
sxbet prediction-market exchange — CCXT unified API: methods, parameters and endpoints.
sxbet
Kind: global class
Extends: Exchange
- fetchMarkets
- fetchEvents
- fetchEvent
- approve
- createOrder
- cancelOrder
- cancelOrders
- cancelAllOrders
- fetchOpenOrders
- fetchOrders
- fetchOrder
- fetchTrades
- fetchMyTrades
- fetchBalance
- fetchPositions
- fetchSettlements
- fetchTicker
- fetchTickers
- fetchOrderBook
- watchOrderBook
- watchTicker
- watchTrades
- watchMyTrades
- watchOrders
fetchMarkets
retrieves data on all active markets, each becomes one market with its two sides listed under the outcomes key
Kind: instance method of sxbet
Returns: Array<object> - an array of objects representing market data
See: https://docs.sx.bet/api-reference/get-markets-active
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.limit | int | No | max number of markets to collect (defaults to options.marketsPageSize * options.maxMarketsPages, 5000) |
sxbet.fetchMarkets (params?)fetchEvents
fetches sx.bet fixtures (one fixture = one event, its markets are every moneyline/spread/total line on that fixture) scoped by eventId, leagueId, sportId or a free-text query/tags match against team and league names — always live from the API, never the local cache (it POPULATES the cache for later event()/outcome lookups). query/queries/tags are matched client-side over a bounded scan of /markets/active — the venue's GET /search covers team names only (not league or sport labels) and is not wired here yet
Kind: instance method of sxbet
Returns: Array<object> - an array of event structures
See: https://docs.sx.bet/api-reference/get-markets-active
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.eventId | string | No | direct lookup by unified event id (the sx.bet sportXeventId, e.g. 'L18870109') |
| params.query | string | No | free-text search matched against team and league names |
| params.queries | Array<string> | No | multiple free-text searches (alternative to query, unioned) |
| params.tags | Array<string> | No | matched identically to query/queries (sx.bet has no tag taxonomy) |
| params.leagueId | int | No | sx.bet league id (e.g. 243 for NFL) — fetched server-side |
| params.sportId | int | No | sx.bet sport id (e.g. 8 for Football) — fetched server-side |
| params.status | string | No | 'active' |
| params.limit | int | No | max number of events to return |
sxbet.fetchEvents (params?)fetchEvent
fetches a single sx.bet fixture (event) by its sportXeventId
Kind: instance method of sxbet
Returns: object - a prediction event structure
See: https://docs.sx.bet/api-reference/get-markets-active
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the sx.bet sportXeventId, e.g. 'L18870109' |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.fetchEvent (id, params?)approve
funds the account's obv3 proxy wallet - v3 trading capital must sit inside the proxy. Deploys the proxy first when absent, then moves USDC from the wallet into it via a gasless EIP-2612 Permit signature (POST /user/transfer-to-proxy)
Kind: instance method of sxbet
Returns: object - a dict with the raw response and the transfer sessionId
See
- https://docs.sx.bet/api-reference/post-user-transfer-to-proxy
- https://docs.sx.bet/api-reference/post-user-deploy-proxy
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.amount | float | No | the USDC amount to move into the proxy (required) |
| params.tokenAddress | string | No | the token to transfer, defaults to the active base token |
| params.spender | string | No | the transfer executor granted the permit, defaults to options.transferToProxySpender or the obv3 transferToProxyExecutorAddress |
| params.deadline | int | No | unix seconds the permit signature expires at, defaults to options.approveDeadlineSeconds from now |
| params.rpcUrl | string | No | overrides the chain's default RPC endpoint (see options.chains) |
sxbet.approve (params?)createOrder
places an order on sx.bet's v3 unified orderbook - a 'limit' order rests with GTC time-in-force, a 'market' order fills immediately with IOC (or FOK via params.timeInForce). sx.bet has no shares - 'amount' is the USDC stake to risk, and 'price' is the implied probability (0-1) of the requested outcome. 'sell' bets the OPPOSITE outcome of the one requested (sx.bet is bilateral: there is no owned position to sell, only the complementary side of the same market)
Kind: instance method of sxbet
Returns: object - a prediction order structure
See: https://docs.sx.bet/api-reference/post-orders-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome or outcome token id |
| type | string | Yes | 'limit' (GTC resting order) or 'market' (IOC immediate fill) |
| side | string | Yes | 'buy' backs the requested outcome, 'sell' backs the complementary one |
| amount | float | Yes | the USDC amount to stake/risk |
| price | float | No | implied probability (0-1) of the requested outcome; required for both order types |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.timeInForce | string | No | overrides the derived value - 'GTC', 'IOC' or 'FOK' |
| params.expiry | int | No | unix seconds the order expires at; must be in the future (zero and past values are rejected, so is anything inside the fixture's betting-delay window - /metadata/obv3 resolves the delay per sport/league, live vs pregame), defaults to options.defaultOrderExpirySeconds from now |
| params.salt | string | No | overrides the random salt differentiating this order |
| params.clientOrderId | string | No | caller-chosen id echoed back on reads (max 64 chars) |
| params.waitForOutcome | boolean | No | wait for the matching outcome inline (default true) |
| params.useBetCredits | boolean | No | fund the stake from bet credits instead of the proxy balance (IOC/FOK only) |
| params.externalUserId | string | No | partner attribution id echoed back on order, fill and trade reads |
sxbet.createOrder (outcome, type, side, amount, price?, params?)cancelOrder
cancels one resting maker order - v3 cancels are plain api-key-authenticated DELETE requests, no signature involved
Kind: instance method of sxbet
Returns: object - a prediction order structure
See: https://docs.sx.bet/api-reference/delete-orders-v3
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the order id |
| outcome | string | No | not used by sxbet.cancelOrder |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.cancelOrder (id, outcome?, params?)cancelOrders
cancels multiple resting maker orders in one request - v3 cancels are plain api-key-authenticated DELETE requests, no signature involved
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction order structures
See: https://docs.sx.bet/api-reference/delete-orders-v3
| Param | Type | Required | Description |
|---|---|---|---|
| ids | Array<string> | Yes | the order ids to cancel |
| outcome | string | No | not used by sxbet.cancelOrders |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.cancelOrders (ids, outcome?, params?)cancelAllOrders
cancels every resting maker order of the account, or every order of one fixture via params.eventId - v3 cancels are plain api-key-authenticated DELETE requests, no signature involved
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction order structures
See
- https://docs.sx.bet/api-reference/delete-orders-v3-all
- https://docs.sx.bet/api-reference/delete-orders-v3-event
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | not used by sxbet.cancelAllOrders |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.eventId | string | No | cancels every order across every market of this fixture instead of the account-wide path (params.sportXeventId is accepted too) |
sxbet.cancelAllOrders (outcome?, params?)fetchOpenOrders
fetches the account's resting maker orders via the api-key-authenticated GET /orders-v3 (the route is hardcoded to ACTIVE orders and scoped to the key's account)
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction order structures
See: https://docs.sx.bet/api-reference/get-orders-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | unified outcome or outcomeId — narrows to that outcome's market |
| since | int | No | applied client-side (the route has no date filter; rows carry createdAt) |
| limit | int | No | the maximum number of orders to return (server-side perPage, max 100, default 50) |
| params | object | No | extra parameters specific to the exchange API endpoint (e.g. eventId, sortBy, sortAsc, nextKey) |
sxbet.fetchOpenOrders (outcome?, since?, limit?, params?)fetchOrders
fetches the account's maker orders. sx.bet's GET /orders-v3 listing is hardcoded to ACTIVE orders — filled/cancelled/expired orders leave the listing permanently (their history is only reconstructable from fills), so this returns the same set that fetchOpenOrders returns
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction order structures
See: https://docs.sx.bet/api-reference/get-orders-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | unified outcome or outcomeId — narrows to that outcome's market |
| since | int | No | applied client-side (the route has no date filter; rows carry createdAt) |
| limit | int | No | the maximum number of orders to return (server-side perPage, max 100, default 50) |
| params | object | No | extra parameters specific to the exchange API endpoint (e.g. eventId, sortBy, sortAsc, nextKey) |
sxbet.fetchOrders (outcome?, since?, limit?, params?)fetchOrder
fetches a single maker order by its order hash - unlike the listing, GET /orders-v3/{orderId} also serves filled, cancelled and expired orders while they still exist. a missing or foreign id 404s with 'Order not found', surfaced through handleErrors's OrderNotFound mapping
Kind: instance method of sxbet
Returns: object - a prediction order structure
See: https://docs.sx.bet/api-reference/get-order-v3
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the order hash |
| outcome | string | No | unified outcome or outcomeId (labelling hint only, the request needs just the id) |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.fetchOrder (id, outcome?, params?)fetchTrades
fetches the public trade tape of one outcome's market — every bettor's settled and in-flight bets on that market. the venue requires the trades listing to be scoped, so the outcome argument is mandatory
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction trade structures
See: https://docs.sx.bet/api-reference/get-trades-v3-public
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome or outcomeId |
| since | int | No | timestamp in ms of the earliest trade to return — applied client-side over the newest page (the public tape serves newest-first and has no date filter; older pages are reachable through params.nextKey) |
| limit | int | No | the maximum number of trades to return (server-side perPage, max 100, default 50) |
| params | object | No | extra parameters specific to the exchange API endpoint (e.g. eventId, nextKey) |
sxbet.fetchTrades (outcome, since?, limit?, params?)fetchMyTrades
fetches the account's fills (matched legs of its own orders, both taker and maker side) via the api-key-authenticated GET /fills-v3
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction trade structures
See: https://docs.sx.bet/api-reference/get-fills-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | unified outcome or outcomeId — narrows to that outcome's market and drops the opposite side's legs |
| since | int | No | timestamp in ms of the earliest fill to fetch (server-side startDate) |
| limit | int | No | the maximum number of fills to return (server-side perPage, max 100, default 50) |
| params | object | No | extra parameters specific to the exchange API endpoint (e.g. tradeId, orderId, endDate, sortAsc, nextKey) |
sxbet.fetchMyTrades (outcome?, since?, limit?, params?)fetchBalance
fetches the account's order-spendable proxy balance from GET /user/balance-v3 - v3 trading capital sits inside the obv3 proxy wallet (funded via approve()), and GTC posting is checked against availableAmount. free is the spendable availableAmount, used the escrowedAmount locked behind open bets
Kind: instance method of sxbet
Returns: object - a balance structure
See: https://docs.sx.bet/api-reference/get-user-balance-v3
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.fetchBalance (params?)fetchPositions
fetches the account's open positions from the venue's per-market aggregates (GET /positions-v3, MATCHED and LOCKED bets by default; override with params.status - the enum is MATCHED, LOCKED, SETTLED, FAILED, and pnl is populated only when the filter is exclusively SETTLED). contracts is the total stake at risk, entryPrice the blended implied probability of the market's best-case outcome
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction position structures
See: https://docs.sx.bet/api-reference/get-positions-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcomes | Array<string> | No | filter by unified outcomes or outcomeIds |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.fetchPositions (outcomes?, params?)fetchSettlements
fetches the account's settled bets — each settled GET /trades-v3 row becomes one settlement with the resolved winner, the payout (stake / odds when won, the stake back when the market voided, zero when lost) and the realized pnl
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction settlement structures
See: https://docs.sx.bet/api-reference/get-trades-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter to a single unified outcome or outcomeId |
| since | int | No | timestamp in ms of the earliest settlement to fetch (server-side startDate on the bet time) |
| limit | int | No | the maximum number of settlements to fetch (server-side perPage, max 100, default 50) |
| params | object | No | extra parameters specific to the exchange API endpoint (e.g. eventId, endDate, sortAsc, nextKey) |
sxbet.fetchSettlements (outcome?, since?, limit?, params?)fetchTicker
fetches the current best resting odds for a single sx.bet outcome. sx.bet is a peer-to-peer odds book (no matched-trade tape or candles), so bid/ask are the best (highest) percentageOdds resting on this outcome's own side and its mirror (1 - best percentageOdds resting on the opposite outcome)
Kind: instance method of sxbet
Returns: object - a prediction ticker structure
See: https://docs.sx.bet/api-reference/get-orderbook-snapshot
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome handle or outcomeId (marketHash or marketHash + '-2') |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.fetchTicker (outcome, params?)fetchTickers
fetches the current best resting odds for multiple sx.bet outcomes, one book snapshot per market
Kind: instance method of sxbet
Returns: object - a dictionary of prediction ticker structures indexed by outcome
See: https://docs.sx.bet/api-reference/get-orderbook-snapshot
| Param | Type | Required | Description |
|---|---|---|---|
| outcomes | Array<string> | Yes | unified outcomes - required: sx.bet has thousands of markets and no endpoint returning all of them at once |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.fetchTickers (outcomes, params?)fetchOrderBook
fetches the resting maker order book for a single sx.bet outcome. bids are maker orders already betting on this outcome (priced at each maker's own implied probability, sized by their remaining stake); asks mirror the opposite outcome's maker orders (price = 1 - their implied probability, sized by how much a taker could bet against them, per sx.bet's remaining-taker-space formula) — the same YES/NO-style mirrored construction used across this codebase's other binary prediction venues
Kind: instance method of sxbet
Returns: object - a prediction order book structure
See: https://docs.sx.bet/api-reference/get-orderbook-snapshot
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome handle or outcomeId |
| limit | int | No | the maximum number of bids/asks to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.fetchOrderBook (outcome, limit?, params?)watchOrderBook
streams the order book of an outcome - the v3 channel publishes the entire aggregated book on every update with a monotonic version, so each message replaces the held book
Kind: instance method of sxbet
Returns: object - a prediction order book structure
See: https://docs.sx.bet/api-reference/channel-orderbook-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome or outcome token id |
| limit | int | No | the maximum number of order book entries to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.watchOrderBook (outcome, limit?, params?)watchTicker
streams best-odds updates of an outcome; the venue channel is global, entries are filtered down to the requested outcome's market
Kind: instance method of sxbet
Returns: object - a prediction ticker structure
See: https://docs.sx.bet/api-reference/channel-best-odds-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome or outcome token id |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.watchTicker (outcome, params?)watchTrades
streams public bets of an outcome; the venue channel is global, entries are filtered down to the requested outcome
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction trade structures
See: https://docs.sx.bet/api-reference/channel-recent-trades-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome or outcome token id |
| since | int | No | timestamp in ms of the earliest trade to return |
| limit | int | No | the maximum number of trades to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.watchTrades (outcome, since?, limit?, params?)watchMyTrades
streams the authenticated wallet's fills over its per-account v3 channel
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction trade structures
See: https://docs.sx.bet/api-reference/channel-fills-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | unified outcome or outcome token id to narrow the stream down to |
| since | int | No | timestamp in ms of the earliest trade to return |
| limit | int | No | the maximum number of trades to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.watchMyTrades (outcome?, since?, limit?, params?)watchOrders
streams updates of the authenticated wallet's orders over its per-account v3 channel
Kind: instance method of sxbet
Returns: Array<object> - a list of prediction order structures
See: https://docs.sx.bet/api-reference/channel-orders-v3
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | unified outcome or outcome token id to narrow the stream down to |
| since | int | No | timestamp in ms of the earliest order to return |
| limit | int | No | the maximum number of orders to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
sxbet.watchOrders (outcome?, since?, limit?, params?)