Skip to content
github-actions[bot] edited this page Sep 5, 2026 · 4 revisions

myriad{docsify-ignore}

Kind: global class
Extends: Exchange

fetchMarkets{docsify-ignore}

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

Param Type Required Description
params object No extra exchange-specific parameters
params.query string No a single search term used to filter the fetched markets
params.queries Array<string> No multiple search terms (alternative to query)
params.state string No 'open', 'closed' or 'resolved', the state of the markets to fetch, defaults to 'open'
params.limit int No max number of markets to collect (defaults to options.fetchMarketsLimit, 1000); stops the pagination once reached
myriad.fetchMarkets (params?)

fetchEvent{docsify-ignore}

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

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

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

Param Type Required Description
id string Yes the market id, or orderbook slug
params object No extra parameters specific to the exchange API endpoint
myriad.fetchEvent (id, params?)

fetchPositions{docsify-ignore}

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 prediction position structures

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

Param Type Required Description
outcomes Array<string> No unified outcomes to filter by
params object No extra exchange-specific parameters
params.address string No the wallet address to query, defaults to this.walletAddress
myriad.fetchPositions (outcomes?, params?)

fetchTradeQuote{docsify-ignore}

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

Param Type Required Description
outcome string Yes unified outcome or outcome id
side string Yes 'buy' or 'sell'
amount float Yes for 'buy' the collateral value to spend; for 'sell' the number of shares to sell
params object No extra parameters specific to the exchange API endpoint
params.slippage float No maximum slippage tolerance (default 0.005)
myriad.fetchTradeQuote (outcome, side, amount, params?)

createOrder{docsify-ignore}

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 - a prediction order structure

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

Param Type Required Description
outcome string Yes unified outcome or outcome id
type string Yes 'limit' or 'market' (order book); ignored by the AMM path
side string Yes 'buy' or 'sell'
amount float Yes number of outcome shares to trade (AMM 'buy' spends this as collateral value instead)
price float No price per share as a fraction in [0, 1] (required for order-book limit orders)
params object No extra parameters specific to the exchange API endpoint
params.tradingModel string No 'ob' to force the order book, 'amm' to force the on-chain AMM; defaults to the market's model
params.timeInForce string No order-book time in force: 'GTC', 'GTD', 'FOK', 'FAK' or 'PO'
params.expiration string No unix-seconds expiration for a GTD order
myriad.createOrder (outcome, type, side, amount, price?, params?)

createOrders{docsify-ignore}

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 prediction order structures

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

Param Type Required Description
orders Array<object> Yes a list of order requests, each with outcome, type, side, amount, price and params
params object No extra parameters specific to the exchange API endpoint
myriad.createOrders (orders, params?)

editOrder{docsify-ignore}

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 - a prediction order structure

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

Param Type Required Description
id string Yes the hash of the order to replace
outcome string Yes unified outcome of the new order
type string Yes 'limit' or 'market'
side string Yes 'buy' or 'sell'
amount float Yes number of outcome shares for the new order
price float No price per share as a fraction in [0, 1]
params object No extra parameters specific to the exchange API endpoint
params.orderResponse object No a pre-fetched fetchOrder-style response for the order being replaced; avoids the internal lookup when already available, call fetchOrder to retrieve this data
params.rawOrder object No the raw order payload to cancel as an alternative to params.orderResponse, call fetchOrder to retrieve this data
params.networkId string No the order-book network id, required when using params.rawOrder without an embedded network id
myriad.editOrder (id, outcome, type, side, amount, price?, params?)

createMarketBuyOrderWithCost{docsify-ignore}

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

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

See: createAmmOrder supports params.quote from fetchTradeQuote(outcome, 'buy', amount)

Param Type Required Description
outcome string Yes unified outcome handle
cost number Yes collateral amount to spend
params object No extra parameters passed through to createAmmOrder
myriad.createMarketBuyOrderWithCost (outcome, cost, params?)

cancelOrder{docsify-ignore}

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 - a prediction order structure

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

Param Type Required Description
id string Yes the order hash returned by createOrder
outcome string No unified outcome the order belongs to
params object No extra parameters specific to the exchange API endpoint
params.orderResponse object No a pre-fetched fetchOrder-style response for the target order; avoids the internal order lookup when already available, call fetchOrder to retrieve this data
params.rawOrder object No the raw order payload to sign as an alternative to params.orderResponse, call fetchOrder to retrieve this data
params.networkId string No the order-book network id, required when using params.rawOrder without an embedded network id
myriad.cancelOrder (id, outcome?, params?)

