CCXT

binance

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

binance

Kind: global class
Extends: Exchange

binance

Binance Web3 Wallet prediction trading. Binance aggregates prediction markets from on-chain vendors (predict.fun on BNB Chain) behind its standard signed SAPI — every endpoint, including market data, requires apiKey/secret credentials

binance.binance ()

fetchMarkets

fetches binance prediction markets; with a query it resolves the query via the search endpoint and returns the matched topics' markets, otherwise it pages the market listing

Kind: instance method of binance
Returns: Array<object> - an array of objects representing market data

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.querystringNoa single search query resolved against the market search endpoint
params.queriesArray<string>Nomultiple search queries (alternative to query)
params.l1CategorystringNofilter the listing by a level-1 category id (see the category/list endpoint)
params.l2CategorystringNofilter the listing by a level-2 category id
params.limitintNofor an unscoped listing (no query), the max number of topics to collect (defaults to options.maxFetchMarketsLimit, 200)
binance.fetchMarkets (params?)

fetchEvents

fetches prediction-market events (market topics); the call must be scoped by query/queries/tags, eventId, or an l1Category/l2Category listing filter

Kind: instance method of binance
Returns: Array<object> - a list of prediction event structures

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.querystringNoa free-text search resolved against the semantic market search endpoint
params.queriesArray<string>Nomultiple free-text searches (alternative to query)
params.tagsArray<string>Notreated as additional free-text searches (binance has no tag taxonomy)
params.eventIdstringNoa marketTopicId, fetched directly via the detail endpoint
params.l1CategorystringNoscope the listing server-side by a level-1 category id
params.l2CategorystringNoscope the listing server-side by a level-2 category id
params.limitintNothe maximum number of events to return
params.sortstringNo'volume'
params.statusstringNo'active'
params.sortBystringNosort events by server side ('RECOMMENDED'
params.orderBystringNoorder events by server side ('ASC'
binance.fetchEvents (params?)

fetchEvent

fetches a single prediction-market event (market topic) by its marketTopicId

Kind: instance method of binance
Returns: object - a prediction event structure

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data

ParamTypeRequiredDescription
idstringYesthe marketTopicId
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.fetchEvent (id, params?)

fetchTicker

fetches the last trade price for a single prediction outcome

Kind: instance method of binance
Returns: object - a prediction ticker structure

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#query-last-trade-price

ParamTypeRequiredDescription
outcomestringYesunified outcome handle like BTC_PRICE_1H_UP_DOWN_UP:YES, or an outcome token id
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.fetchTicker (outcome, params?)

fetchTickers

fetches last trade prices for multiple outcomes, one request per distinct underlying market

Kind: instance method of binance
Returns: object - a dictionary of prediction ticker structures

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#query-last-trade-price

ParamTypeRequiredDescription
outcomesArray<string>Yesunified outcomes — required: the venue has no all-tickers endpoint
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.fetchTickers (outcomes, params?)

fetchOrderBook

fetches the order book for a single prediction outcome token

Kind: instance method of binance
Returns: object - a prediction order book structure

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#query-order-book

ParamTypeRequiredDescription
outcomestringYesunified outcome handle, or an outcome token id
limitintNonot used by binance fetchOrderBook
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.fetchOrderBook (outcome, limit?, params?)

fetchBalance

query for balance and get the amount of funds available for trading or funds locked in orders

Kind: instance method of binance
Returns: object - a balance structure

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/wallet#query-payment-option-balances

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNo'CeDefi', 'FUNDING', or 'SPOT'
binance.fetchBalance (params?)

fetchOpenOrders

fetches currently open orders for the user

Kind: instance method of binance
Returns: Array<object> - a list of prediction order structures

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#query-active-orders

ParamTypeRequiredDescription
outcomestringNofilter by outcome
sinceintNoonly return orders updated since this timestamp in ms
limitintNomax number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.tradeSidestringNoFilter by trade side. Enum: BUY, SELL
params.l1CategorystringNoFilter by level-1 category
params.paginatebooleanNospot only default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
binance.fetchOpenOrders (outcome?, since?, limit?, params?)

fetchOrders

fetches all historical orders for the user

Kind: instance method of binance
Returns: Array<object> - a list of prediction order structures

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#query-order-history

ParamTypeRequiredDescription
outcomestringNofilter by outcome
sinceintNoonly return orders updated since this timestamp in ms
limitintNomax number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.orderTypestringNoFilter by order type. Enum: MARKET, LIMIT
params.l1CategorystringNoFilter by level-1 category
params.statusstringNoFilter by order status
params.untilstringNoend timestamp in ms
params.paginatebooleanNospot only default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
binance.fetchOrders (outcome?, since?, limit?, params?)

fetchPositions

fetches the user's outcome positions; outcome positions are spot token balances under the "+" coin form (size and entry notional), the value/entry/mark price/pnl are computed from the current mid prices

Kind: instance method of binance
Returns: Array<object> - a list of prediction position structures

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/position#query-positions

ParamTypeRequiredDescription
outcomesArray<string>Nofilter by outcome ids or outcomes
paramsobjectNoextra parameters specific to the exchange API endpoint
params.tabstringNoPosition status tab. Values from PositionQueryType. Default ONGOING
binance.fetchPositions (outcomes?, params?)

fetchPosition

fetch data on an open position

Kind: instance method of binance
Returns: Array<object> - a list of prediction position structures

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/position#query-positions-by-filter

ParamTypeRequiredDescription
outcomestringNofilter by outcome
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.fetchPosition (outcome?, params?)

fetchMyTrades

fetch all trades made by the user

Kind: instance method of binance
Returns: Array<object> - a list of prediction order structures

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#query-order-history

ParamTypeRequiredDescription
outcomestringNofilter by outcome
sinceintNoonly return orders updated since this timestamp in ms
limitintNomax number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.orderTypestringNoFilter by order type. Enum: MARKET, LIMIT
params.l1CategorystringNoFilter by level-1 category
params.statusstringNoFilter by order status
params.untilstringNoend timestamp in ms
params.paginatebooleanNospot only default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
binance.fetchMyTrades (outcome?, since?, limit?, params?)

fetchWallet

fetch wallet for user and save the one match the walletAddress user provided

Kind: instance method of binance
Returns: object - a wallet

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/wallet#list-prediction-wallets

ParamTypeRequiredDescription
methodNamestringNomethod name
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.fetchWallet (methodName?, params?)

fetchQuote

request for quote from binance server

Kind: instance method of binance
Returns: object - a quote

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#get-quote

ParamTypeRequiredDescription
requestobjectNorequest to the exchange API endpoint
paramsobjectNoextra parameters specific to the exchange API endpoint
params.chainIdstringNoChain ID. Default 56 (BSC)
params.feeRateBpsintegerNoFee rate in basis points. Default 200, range 1–10000
params.fundingSourcestringNoFunding source. Enum: MPC, CEX. Default MPC
params.fundTransferAmountstringNoAuto-transfer amount before order (wei). Must be > 0 if provided
binance.fetchQuote (request?, params?)

createOrder

creates a limit or market order for an outcome market

Kind: instance method of binance
Returns: object - a prediction order structure

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#place-order

ParamTypeRequiredDescription
outcomestringYesunified outcome
typestringYes'limit' or 'market'
sidestringYes'buy' or 'sell'
amountfloatYesquantity of outcome tokens
pricefloatNolimit price (0–1 range for prediction markets)
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNoMust match orderType: FOK for MARKET, GTC for LIMIT
params.slippagestringNoslippage for market orders (default 5%)
params.fundingSourcestringNoFunding source. Enum: MPC, CEX. Default MPC
params.fundTransferAmountstringNoAuto-transfer amount before order (wei). Must be > 0 if provided
params.accountTypestringNoPayment account type. Enum: SPOT, FUNDING
params.feeRateBpsstringNoPayment account type. Enum: SPOT, FUNDING
params.coststringNoBuy prediction market with USDT cost, only for buy side
binance.createOrder (outcome, type, side, amount, price?, params?)

createMarketOrderWithCost

create a market order by providing the symbol, side and cost

Kind: instance method of binance
Returns: object - an order structure

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#place-order

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
sidestringYes'buy' or 'sell'
costfloatYeshow much you want to trade in units of the quote currency
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.createMarketOrderWithCost (symbol, side, cost, params?)

cancelOrder

cancels a single open order

Kind: instance method of binance
Returns: object - a prediction order structure

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#batch-cancel-orders

ParamTypeRequiredDescription
idstringYesorder id
outcomestringNounified outcome
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.cancelOrder (id, outcome?, params?)

cancelOrders

cancels multiple open orders

Kind: instance method of binance
Returns: Array<object> - a list of prediction order structures

See: https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#batch-cancel-orders

ParamTypeRequiredDescription
idsArray<string>Yesorder ids
outcomestringNounified outcome (required)
paramsobjectNoextra parameters specific to the exchange API endpoint
binance.cancelOrders (ids, outcome?, params?)

On this page