CCXT

myriad

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

myriad

Kind: global class
Extends: Exchange

fetchMarkets

retrieves data on all markets for myriad, each prediction market becomes one market with its outcome tokens listed under the outcomes key

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

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
paramsobjectNoextra exchange-specific parameters
params.querystringNoa single search term used to filter the fetched markets
params.queriesArray<string>Nomultiple search terms (alternative to query)
params.statestringNo'open', 'closed' or 'resolved', the state of the markets to fetch, defaults to 'open'
params.limitintNomax number of markets to collect (defaults to options.fetchMarketsLimit, 1000); stops the pagination once reached
myriad.fetchMarkets (params?)

fetchEvent

fetches a single prediction-market event by its market id

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

See: https://docs.myriad.markets/builders/myriad-api-reference

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

fetchPositions

fetch the open outcome-token positions held by a wallet (myriad settles trades on-chain, so only read-only portfolio data is exposed by the API)

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

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
outcomesArray<string>Nounified outcomes to filter by
paramsobjectNoextra exchange-specific parameters
params.addressstringNothe wallet address to query, defaults to this.walletAddress
myriad.fetchPositions (outcomes?, params?)

fetchTradeQuote

fetches a trade quote — price, shares, fees and the on-chain calldata — for buying or selling an outcome. Myriad settles trades on-chain, so this returns the calldata to submit to the prediction-market contract rather than placing an off-chain order

Kind: instance method of myriad
Returns: object - a quote object with price, shares, fees and the on-chain calldata

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome id
sidestringYes'buy' or 'sell'
amountfloatYesfor 'buy' the collateral value to spend; for 'sell' the number of shares to sell
paramsobjectNoextra parameters specific to the exchange API endpoint
params.slippagefloatNomaximum slippage tolerance (default 0.005)
myriad.fetchTradeQuote (outcome, side, amount, params?)

createOrder

create a trade order. Myriad has two trading models: a gasless order book (CLOB) where an EIP-712 signed order is posted off-chain and settled by the operator, and an on-chain AMM. Order-book markets are used by default; the model can be forced via params.tradingModel

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da8281e2bc49cf4914b07528

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome id
typestringYes'limit' or 'market' (order book); ignored by the AMM path
sidestringYes'buy' or 'sell'
amountfloatYesnumber of outcome shares to trade (AMM 'buy' spends this as collateral value instead)
pricefloatNoprice per share as a fraction in [0, 1] (required for order-book limit orders)
paramsobjectNoextra parameters specific to the exchange API endpoint
params.tradingModelstringNo'ob' to force the order book, 'amm' to force the on-chain AMM; defaults to the market's model
params.timeInForcestringNoorder-book time in force: 'GTC', 'GTD', 'FOK', 'FAK' or 'PO'
params.expirationstringNounix-seconds expiration for a GTD order
myriad.createOrder (outcome, type, side, amount, price?, params?)

createOrders

places multiple order book orders. Myriad's batch endpoint is not reliable, so the orders are signed and submitted sequentially (not atomically)

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da8281e2bc49cf4914b07528

ParamTypeRequiredDescription
ordersArray<object>Yesa list of order requests, each with outcome, type, side, amount, price and params
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.createOrders (orders, params?)

editOrder

edits an open order by cancelling it and placing a replacement (gasless). Myriad's batch-modify endpoint is not reliable, so the cancel and replace are submitted sequentially

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da8281b58c5adb2f5998eec8

ParamTypeRequiredDescription
idstringYesthe hash of the order to replace
outcomestringYesunified outcome of the new order
typestringYes'limit' or 'market'
sidestringYes'buy' or 'sell'
amountfloatYesnumber of outcome shares for the new order
pricefloatNoprice per share as a fraction in [0, 1]
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.editOrder (id, outcome, type, side, amount, price?, params?)

createMarketBuyOrderWithCost

buys an outcome by spending a fixed collateral amount on the AMM (dollar-sizing)

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

ParamTypeRequiredDescription
outcomestringYesunified outcome handle
costfloatYesthe collateral (USDC) amount to spend
paramsobjectNoextra exchange-specific parameters
myriad.createMarketBuyOrderWithCost (outcome, cost, params?)

cancelOrder

