wiki/exchanges/prediction/binance.md
<a name="binance" id="binance"></a>
Kind: global class
Extends: <code>Exchange</code>
<a name="binance" id="binance"></a>
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 ()
<a name="fetchMarkets" id="fetchmarkets"></a>
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 <code>binance</code>
Returns: <code>Array<object></code> - an array of objects representing market data
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.query | <code>string</code> | No | a single search query resolved against the market search endpoint |
| params.queries | <code>Array<string></code> | No | multiple search queries (alternative to query) |
| params.l1Category | <code>string</code> | No | filter the listing by a level-1 category id (see the category/list endpoint) |
| params.l2Category | <code>string</code> | No | filter the listing by a level-2 category id |
| params.limit | <code>int</code> | No | for an unscoped listing (no query), the max number of topics to collect (defaults to options.maxFetchMarketsLimit, 200) |
binance.fetchMarkets (params?)
<a name="fetchEvents" id="fetchevents"></a>
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 <code>binance</code>
Returns: <code>Array<object></code> - a list of prediction event structures
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.query | <code>string</code> | No | a free-text search resolved against the semantic market search endpoint |
| params.queries | <code>Array<string></code> | No | multiple free-text searches (alternative to query) |
| params.tags | <code>Array<string></code> | No | treated as additional free-text searches (binance has no tag taxonomy) |
| params.eventId | <code>string</code> | No | a marketTopicId, fetched directly via the detail endpoint |
| params.l1Category | <code>string</code> | No | scope the listing server-side by a level-1 category id |
| params.l2Category | <code>string</code> | No | scope the listing server-side by a level-2 category id |
| params.limit | <code>int</code> | No | the maximum number of events to return |
| params.sort | <code>string</code> | No | 'volume' |
| params.status | <code>string</code> | No | 'active' |
| params.sortBy | <code>string</code> | No | sort events by server side ('RECOMMENDED' |
| params.orderBy | <code>string</code> | No | order events by server side ('ASC' |
binance.fetchEvents (params?)
<a name="fetchEvent" id="fetchevent"></a>
fetches a single prediction-market event (market topic) by its marketTopicId
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a prediction event structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | the marketTopicId |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.fetchEvent (id, params?)
<a name="fetchTicker" id="fetchticker"></a>
fetches the last trade price for a single prediction outcome
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a prediction ticker structure
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | <code>string</code> | Yes | unified outcome handle like BTC_PRICE_1H_UP_DOWN_UP:YES, or an outcome token id |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.fetchTicker (outcome, params?)
<a name="fetchTickers" id="fetchtickers"></a>
fetches last trade prices for multiple outcomes, one request per distinct underlying market
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a dictionary of prediction ticker structures
| Param | Type | Required | Description |
|---|---|---|---|
| outcomes | <code>Array<string></code> | Yes | unified outcomes — required: the venue has no all-tickers endpoint |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.fetchTickers (outcomes, params?)
<a name="fetchOrderBook" id="fetchorderbook"></a>
fetches the order book for a single prediction outcome token
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a prediction order book structure
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | <code>string</code> | Yes | unified outcome handle, or an outcome token id |
| limit | <code>int</code> | No | not used by binance fetchOrderBook |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.fetchOrderBook (outcome, limit?, params?)
<a name="fetchBalance" id="fetchbalance"></a>
query for balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a balance structure
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.type | <code>string</code> | No | 'CeDefi', 'FUNDING', or 'SPOT' |
binance.fetchBalance (params?)
<a name="fetchOpenOrders" id="fetchopenorders"></a>
fetches currently open orders for the user
Kind: instance method of <code>binance</code>
Returns: <code>Array<object></code> - a list of prediction order structures
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | <code>string</code> | No | filter by outcome |
| since | <code>int</code> | No | only return orders updated since this timestamp in ms |
| limit | <code>int</code> | No | max number of orders to return |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.tradeSide | <code>string</code> | No | Filter by trade side. Enum: BUY, SELL |
| params.l1Category | <code>string</code> | No | Filter by level-1 category |
| params.paginate | <code>boolean</code> | No | spot 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?)
<a name="fetchOrders" id="fetchorders"></a>
fetches all historical orders for the user
Kind: instance method of <code>binance</code>
Returns: <code>Array<object></code> - a list of prediction order structures
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | <code>string</code> | No | filter by outcome |
| since | <code>int</code> | No | only return orders updated since this timestamp in ms |
| limit | <code>int</code> | No | max number of orders to return |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.orderType | <code>string</code> | No | Filter by order type. Enum: MARKET, LIMIT |
| params.l1Category | <code>string</code> | No | Filter by level-1 category |
| params.status | <code>string</code> | No | Filter by order status |
| params.until | <code>string</code> | No | end timestamp in ms |
| params.paginate | <code>boolean</code> | No | spot 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?)
<a name="fetchPositions" id="fetchpositions"></a>
fetches the user's outcome positions; outcome positions are spot token balances under the "+<encoding>" coin form (size and entry notional), the value/entry/mark price/pnl are computed from the current mid prices
Kind: instance method of <code>binance</code>
Returns: <code>Array<object></code> - a list of prediction position structures
| Param | Type | Required | Description |
|---|---|---|---|
| outcomes | <code>Array<string></code> | No | filter by outcome ids or outcomes |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.tab | <code>string</code> | No | Position status tab. Values from PositionQueryType. Default ONGOING |
binance.fetchPositions (outcomes?, params?)
<a name="fetchPosition" id="fetchposition"></a>
fetch data on an open position
Kind: instance method of <code>binance</code>
Returns: <code>Array<object></code> - a list of prediction position structures
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | <code>string</code> | No | filter by outcome |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.fetchPosition (outcome?, params?)
<a name="fetchMyTrades" id="fetchmytrades"></a>
fetch all trades made by the user
Kind: instance method of <code>binance</code>
Returns: <code>Array<object></code> - a list of prediction order structures
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | <code>string</code> | No | filter by outcome |
| since | <code>int</code> | No | only return orders updated since this timestamp in ms |
| limit | <code>int</code> | No | max number of orders to return |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.orderType | <code>string</code> | No | Filter by order type. Enum: MARKET, LIMIT |
| params.l1Category | <code>string</code> | No | Filter by level-1 category |
| params.status | <code>string</code> | No | Filter by order status |
| params.until | <code>string</code> | No | end timestamp in ms |
| params.paginate | <code>boolean</code> | No | spot 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?)
<a name="fetchWallet" id="fetchwallet"></a>
fetch wallet for user and save the one match the walletAddress user provided
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a wallet
| Param | Type | Required | Description |
|---|---|---|---|
| methodName | <code>string</code> | No | method name |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.fetchWallet (methodName?, params?)
<a name="fetchQuote" id="fetchquote"></a>
request for quote from binance server
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a quote
| Param | Type | Required | Description |
|---|---|---|---|
| request | <code>object</code> | No | request to the exchange API endpoint |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.chainId | <code>string</code> | No | Chain ID. Default 56 (BSC) |
| params.feeRateBps | <code>integer</code> | No | Fee rate in basis points. Default 200, range 1–10000 |
| params.fundingSource | <code>string</code> | No | Funding source. Enum: MPC, CEX. Default MPC |
| params.fundTransferAmount | <code>string</code> | No | Auto-transfer amount before order (wei). Must be > 0 if provided |
binance.fetchQuote (request?, params?)
<a name="createOrder" id="createorder"></a>
creates a limit or market order for an outcome market
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a prediction order structure
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | <code>string</code> | Yes | unified outcome |
| type | <code>string</code> | Yes | 'limit' or 'market' |
| side | <code>string</code> | Yes | 'buy' or 'sell' |
| amount | <code>float</code> | Yes | quantity of outcome tokens |
| price | <code>float</code> | No | limit price (0–1 range for prediction markets) |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.timeInForce | <code>string</code> | No | Must match orderType: FOK for MARKET, GTC for LIMIT |
| params.slippage | <code>string</code> | No | slippage for market orders (default 5%) |
| params.fundingSource | <code>string</code> | No | Funding source. Enum: MPC, CEX. Default MPC |
| params.fundTransferAmount | <code>string</code> | No | Auto-transfer amount before order (wei). Must be > 0 if provided |
| params.accountType | <code>string</code> | No | Payment account type. Enum: SPOT, FUNDING |
| params.feeRateBps | <code>string</code> | No | Payment account type. Enum: SPOT, FUNDING |
| params.cost | <code>string</code> | No | Buy prediction market with USDT cost, only for buy side |
binance.createOrder (outcome, type, side, amount, price?, params?)
<a name="createMarketOrderWithCost" id="createmarketorderwithcost"></a>
create a market order by providing the symbol, side and cost
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - an order structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to create an order in |
| side | <code>string</code> | Yes | 'buy' or 'sell' |
| cost | <code>float</code> | Yes | how much you want to trade in units of the quote currency |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.createMarketOrderWithCost (symbol, side, cost, params?)
<a name="cancelOrder" id="cancelorder"></a>
cancels a single open order
Kind: instance method of <code>binance</code>
Returns: <code>object</code> - a prediction order structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | order id |
| outcome | <code>string</code> | No | unified outcome |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.cancelOrder (id, outcome?, params?)
<a name="cancelOrders" id="cancelorders"></a>
cancels multiple open orders
Kind: instance method of <code>binance</code>
Returns: <code>Array<object></code> - a list of prediction order structures
| Param | Type | Required | Description |
|---|---|---|---|
| ids | <code>Array<string></code> | Yes | order ids |
| outcome | <code>string</code> | No | unified outcome (required) |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
binance.cancelOrders (ids, outcome?, params?)