CCXT

hyperliquid

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

hyperliquid

Kind: global class
Extends: Exchange

fetchMarkets

Retrieves all Hyperliquid outcome markets from outcomeMeta. Each binary outcome becomes one CCXT prediction market with two outcomes: YES and NO.

Kind: instance method of hyperliquid
Returns: Array<Market> - array of market structures

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/asset-ids#outcomes

ParamTypeRequiredDescription
paramsobjectNoextra parameters
hyperliquid.fetchMarkets (params?)

fetchTicker

fetches a ticker for a single outcome market using the L2 order book snapshot

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot

ParamTypeRequiredDescription
outcomestringYesunified outcome (e.g. 'BTC_ABOVE_78213_20260503:YES')
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchTicker (outcome, params?)

fetchTickers

fetches all outcome market tickers using allMids then optionally enriches with l2Book

Kind: instance method of hyperliquid
Returns: object - a dictionary of ticker structures

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-all-mids-for-all-actively-traded-coins

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

fetchOrderBook

fetches the L2 order book for an outcome market

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot

ParamTypeRequiredDescription
outcomestringYesunified outcome
limitintNomax depth levels (not used by hyperliquid but accepted)
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchOrderBook (outcome, limit?, params?)

fetchOHLCV

fetches candlestick OHLCV data for an outcome market

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot

ParamTypeRequiredDescription
outcomestringYesunified outcome
timeframestringYes'1m', '5m', '15m', '1h', '4h', '1d', etc.
sinceintNotimestamp in ms of earliest candle
limitintNomax number of candles
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNoend timestamp in ms
hyperliquid.fetchOHLCV (outcome, timeframe, since?, limit?, params?)

fetchBalance

Fetches spot balance (outcomes use spot-like balance).

Kind: instance method of hyperliquid
Returns: Balances - balance structure

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances

ParamTypeRequiredDescription
paramsobjectNoextra parameters
params.userstringNowallet address (defaults to this.walletAddress)
hyperliquid.fetchBalance (params?)

fetchPositions

fetches the user's outcome positions; outcome positions are spot token balances under the "+" coin form (size and entry notional), the value/entry/mark price/pnl are computed from the current mid prices

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances

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

createOrder

creates a limit or market order for an outcome market

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order

ParamTypeRequiredDescription
outcomestringYesunified outcome
typestringYes'limit' or 'market'
sidestringYes'buy' or 'sell'
amountfloatYesquantity of outcome tokens
pricefloatNolimit price (0–1 range for prediction markets)
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNo'Gtc'
params.postOnlybooleanNoif true sets timeInForce to 'Alo'
params.reduceOnlybooleanNoif true, marks the order as reduce only so it can only decrease an existing position
params.slippagestringNoslippage for market orders (default 5%)
params.clientOrderIdstringNohex cloid
params.vaultAddressstringNooptional subaccount/vault address to trade on behalf of (master signer must be authorized)
hyperliquid.createOrder (outcome, type, side, amount, price?, params?)

cancelOrder

cancels a single open order

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s

ParamTypeRequiredDescription
idstringYesorder id
outcomestringNounified outcome
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdstringNocancel by client order id
params.vaultAddressstringNooptional subaccount/vault address to cancel on behalf of
hyperliquid.cancelOrder (id, outcome?, params?)

cancelOrders

cancels multiple open orders

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s

ParamTypeRequiredDescription
idsArray<string>Yesorder ids
outcomestringNounified outcome (required)
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.cancelOrders (ids, outcome?, params?)

fetchOpenOrders

fetches currently open orders for the user

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders

ParamTypeRequiredDescription
outcomestringNofilter by outcome
sinceintNoonly return orders updated since this timestamp in ms
limitintNomax number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNowallet address
params.methodstringNo'openOrders'
hyperliquid.fetchOpenOrders (outcome?, since?, limit?, params?)

fetchOrders

fetches all historical orders for the user

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-historical-orders

ParamTypeRequiredDescription
outcomestringNofilter by outcome
sinceintNoonly return orders updated since this timestamp in ms
limitintNomax number of orders to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNowallet address
hyperliquid.fetchOrders (outcome?, since?, limit?, params?)

fetchOrder

fetches a single order by id

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid

ParamTypeRequiredDescription
idstringYesorder id
outcomestringNooutcome
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNowallet address
params.clientOrderIdstringNofetch by client order id instead
hyperliquid.fetchOrder (id, outcome?, params?)

fetchTrades

fetches the most recent public trades for an outcome

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-coins-recent-trades

ParamTypeRequiredDescription
outcomestringYesunified outcome
sinceintNoonly return trades at or after this timestamp in ms
limitintNothe maximum number of trades to return
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchTrades (outcome, since?, limit?, params?)

fetchMyTrades

fetches the authenticated user's fill history

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills

ParamTypeRequiredDescription
outcomestringNofilter by outcome
sinceintNostart timestamp in ms
limitintNomax number of trades to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNowallet address
params.untilintNoend timestamp in ms
hyperliquid.fetchMyTrades (outcome?, since?, limit?, params?)

fetchEvents

Groups outcome markets by their underlying (e.g. BTC_ABOVE_78213) into event structures. Each event contains both the YES and NO markets.

Kind: instance method of hyperliquid
Returns: Array<PredictionEvent> - array of event structures

ParamTypeRequiredDescription
paramsobjectNoextra parameters
params.querystringNoa single query string to filter by (matches description/outcome)
params.queriesArray<string>Nomultiple query strings (alternative to query)
hyperliquid.fetchEvents (params?)

On this page