cancels an open order book order by its hash (re-signs the original order to prove ownership; gasless)

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da8281b58c5adb2f5998eec8

ParamTypeRequiredDescription
idstringYesthe order hash returned by createOrder
outcomestringNounified outcome the order belongs to
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.cancelOrder (id, outcome?, params?)

cancelAllOrders

cancels all open order book orders for the wallet, optionally scoped to one market (gasless)

Kind: instance method of myriad
Returns: object - the raw response with the count of cancelled orders

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da8281e7a14cd34e6a716761

ParamTypeRequiredDescription
outcomestringNounified outcome; when omitted cancels across all markets
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.cancelAllOrders (outcome?, params?)

cancelOrders

cancels multiple open order book orders by hash in one request (gasless)

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da828177961fd94a6055966f

ParamTypeRequiredDescription
idsArray<string>Yesthe order hashes to cancel
outcomestringNonot used by myriad cancelOrders
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.cancelOrders (ids, outcome?, params?)

fetchOrder

fetches a single order book order by its hash

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da828116b8a0d976baea1df0

ParamTypeRequiredDescription
idstringYesthe order hash
outcomestringNounified outcome the order belongs to
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchOrder (id, outcome?, params?)

fetchOrders

fetches order book orders for the wallet (or any trader passed via params.trader)

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da828171a003cf996487d008

ParamTypeRequiredDescription
outcomestringNounified outcome to filter by
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.traderstringNowallet address to query (defaults to the configured wallet)
params.statusstringNo'open', 'filled', 'cancelled' or 'expired'
myriad.fetchOrders (outcome?, since?, limit?, params?)

fetchOpenOrders

fetches open order book orders for the wallet

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da828171a003cf996487d008

ParamTypeRequiredDescription
outcomestringNounified outcome to filter by
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchOpenOrders (outcome?, since?, limit?, params?)

fetchClosedOrders

fetches the wallet's filled order book orders

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da828171a003cf996487d008

ParamTypeRequiredDescription
outcomestringNounified outcome to filter by
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchClosedOrders (outcome?, since?, limit?, params?)

fetchCanceledOrders

fetches the wallet's cancelled order book orders

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da828171a003cf996487d008

ParamTypeRequiredDescription
outcomestringNounified outcome to filter by
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchCanceledOrders (outcome?, since?, limit?, params?)

fetchMyTrades

fetches the wallet's filled order book orders as trades. Note: Myriad's REST exposes the order's limit price, not the per-fill execution price, so the price reflects the order's limit (exact for resting/limit fills, an upper/lower bound for market orders) — use watchTrades for live execution prices

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da828171a003cf996487d008

ParamTypeRequiredDescription
outcomestringNounified outcome to filter by
sinceintNotimestamp in ms of the earliest trade
limitintNothe maximum number of trades to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchMyTrades (outcome?, since?, limit?, params?)

fetchBalance

fetches the wallet's on-chain collateral balance for the order-book network (USD1 on BNB Chain)

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.network_idstringNothe network id (defaults to options.defaultNetworkId, '56')
myriad.fetchBalance (params?)

fetchTicker

fetches the current price for a single outcome by loading the parent market

Kind: instance method of myriad
Returns: object - a ticker structure

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
outcomestringYesunified outcome like TRUMP_WIN:YES or an outcome id like 2741:756/0
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchTicker (outcome, params?)

fetchTradingFee

fetches the buy/sell fee rates for a market outcome

Kind: instance method of myriad
Returns: object - a fee structure

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome id
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchTradingFee (outcome, params?)

fetchOrderBook

fetches the real order book for order-book markets, or synthesizes a one-level book from the AMM price otherwise

Kind: instance method of myriad
Returns: object - an order book structure

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da8281bba6aaf24dd61f2bb1

ParamTypeRequiredDescription
outcomestringYesunified outcome like TRUMP_WIN:YES or an outcome id
limitintNonot used by myriad fetchOrderBook
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchOrderBook (outcome, limit?, params?)

fetchOHLCV

fetches price history for an outcome from the price_charts bucket embedded in the market response

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

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
outcomestringYesunified outcome like TRUMP_WIN:YES or an outcome id
timeframestringYesmapped to the closest available chart bucket (24h, 7d or 30d)
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum number of candles to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchOHLCV (outcome, timeframe, since?, limit?, params?)