cancelAllOrders{docsify-ignore}

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

Kind: instance method of myriad
Returns: Array<object> - a list with one prediction order structure whose info carries the cancelled count

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

Param Type Required Description
outcome string No unified outcome; when omitted cancels across all markets
params object No extra parameters specific to the exchange API endpoint
myriad.cancelAllOrders (outcome?, params?)

cancelOrders{docsify-ignore}

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

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

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

Param Type Required Description
ids Array<string> Yes the order hashes to cancel
outcome string No not used by myriad cancelOrders
params object No extra parameters specific to the exchange API endpoint
params.orderResponses object No pre-fetched fetchOrder-style responses keyed by order hash, or an array of such responses; avoids the internal per-order lookups when already available, call fetchOrder for each id to retrieve this data
params.networkId string No the order-book network id fallback for any supplied raw order data
myriad.cancelOrders (ids, outcome?, params?)

fetchOrder{docsify-ignore}

fetches a single order book order by its hash

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

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

Param Type Required Description
id string Yes the order hash
outcome string No unified outcome the order belongs to
params object No extra parameters specific to the exchange API endpoint
myriad.fetchOrder (id, outcome?, params?)

fetchOrders{docsify-ignore}

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

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

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

Param Type Required Description
outcome string No unified outcome to filter by
since int No timestamp in ms of the earliest order
limit int No the maximum number of orders to return
params object No extra parameters specific to the exchange API endpoint
params.trader string No wallet address to query (defaults to the configured wallet)
params.status string No 'open', 'filled', 'cancelled' or 'expired'
myriad.fetchOrders (outcome?, since?, limit?, params?)

fetchOpenOrders{docsify-ignore}

fetches open order book orders for the wallet

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

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

Param Type Required Description
outcome string No unified outcome to filter by
since int No timestamp in ms of the earliest order
limit int No the maximum number of orders to return
params object No extra parameters specific to the exchange API endpoint
myriad.fetchOpenOrders (outcome?, since?, limit?, params?)

fetchClosedOrders{docsify-ignore}

fetches the wallet's filled order book orders

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

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

Param Type Required Description
outcome string No unified outcome to filter by
since int No timestamp in ms of the earliest order
limit int No the maximum number of orders to return
params object No extra parameters specific to the exchange API endpoint
myriad.fetchClosedOrders (outcome?, since?, limit?, params?)

fetchCanceledOrders{docsify-ignore}

fetches the wallet's cancelled order book orders

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

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

Param Type Required Description
outcome string No unified outcome to filter by
since int No timestamp in ms of the earliest order
limit int No the maximum number of orders to return
params object No extra parameters specific to the exchange API endpoint
myriad.fetchCanceledOrders (outcome?, since?, limit?, params?)

fetchMyTrades{docsify-ignore}

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 prediction trade structures

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

Param Type Required Description
outcome string No unified outcome to filter by
since int No timestamp in ms of the earliest trade
limit int No the maximum number of trades to return
params object No extra parameters specific to the exchange API endpoint
myriad.fetchMyTrades (outcome?, since?, limit?, params?)

fetchBalance{docsify-ignore}

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

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
params.network_id string No the network id (defaults to options.defaultNetworkId, '56')
params.network string No alias for params.network_id
params.currency string No output balance currency code override, e.g. 'USDC' or 'USDT'
params.decimals int No for USDC and USDT it's 6, default is 18 for USD1
myriad.fetchBalance (params?)

fetchTicker{docsify-ignore}

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

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

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

Param Type Required Description
outcome string Yes unified outcome like TRUMP_WIN:YES or an outcome id like 2741:756/0
params object No extra parameters specific to the exchange API endpoint
myriad.fetchTicker (outcome, params?)

fetchTradingFee{docsify-ignore}

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

Param Type Required Description
outcome string Yes unified outcome or outcome id
params object No extra parameters specific to the exchange API endpoint
myriad.fetchTradingFee (outcome, params?)

fetchOrderBook{docsify-ignore}

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 - a prediction order book structure

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

Param Type Required Description
outcome string Yes unified outcome like TRUMP_WIN:YES or an outcome id
limit int No not used by myriad fetchOrderBook
params object No extra parameters specific to the exchange API endpoint
myriad.fetchOrderBook (outcome, limit?, params?)

fetchOHLCV{docsify-ignore}

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

