CCXT

sxbet

sxbet prediction-market exchange — CCXT unified API: methods, parameters and endpoints.

sxbet

Kind: global class
Extends: Exchange

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

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.limitintNomax 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

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.eventIdstringNodirect lookup by unified event id (the sx.bet sportXeventId, e.g. 'L18870109')
params.querystringNofree-text search matched against team and league names
params.queriesArray<string>Nomultiple free-text searches (alternative to query, unioned)
params.tagsArray<string>Nomatched identically to query/queries (sx.bet has no tag taxonomy)
params.leagueIdintNosx.bet league id (e.g. 243 for NFL) — fetched server-side
params.sportIdintNosx.bet sport id (e.g. 8 for Football) — fetched server-side
params.statusstringNo'active'
params.limitintNomax 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

ParamTypeRequiredDescription
idstringYesthe sx.bet sportXeventId, e.g. 'L18870109'
paramsobjectNoextra 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

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.amountfloatNothe USDC amount to move into the proxy (required)
params.tokenAddressstringNothe token to transfer, defaults to the active base token
params.spenderstringNothe transfer executor granted the permit, defaults to options.transferToProxySpender or the obv3 transferToProxyExecutorAddress
params.deadlineintNounix seconds the permit signature expires at, defaults to options.approveDeadlineSeconds from now
params.rpcUrlstringNooverrides 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

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
typestringYes'limit' (GTC resting order) or 'market' (IOC immediate fill)
sidestringYes'buy' backs the requested outcome, 'sell' backs the complementary one
amountfloatYesthe USDC amount to stake/risk
pricefloatNoimplied probability (0-1) of the requested outcome; required for both order types
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNooverrides the derived value - 'GTC', 'IOC' or 'FOK'
params.expiryintNounix 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.saltstringNooverrides the random salt differentiating this order
params.clientOrderIdstringNocaller-chosen id echoed back on reads (max 64 chars)
params.waitForOutcomebooleanNowait for the matching outcome inline (default true)
params.useBetCreditsbooleanNofund the stake from bet credits instead of the proxy balance (IOC/FOK only)
params.externalUserIdstringNopartner 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

ParamTypeRequiredDescription
idstringYesthe order id
outcomestringNonot used by sxbet.cancelOrder
paramsobjectNoextra 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

ParamTypeRequiredDescription
idsArray<string>Yesthe order ids to cancel
outcomestringNonot used by sxbet.cancelOrders
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNonot used by sxbet.cancelAllOrders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.eventIdstringNocancels 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

ParamTypeRequiredDescription
outcomestringNounified outcome or outcomeId — narrows to that outcome's market
sinceintNoapplied client-side (the route has no date filter; rows carry createdAt)
limitintNothe maximum number of orders to return (server-side perPage, max 100, default 50)
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNounified outcome or outcomeId — narrows to that outcome's market
sinceintNoapplied client-side (the route has no date filter; rows carry createdAt)
limitintNothe maximum number of orders to return (server-side perPage, max 100, default 50)
paramsobjectNoextra 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

ParamTypeRequiredDescription
idstringYesthe order hash
outcomestringNounified outcome or outcomeId (labelling hint only, the request needs just the id)
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcomeId
sinceintNotimestamp 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)
limitintNothe maximum number of trades to return (server-side perPage, max 100, default 50)
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNounified outcome or outcomeId — narrows to that outcome's market and drops the opposite side's legs
sinceintNotimestamp in ms of the earliest fill to fetch (server-side startDate)
limitintNothe maximum number of fills to return (server-side perPage, max 100, default 50)
paramsobjectNoextra 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

ParamTypeRequiredDescription
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomesArray<string>Nofilter by unified outcomes or outcomeIds
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNofilter to a single unified outcome or outcomeId
sinceintNotimestamp in ms of the earliest settlement to fetch (server-side startDate on the bet time)
limitintNothe maximum number of settlements to fetch (server-side perPage, max 100, default 50)
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome handle or outcomeId (marketHash or marketHash + '-2')
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomesArray<string>Yesunified outcomes - required: sx.bet has thousands of markets and no endpoint returning all of them at once
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome handle or outcomeId
limitintNothe maximum number of bids/asks to return
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
limitintNothe maximum number of order book entries to return
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
sinceintNotimestamp in ms of the earliest trade to return
limitintNothe maximum number of trades to return
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNounified outcome or outcome token id to narrow the stream down to
sinceintNotimestamp in ms of the earliest trade to return
limitintNothe maximum number of trades to return
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNounified outcome or outcome token id to narrow the stream down to
sinceintNotimestamp in ms of the earliest order to return
limitintNothe maximum number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
sxbet.watchOrders (outcome?, since?, limit?, params?)

On this page