fetchTickers

fetches tickers for multiple outcomes, grouping requested outcomes by their parent market to fetch each market only once

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

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
outcomesArray<string>Yesunified outcomes — required: myriad has no endpoint returning all tickers at once, so an unscoped call is not supported
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchTickers (outcomes, params?)

fetchTrades

fetches recent public trades for a single outcome from the market action feed

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

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
outcomestringYesunified outcome like TRUMP_WIN:YES or an outcome id
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum number of trades to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.fetchTrades (outcome, since?, limit?, params?)

fetchEvents

fetches prediction-market events matching the given scope (query/queries/tags/eventId — required) and caches their markets and outcomes on the instance

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

See: https://docs.myriad.markets/builders/myriad-api-reference

ParamTypeRequiredDescription
paramsobjectNoextra exchange-specific parameters
params.querystringNoa single search term; an eventId does a direct lookup and tags map to server-side keyword searches
params.queriesArray<string>Nomultiple search terms (alternative to query)
params.tagsArray<string>Notag slugs to scope by (searched as keywords, e.g. ['bitcoin', 'world-cup'])
params.eventIdstringNodirect lookup by unified event id (composite networkId:marketId)
params.limitintNomaximum number of markets per query, defaults to 50
params.statestringNo'open', 'closed' or 'resolved', defaults to 'open'
myriad.fetchEvents (params?)

watchOrderBook

streams the order book for an outcome over the Centrifugo websocket; the channel is delta-only so the book is seeded from the REST snapshot

Kind: instance method of myriad
Returns: object - an order book structure

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da82810581f8d2c8be2364fa

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

watchTrades

streams public trades for an outcome over the Centrifugo websocket

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da82810581f8d2c8be2364fa

ParamTypeRequiredDescription
outcomestringYesunified outcome
sinceintNotimestamp in ms of the earliest trade
limitintNothe maximum number of trades to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.watchTrades (outcome, since?, limit?, params?)

watchMyTrades

streams the wallet's own fills for a market over the Centrifugo trades channel (real execution prices, unlike the REST fetchMyTrades); requires a market outcome since the channel is per-market

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da82810581f8d2c8be2364fa

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

watchTicker

streams best bid/ask/last for an outcome over the Centrifugo prices channel

Kind: instance method of myriad
Returns: object - a ticker structure

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da82810581f8d2c8be2364fa

ParamTypeRequiredDescription
outcomestringYesunified outcome
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.watchTicker (outcome, params?)

watchTickers

streams best bid/ask/last for several outcomes over the Centrifugo prices channels

Kind: instance method of myriad
Returns: object - a dict of ticker structures indexed by outcome

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da82810581f8d2c8be2364fa

ParamTypeRequiredDescription
outcomesArray<string>Yesunified outcomes to watch
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.watchTickers (outcomes, params?)

watchOHLCV

streams OHLCV candles for an outcome, synthesised from the live trades channel

Kind: instance method of myriad
Returns: Array<Array<int>> - a list of [timestamp, open, high, low, close, volume] candles

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da82810581f8d2c8be2364fa

ParamTypeRequiredDescription
outcomestringYesunified outcome
timeframestringYesthe length of each candle (e.g. '1m', '1h', '1d')
sinceintNotimestamp in ms of the earliest candle
limitintNothe maximum number of candles to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.watchOHLCV (outcome, timeframe, since?, limit?, params?)

watchOrders

streams the wallet's order lifecycle updates over the Centrifugo orders channel

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da82810581f8d2c8be2364fa

ParamTypeRequiredDescription
outcomestringNounified outcome to filter by
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.watchOrders (outcome?, since?, limit?, params?)

watchPositions

streams the wallet's share-balance changes over the Centrifugo positions channel

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

See: https://docs.myriad.markets/builders/myriad-order-book/order-book-api#37dc9e49da82810581f8d2c8be2364fa

ParamTypeRequiredDescription
outcomesArray<string>Nounified outcomes to filter by
sinceintNotimestamp in ms of the earliest position update
limitintNothe maximum number of position updates to return
paramsobjectNoextra parameters specific to the exchange API endpoint
myriad.watchPositions (outcomes?, since?, limit?, params?)

On this page