CCXT

opinion

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

opinion

Kind: global class
Extends: Exchange

fetchMarkets

fetches every kind of opinion market categorical parents double as our unified "events" and are cached into this.events as a side effect

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/market

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.limitintNomax number of markets to collect (defaults to options.marketsPageLimit * options.maxMarketsPages, 1000)
opinion.fetchMarkets (params?)

fetchEvents

fetches Opinion's categorical markets - scope required via query/queries/tags/eventId/slug/labelId

Kind: instance method of opinion
Returns: Array<object> - an array of event structures

See: https://docs.opinion.trade/developer-guide/opinion-open-api/market

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.labelIdintNofilter by opinion category label id
params.limitintNomax number of events to fetch (paginated server-side; defaults to options.maxFetchEventsResults, 100)
opinion.fetchEvents (params?)

fetchEvent

fetches a single prediction-market event by its market id, or slug

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/market

ParamTypeRequiredDescription
idstringYesthe numeric marketId, or the market slug
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchEvent (id, params?)

fetchTicker

fetches the latest trade price and top of book for a single outcome token

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/token

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchTicker (outcome, params?)

fetchTickers

fetches tickers for multiple outcome tokens - opinion has no all-tickers endpoint, each token needs its own latest-price + orderbook request

Kind: instance method of opinion
Returns: object - a dictionary of prediction ticker structures indexed by outcome

See: https://docs.opinion.trade/developer-guide/opinion-open-api/token

ParamTypeRequiredDescription
outcomesArray<string>Yesunified outcomes or outcome token ids - required, opinion has no all-tickers endpoint
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchTickers (outcomes, params?)

fetchOrderBook

fetches the order book for a single outcome token

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/token

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

fetchOHLCV

fetches historical candlestick data for an outcome token

Kind: instance method of opinion
Returns: Array<Array<int>> - a list of candles ordered as timestamp, open, high, low, close, volume

See: https://docs.opinion.trade/developer-guide/opinion-open-api/token

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
timeframestringYesthe length of time each candle represents - only '1h' and '1d' are supported live
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum number of candles to return
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchOHLCV (outcome, timeframe, since?, limit?, params?)

parseOHLCV

parses a single opinion price-history point into a unified OHLCV candle

Kind: instance method of opinion
Returns: Array<int> - a candle ordered as timestamp, open, high, low, close, volume

ParamTypeRequiredDescription
ohlcvobjectYesthe raw { p, t } point
marketobjectNothe outcome object the candle belongs to
opinion.parseOHLCV (ohlcv, market?)

createOrder

places a limit or market order on the CLOB for the given outcome token

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/order

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYesfor limit orders, the number of outcome shares to trade; for market orders, the quote (USDT) to spend on a BUY or the shares to sell on a SELL
pricefloatNothe price per outcome token between 0 and 1; required for limit orders and market SELL orders (where it acts as the reference / worst acceptable price for the taker amount); ignored for market BUY orders (amount is already the quote to spend)
paramsobjectNoextra parameters specific to the exchange API endpoint
params.postOnlyboolNolimit orders only - reject the order if it would cross the spread
opinion.createOrder (outcome, type, side, amount, price?, params?)

cancelOrder

cancels a single open order by id

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/order

ParamTypeRequiredDescription
idstringYesthe order id
outcomestringNonot used by opinion cancelOrder
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.cancelOrder (id, outcome?, params?)

parsePredictionOrder

parses a raw opinion order object into a unified prediction order structure

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

ParamTypeRequiredDescription
orderobjectYesthe raw opinion OrderData object
marketobjectNothe outcome object the order belongs to
opinion.parsePredictionOrder (order, market?)

fetchOrders

fetches all of the authenticated user's orders

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/order

ParamTypeRequiredDescription
outcomestringNofilter by unified outcome or outcome token id
sinceintNotimestamp in ms of the earliest order to fetch
limitintNothe maximum number of orders to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchOrders (outcome?, since?, limit?, params?)

fetchOrder

fetches a single order by id

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/order

ParamTypeRequiredDescription
idstringYesthe order id
outcomestringNounified outcome or outcome token id
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchOrder (id, outcome?, params?)

fetchOpenOrders

fetches the authenticated user's open orders

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/order