Param Type Required Description
outcome string Yes unified outcome like TRUMP_WIN:YES or an outcome id
timeframe string Yes mapped to the closest available chart bucket (24h, 7d or 30d)
since int No timestamp in ms of the earliest candle to fetch
limit int No the maximum number of candles to return
params object No extra parameters specific to the exchange API endpoint
myriad.fetchOHLCV (outcome, timeframe, since?, limit?, params?)

fetchTickers{docsify-ignore}

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 prediction ticker structures indexed by outcome

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

Param Type Required Description
outcomes Array<string> Yes unified outcomes — required: myriad has no endpoint returning all tickers at once, so an unscoped call is not supported
params object No extra parameters specific to the exchange API endpoint
myriad.fetchTickers (outcomes, params?)

fetchTrades{docsify-ignore}

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

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

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

Param Type Required Description
outcome string Yes unified outcome like TRUMP_WIN:YES or an outcome id
since int No timestamp in ms of the earliest trade to fetch
limit int No the maximum number of trades to return
params object No extra parameters specific to the exchange API endpoint
myriad.fetchTrades (outcome, since?, limit?, params?)

fetchEvents{docsify-ignore}

fetches prediction-market events matching the given scope (query/queries/tags/eventId) 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

Param Type Required Description
params object No extra exchange-specific parameters
params.query string No a single search term; an eventId does a direct lookup and tags map to server-side keyword searches
params.queries Array<string> No multiple search terms (alternative to query)
params.tags Array<string> No tag slugs to scope by (searched as keywords, e.g. ['bitcoin', 'world-cup'])
params.eventId string No direct lookup by unified event id (composite networkId:marketId) like '56:170145' or questions path like '793bfc47-ddcd-47d2-aad5-52c7002fc823'
params.limit int No maximum number of markets per query, defaults to 50
params.state string No 'open', 'closed' or 'resolved', defaults to 'open'
myriad.fetchEvents (params?)

watchOrderBook{docsify-ignore}

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 - a prediction order book structure

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

Param Type Required Description
outcome string Yes unified outcome
limit int No the maximum number of order book entries to return
params object No extra parameters specific to the exchange API endpoint
myriad.watchOrderBook (outcome, limit?, params?)

watchTrades{docsify-ignore}

streams public trades for an outcome over the Centrifugo websocket

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

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

Param Type Required Description
outcome string Yes unified outcome
since int No timestamp in ms of the earliest trade
limit int No the maximum number of trades to return
params object No extra parameters specific to the exchange API endpoint
myriad.watchTrades (outcome, since?, limit?, params?)

watchMyTrades{docsify-ignore}

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 prediction trade structures

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

Param Type Required Description
outcome string Yes unified outcome whose market to watch
since int No timestamp in ms of the earliest trade
limit int No the maximum number of trades to return
params object No extra parameters specific to the exchange API endpoint
myriad.watchMyTrades (outcome, since?, limit?, params?)

watchTicker{docsify-ignore}

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

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

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

Param Type Required Description
outcome string Yes unified outcome
params object No extra parameters specific to the exchange API endpoint
myriad.watchTicker (outcome, params?)

watchTickers{docsify-ignore}

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

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

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

Param Type Required Description
outcomes Array<string> Yes unified outcomes to watch
params object No extra parameters specific to the exchange API endpoint
myriad.watchTickers (outcomes, params?)

watchOHLCV{docsify-ignore}

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

Param Type Required Description
outcome string Yes unified outcome
timeframe string Yes the length of each candle (e.g. '1m', '1h', '1d')
since int No timestamp in ms of the earliest candle
limit int No the maximum number of candles to return
params object No extra parameters specific to the exchange API endpoint
myriad.watchOHLCV (outcome, timeframe, since?, limit?, params?)

watchOrders{docsify-ignore}

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

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

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

Param Type Required Description
outcome string No unified outcome to filter by
since int No timestamp in ms of the earliest order
limit int No the maximum number of orders to return
params object No extra parameters specific to the exchange API endpoint
myriad.watchOrders (outcome?, since?, limit?, params?)

watchPositions{docsify-ignore}

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

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

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

Param Type Required Description
outcomes Array<string> No unified outcomes to filter by
since int No timestamp in ms of the earliest position update
limit int No the maximum number of position updates to return
params object No extra parameters specific to the exchange API endpoint
myriad.watchPositions (outcomes?, since?, limit?, params?)

Clone this wiki locally