hyperliquid
hyperliquid prediction-market exchange — CCXT unified API: methods, parameters and endpoints.
hyperliquid
Kind: global class
Extends: Exchange
- fetchMarkets
- fetchTicker
- fetchTickers
- fetchOrderBook
- fetchOHLCV
- fetchBalance
- fetchPositions
- createOrder
- cancelOrder
- cancelOrders
- fetchOpenOrders
- fetchOrders
- fetchOrder
- fetchTrades
- fetchMyTrades
- fetchEvents
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
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome (e.g. 'BTC_ABOVE_78213_20260503:YES') |
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| outcomes | Array<string> | No | filter by outcome ids or outcomes |
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome |
| limit | int | No | max depth levels (not used by hyperliquid but accepted) |
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome |
| timeframe | string | Yes | '1m', '5m', '15m', '1h', '4h', '1d', etc. |
| since | int | No | timestamp in ms of earliest candle |
| limit | int | No | max number of candles |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | end 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
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters |
| params.user | string | No | wallet address (defaults to this.walletAddress) |
hyperliquid.fetchBalance (params?)fetchPositions
fetches the user's outcome positions; outcome positions are spot token balances under the "+
Kind: instance method of hyperliquid
Returns: Array<object> - a list of position structures
| Param | Type | Required | Description |
|---|---|---|---|
| outcomes | Array<string> | No | filter by outcome ids or outcomes |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.user | string | No | wallet 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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome |
| type | string | Yes | 'limit' or 'market' |
| side | string | Yes | 'buy' or 'sell' |
| amount | float | Yes | quantity of outcome tokens |
| price | float | No | limit price (0–1 range for prediction markets) |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.timeInForce | string | No | 'Gtc' |
| params.postOnly | boolean | No | if true sets timeInForce to 'Alo' |
| params.reduceOnly | boolean | No | if true, marks the order as reduce only so it can only decrease an existing position |
| params.slippage | string | No | slippage for market orders (default 5%) |
| params.clientOrderId | string | No | hex cloid |
| params.vaultAddress | string | No | optional 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
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| outcome | string | No | unified outcome |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderId | string | No | cancel by client order id |
| params.vaultAddress | string | No | optional 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
| Param | Type | Required | Description |
|---|---|---|---|
| ids | Array<string> | Yes | order ids |
| outcome | string | No | unified outcome (required) |
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter by outcome |
| since | int | No | only return orders updated since this timestamp in ms |
| limit | int | No | max number of orders to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.user | string | No | wallet address |
| params.method | string | No | '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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter by outcome |
| since | int | No | only return orders updated since this timestamp in ms |
| limit | int | No | max number of orders to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.user | string | No | wallet address |
hyperliquid.fetchOrders (outcome?, since?, limit?, params?)fetchOrder
fetches a single order by id
Kind: instance method of hyperliquid
Returns: object - an order structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| outcome | string | No | outcome |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.user | string | No | wallet address |
| params.clientOrderId | string | No | fetch 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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome |
| since | int | No | only return trades at or after this timestamp in ms |
| limit | int | No | the maximum number of trades to return |
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter by outcome |
| since | int | No | start timestamp in ms |
| limit | int | No | max number of trades to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.user | string | No | wallet address |
| params.until | int | No | end 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
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters |
| params.query | string | No | a single query string to filter by (matches description/outcome) |
| params.queries | Array<string> | No | multiple query strings (alternative to query) |
hyperliquid.fetchEvents (params?)