ParamTypeRequiredDescription
outcomestringNofilter by unified outcome or outcome token id
sinceintNotimestamp in ms of the earliest order to fetch
limitintNothe maximum number of orders to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchOpenOrders (outcome?, since?, limit?, params?)

fetchClosedOrders

fetches the authenticated user's closed orders

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/order

ParamTypeRequiredDescription
outcomestringNofilter by unified outcome or outcome token id
sinceintNotimestamp in ms of the earliest order to fetch
limitintNothe maximum number of orders to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchClosedOrders (outcome?, since?, limit?, params?)

fetchMyTrades

fetches the authenticated user's trades

Kind: instance method of opinion
Returns: Array<object> - a list of prediction trade structures

See: https://docs.opinion.trade/developer-guide/opinion-open-api/trade

ParamTypeRequiredDescription
outcomestringNofilter by unified outcome or outcome token id
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum number of trades to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchMyTrades (outcome?, since?, limit?, params?)

fetchBalance

fetches the authenticated user's quote-token balances

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/quote-token

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchBalance (params?)

fetchPositions

fetches the authenticated user's open positions

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

See: https://docs.opinion.trade/developer-guide/opinion-open-api/position

ParamTypeRequiredDescription
outcomesArray<string>Nofilter by unified outcomes or outcome token ids
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.fetchPositions (outcomes?, params?)

createApiKey

self-service creation of an Open API key linked to this.walletAddress via an EIP-712-signed request - there is no "generate key" button in the Opinion GUI, this is the only documented way to obtain a wallet-linked key

Kind: instance method of opinion
Returns: object - the api credentials { apiKey, walletAddress }

See: https://docs.opinion.trade/developer-guide/opinion-open-api/authentication

ParamTypeRequiredDescription
paramsobjectNoextra parameters
opinion.createApiKey (params?)

fetchApiKey

fetches the currently active Open API key for this.walletAddress

Kind: instance method of opinion
Returns: object - the api credentials { apiKey, walletAddress }

See: https://docs.opinion.trade/developer-guide/opinion-open-api/authentication

ParamTypeRequiredDescription
paramsobjectNoextra parameters
opinion.fetchApiKey (params?)

deleteApiKey

revokes the Open API key for this.walletAddress

Kind: instance method of opinion
Returns: object - raw response, result.deleted confirms revocation

See: https://docs.opinion.trade/developer-guide/opinion-open-api/authentication

ParamTypeRequiredDescription
paramsobjectNoextra parameters
opinion.deleteApiKey (params?)

watchOrderBook

streams the order book of an outcome token; the channel is delta-only so the live book is seeded from the REST snapshot

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

See: https://docs.opinion.trade/developer-guide/opinion-websocket/market-channels

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
limitintNothe maximum number of order book entries to return
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.watchOrderBook (outcome, limit?, params?)

watchTicker

streams last-price updates of an outcome token

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

See: https://docs.opinion.trade/developer-guide/opinion-websocket/market-channels

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.watchTicker (outcome, params?)

watchTrades

streams public trades of an outcome token

Kind: instance method of opinion
Returns: Array<object> - a list of prediction trade structures

See: https://docs.opinion.trade/developer-guide/opinion-websocket/market-channels

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
opinion.watchTrades (outcome, since?, limit?, params?)

watchOrders

streams the authenticated user's order updates of one market - the venue channel is per-market, so the outcome argument is required

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

See: https://docs.opinion.trade/developer-guide/opinion-websocket/user-channels

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id whose market to watch
sinceintNotimestamp in ms of the earliest order to return
limitintNothe maximum number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.watchOrders (outcome, since?, limit?, params?)

watchMyTrades

streams the authenticated user's executed trades of one market - the venue channel is per-market, so the outcome argument is required

Kind: instance method of opinion
Returns: Array<object> - a list of prediction trade structures

See: https://docs.opinion.trade/developer-guide/opinion-websocket/user-channels

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome token id whose market to watch
sinceintNotimestamp in ms of the earliest trade to return
limitintNothe maximum number of trades to return
paramsobjectNoextra parameters specific to the exchange API endpoint
opinion.watchMyTrades (outcome, since?, limit?, params?)

On this page