myriad
myriad prediction-market exchange — CCXT unified API: methods, parameters and endpoints.
myriad
Kind: global class
Extends: Exchange
- fetchMarkets
- fetchEvent
- fetchPositions
- fetchTradeQuote
- createOrder
- createOrders
- editOrder
- createMarketBuyOrderWithCost
- cancelOrder
- cancelAllOrders
- cancelOrders
- fetchOrder
- fetchOrders
- fetchOpenOrders
- fetchClosedOrders
- fetchCanceledOrders
- fetchMyTrades
- fetchBalance
- fetchTicker
- fetchTradingFee
- fetchOrderBook
- fetchOHLCV
- fetchTickers
- fetchTrades
- fetchEvents
- watchOrderBook
- watchTrades
- watchMyTrades
- watchTicker
- watchTickers
- watchOHLCV
- watchOrders
- watchPositions
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
| 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
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
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the market id |
| params | object | No | extra 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
| 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
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
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
| 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
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
| 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
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
| 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 |
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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome handle |
| cost | float | Yes | the collateral (USDC) amount to spend |
| params | object | No | extra 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
| 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 |
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
| 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
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
| 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 |
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
| 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
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
| 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
fetches open order book orders for the wallet
Kind: instance method of myriad
Returns: Array<object> - a list of order structures
| 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
fetches the wallet's filled order book orders
Kind: instance method of myriad
Returns: Array<object> - a list of order structures
| 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
fetches the wallet's cancelled order book orders
Kind: instance method of myriad
Returns: Array<object> - a list of order structures
| 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
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
| 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
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') |
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
| 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
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
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
| 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
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
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
| 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
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
| 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
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
| 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) |
| 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
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
| 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
streams public trades for an outcome over the Centrifugo websocket
Kind: instance method of myriad
Returns: Array<object> - a list of trade structures
| 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
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
| 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
streams best bid/ask/last for an outcome over the Centrifugo prices channel
Kind: instance method of myriad
Returns: object - a ticker structure
| 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
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
| 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
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
| 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
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
| 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
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
| 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?)