CCXT

hyperliquid

hyperliquid cryptocurrency exchange — CCXT unified API: methods, parameters and endpoints.

hyperliquid

Kind: global class
Extends: Exchange

fetchStatus

the latest known information on the availability of the exchange API

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

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchStatus (params?)

fetchTime

fetches the current integer timestamp in milliseconds from the exchange server

Kind: instance method of hyperliquid
Returns: int - the current integer timestamp in milliseconds from the exchange server

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchTime (params?)

fetchCurrencies

fetches all available currencies on an exchange

Kind: instance method of hyperliquid
Returns: object - an associative dictionary of currencies

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchCurrencies (params?)

fetchMarkets

retrieves data on all markets for hyperliquid

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

See

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchMarkets (params?)

fetchHip3Markets

retrieves data on all hip3 markets for hyperliquid

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

See

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchHip3Markets (params?)

fetchSwapMarkets

retrieves data on all swap markets for hyperliquid

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchSwapMarkets (params?)

calculatePricePrecision

Helper function to calculate the Hyperliquid DECIMAL_PLACES price precision

Kind: instance method of hyperliquid
Returns: int - The calculated price precision

ParamTypeDescription
pricefloatthe price to use in the calculation
amountPrecisionintthe amountPrecision to use in the calculation
maxDecimalsintthe maxDecimals to use in the calculation
hyperliquid.calculatePricePrecision (price, amountPrecision, maxDecimals)

fetchSpotMarkets

retrieves data on all spot markets for hyperliquid

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchSpotMarkets (params?)

fetchBalance

query for balance and get the amount of funds available for trading or funds locked in orders

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

See

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
params.typestringNowallet type, ['spot', 'swap'], defaults to swap
params.marginModestringNo'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
params.dexstringNofor hip3 markets, the dex name, eg: 'xyz'
params.subAccountAddressstringNosub account user address
params.enableUnifiedMarginbooleanNoenable unified margin, CCXT tries to auto-detects this value but you can override it
hyperliquid.fetchBalance (params?)

fetchOrderBook

fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of hyperliquid
Returns: object - A dictionary of order book structures indexed by market symbols

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

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the order book for
limitintNothe maximum amount of order book entries to return
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchOrderBook (symbol, limit?, params?)

fetchTickers

fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

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

See

ParamTypeRequiredDescription
symbolsArray<string>Nounified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNo'spot' or 'swap', by default fetches both
params.hip3booleanNoset to true to fetch hip3 markets only
hyperliquid.fetchTickers (symbols?, params?)

fetchFundingRates

retrieves data on all swap markets for hyperliquid

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.fetchFundingRates (symbols?, params?)

fetchOHLCV

fetches historical candlestick data containing the open, high, low, and close price, and the volume of a 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
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents, support '1m', '15m', '1h', '1d'
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum amount of candles to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNotimestamp in ms of the latest candle to fetch
hyperliquid.fetchOHLCV (symbol, timeframe, since?, limit?, params?)

fetchTrades

get the list of most recent trades for a particular symbol

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

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trades structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNotimestamp in ms of the latest trade
params.addressstringNowallet address that made trades
params.userstringNowallet address that made trades
params.subAccountAddressstringNosub account user address
hyperliquid.fetchTrades (symbol, since?, limit?, params?)

isUnifiedEnabled

returns enableUnifiedMargin so the user can check if unified account is enabled

Kind: instance method of hyperliquid
Returns: bool - enableUnifiedMargin

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-abstraction-state

ParamTypeRequiredDescription
methodstringYesthe method for which we want to check if unified margin is enabled, this is used to check options for specific methods (e.g. fetchBalance can have a specific option to enable unified margin)
addressstringNothe wallet address to query; defaults to the configured walletAddress
shouldRefreshbooleanNoforce a fresh request instead of returning the cached value
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.isUnifiedEnabled (method, address?, shouldRefresh?, params?)

setUserAbstraction

set user abstraction mode

Kind: instance method of hyperliquid
Returns: dictionary response from the exchange

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#set-user-abstraction

ParamTypeRequiredDescription
abstractionstringYesone of the strings ["disabled", "unifiedAccount", "portfolioMargin"],
paramsobjectNo
params.typestringNo'userSetAbstraction' or 'agentSetAbstraction' default is 'userSetAbstraction'
hyperliquid.setUserAbstraction (abstraction, params?)

enableUserDexAbstraction

If set, actions on HIP-3 perps will automatically transfer collateral from validator-operated USDC perps balance for HIP-3 DEXs where USDC is the collateral token, and spot otherwise

Kind: instance method of hyperliquid
Returns: dictionary response from the exchange

ParamTypeRequiredDescription
enabledbooleanYeswhether to enable user dex abstraction
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNo'userDexAbstraction' or 'agentEnableDexAbstraction' default is 'userDexAbstraction'
hyperliquid.enableUserDexAbstraction (enabled, params?)

setAgentAbstraction

set agent abstraction mode

Kind: instance method of hyperliquid
Returns: dictionary response from the exchange

ParamTypeRequiredDescription
abstractionstringYesone of the strings ["i", "u", "p"] where "i" is "disabled", "u" is "unifiedAccount", and "p" is "portfolioMargin"
paramsobjectNo
hyperliquid.setAgentAbstraction (abstraction, params?)

createOrder

create a trade order

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
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNo'Gtc', 'Ioc', 'Alo'
params.postOnlyboolNotrue or false whether the order is post-only
params.reduceOnlyboolNotrue or false whether the order is reduce-only
params.triggerPricefloatNoThe price at which a trigger order is triggered at
params.clientOrderIdstringNoclient order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
params.slippagestringNothe slippage for market order
params.vaultAddressstringNothe vault address for order
params.subAccountAddressstringNosub account user address
hyperliquid.createOrder (symbol, type, side, amount, price?, params?)

createTwapOrder

create a trade order that is executed as a TWAP order over a specified duration.

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

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
durationintYesthe duration of the TWAP order in milliseconds
paramsobjectNoextra parameters specific to the exchange API endpoint
params.randomizeboolNowhether to randomize the time intervals of the TWAP order slices (default is false, meaning equal intervals)
params.reduceOnlyboolNotrue or false whether the order is reduce-only
params.expiresAfterintNotime in ms after which the twap order expires
params.vaultAddressstringNothe vault address for order
hyperliquid.createTwapOrder (symbol, side, amount, duration, params?)

createOrders

create a list of trade orders

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
ordersArrayYeslist of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.createOrders (orders, params?)

createOrdersRequest

create a list of trade orders

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

ParamTypeDescription
ordersArraylist of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
hyperliquid.createOrdersRequest (orders)

cancelOrder

cancels an open order

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

See

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdstringNoclient order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
params.vaultAddressstringNothe vault address for order
params.subAccountAddressstringNosub account user address
params.twapbooleanNowhether the order to cancel is a twap order, (default is false)
hyperliquid.cancelOrder (id, symbol, params?)

cancelOrders

cancel multiple orders

Kind: instance method of hyperliquid
Returns: object - an list of order structures

See

ParamTypeRequiredDescription
idsArray<string>Yesorder ids
symbolstringNounified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdstring, Array<string>Noclient order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
params.vaultAddressstringNothe vault address
params.subAccountAddressstringNosub account user address
hyperliquid.cancelOrders (ids, symbol?, params?)

cancelTwapOrder

cancels a running twap order

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

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

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.expiresAfterintNotime in ms after which the twap order expires
params.vaultAddressstringNothe vault address for order
hyperliquid.cancelTwapOrder (id, symbol, params?)

cancelOrdersRequest

build the request payload for cancelling multiple orders

Kind: instance method of hyperliquid
Returns: object - the raw request object to be sent to the exchange

See

ParamTypeRequiredDescription
idsArray<string>Yesorder ids
symbolstringYesunified market symbol
paramsobjectNo
hyperliquid.cancelOrdersRequest (ids, symbol, params?)

cancelOrdersForSymbols

cancel multiple orders for multiple symbols

Kind: instance method of hyperliquid
Returns: object - an list of order structures

See

ParamTypeRequiredDescription
ordersArray<CancellationRequest>Yeseach order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
paramsobjectNoextra parameters specific to the exchange API endpoint
params.vaultAddressstringNothe vault address
params.subAccountAddressstringNosub account user address
hyperliquid.cancelOrdersForSymbols (orders, params?)

cancelAllOrdersAfter

dead man's switch, cancel all orders after the given timeout

Kind: instance method of hyperliquid
Returns: object - the api result

ParamTypeRequiredDescription
timeoutnumberYestime in milliseconds, 0 represents cancel the timer
paramsobjectNoextra parameters specific to the exchange API endpoint
params.vaultAddressstringNothe vault address
params.subAccountAddressstringNosub account user address
hyperliquid.cancelAllOrdersAfter (timeout, params?)

editOrder

edit a trade order

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders

ParamTypeRequiredDescription
idstringYescancel order id
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNo'Gtc', 'Ioc', 'Alo'
params.postOnlyboolNotrue or false whether the order is post-only
params.reduceOnlyboolNotrue or false whether the order is reduce-only
params.triggerPricefloatNoThe price at which a trigger order is triggered at
params.clientOrderIdstringNoclient order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
params.vaultAddressstringNothe vault address for order
params.subAccountAddressstringNosub account user address
hyperliquid.editOrder (id, symbol, type, side, amount, price?, params?)

editOrders

edit a list of trade orders

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders

ParamTypeRequiredDescription
ordersArrayYeslist of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.editOrders (orders, params?)

createVault

creates a value

Kind: instance method of hyperliquid
Returns: object - the api result

ParamTypeRequiredDescription
namestringYesThe name of the vault
descriptionstringYesThe description of the vault
initialUsdnumberYesThe initialUsd of the vault
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.createVault (name, description, initialUsd, params?)

fetchFundingRateHistory

fetches historical funding rate prices

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the funding rate history for
sinceintNotimestamp in ms of the earliest funding rate to fetch
limitintNothe maximum amount of funding rate structures to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNotimestamp in ms of the latest funding rate
hyperliquid.fetchFundingRateHistory (symbol, since?, limit?, params?)

fetchOpenOrders

fetch all unfilled currently open orders

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

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

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch open orders for
limitintNothe maximum number of open orders structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
params.methodstringNo'openOrders' or 'frontendOpenOrders' default is 'frontendOpenOrders'
params.subAccountAddressstringNosub account user address
params.dexstringNoperp dex name. default is null
hyperliquid.fetchOpenOrders (symbol, since?, limit?, params?)

fetchClosedOrders

fetch all unfilled currently closed orders

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

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch open orders for
limitintNothe maximum number of open orders structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
hyperliquid.fetchClosedOrders (symbol, since?, limit?, params?)

fetchCanceledOrders

fetch all canceled orders

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

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch open orders for
limitintNothe maximum number of open orders structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
hyperliquid.fetchCanceledOrders (symbol, since?, limit?, params?)

fetchCanceledAndClosedOrders

fetch all closed and canceled orders

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

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch open orders for
limitintNothe maximum number of open orders structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
hyperliquid.fetchCanceledAndClosedOrders (symbol, since?, limit?, params?)

fetchOrders

fetch all orders

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

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch open orders for
limitintNothe maximum number of open orders structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
params.subAccountAddressstringNosub account user address
params.dexstringNoperp dex name. default is null
hyperliquid.fetchOrders (symbol, since?, limit?, params?)

fetchOrder

fetches information on an order made by the user

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
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdstringNoclient order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
params.userstringNouser address, will default to this.walletAddress if not provided
params.subAccountAddressstringNosub account user address
hyperliquid.fetchOrder (id, symbol, params?)

fetchMyTrades

fetch all trades made by the user

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

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trades structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNotimestamp in ms of the latest trade
params.subAccountAddressstringNosub account user address
hyperliquid.fetchMyTrades (symbol, since?, limit?, params?)

fetchPosition

fetch data on an open position

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market the position is held in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
hyperliquid.fetchPosition (symbol, params?)

fetchPositions

fetch all open positions

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
params.subAccountAddressstringNosub account user address
params.dexstringNoperp dex name, eg: XYZ
hyperliquid.fetchPositions (symbols?, params?)

setMarginMode

set margin mode (symbol)

Kind: instance method of hyperliquid
Returns: object - response from the exchange

ParamTypeRequiredDescription
marginModestringYesmargin mode must be either [isolated, cross]
symbolstringYesunified market symbol of the market the position is held in, default is undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.leveragestringNothe rate of leverage, is required if setting trade mode (symbol)
params.vaultAddressstringNothe vault address
params.subAccountAddressstringNosub account user address
hyperliquid.setMarginMode (marginMode, symbol, params?)

setLeverage

set the level of leverage for a market

Kind: instance method of hyperliquid
Returns: object - response from the exchange

ParamTypeRequiredDescription
leveragefloatYesthe rate of leverage
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
params.marginModestringNomargin mode must be either [isolated, cross], default is cross
hyperliquid.setLeverage (leverage, symbol, params?)

addMargin

add margin

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin

ParamTypeRequiredDescription
symbolstringYesunified market symbol
amountfloatYesamount of margin to add
paramsobjectNoextra parameters specific to the exchange API endpoint
params.vaultAddressstringNothe vault address
params.subAccountAddressstringNosub account user address
hyperliquid.addMargin (symbol, amount, params?)

reduceMargin

remove margin from a position

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin

ParamTypeRequiredDescription
symbolstringYesunified market symbol
amountfloatYesthe amount of margin to remove
paramsobjectNoextra parameters specific to the exchange API endpoint
params.vaultAddressstringNothe vault address
params.subAccountAddressstringNosub account user address
hyperliquid.reduceMargin (symbol, amount, params?)

transfer

transfer currency internally between wallets on the same account

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer

ParamTypeRequiredDescription
codestringYesunified currency code
amountfloatYesamount to transfer
fromAccountstringYesaccount to transfer from spot, swap
toAccountstringYesaccount to transfer to swap, spot or address
paramsobjectNoextra parameters specific to the exchange API endpoint
params.vaultAddressstringNothe vault address for order
hyperliquid.transfer (code, amount, fromAccount, toAccount, params?)

withdraw

make a withdrawal (only support USDC)

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

See

ParamTypeRequiredDescription
codestringYesunified currency code
amountfloatYesthe amount to withdraw
addressstringYesthe address to withdraw to
tagstringYes
paramsobjectNoextra parameters specific to the exchange API endpoint
params.vaultAddressstringNovault address withdraw from
hyperliquid.withdraw (code, amount, address, tag, params?)

fetchTradingFee

fetch the trading fees for a market

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

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
params.subAccountAddressstringNosub account user address
hyperliquid.fetchTradingFee (symbol, params?)

fetchLedger

fetch the history of changes, actions done by the user or operations that altered the balance of the user

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

ParamTypeRequiredDescription
codestringNounified currency code
sinceintNotimestamp in ms of the earliest ledger entry
limitintNomax number of ledger entries to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNotimestamp in ms of the latest ledger entry
params.subAccountAddressstringNosub account user address
hyperliquid.fetchLedger (code?, since?, limit?, params?)

fetchDeposits

fetch all deposits made to an account

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

ParamTypeRequiredDescription
codestringYesunified currency code
sinceintNothe earliest time in ms to fetch deposits for
limitintNothe maximum number of deposits structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNothe latest time in ms to fetch withdrawals for
params.subAccountAddressstringNosub account user address
params.vaultAddressstringNovault address
hyperliquid.fetchDeposits (code, since?, limit?, params?)

fetchWithdrawals

fetch all withdrawals made from an account

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

ParamTypeRequiredDescription
codestringYesunified currency code
sinceintNothe earliest time in ms to fetch withdrawals for
limitintNothe maximum number of withdrawals structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNothe latest time in ms to fetch withdrawals for
params.subAccountAddressstringNosub account user address
params.vaultAddressstringNovault address
hyperliquid.fetchWithdrawals (code, since?, limit?, params?)

fetchOpenInterests

Retrieves the open interest for a list of symbols

Kind: instance method of hyperliquid
Returns: object - an open interest structure/docs/manual#open-interest-structure

ParamTypeRequiredDescription
symbolsArray<string>NoUnified CCXT market symbol
paramsobjectNoexchange specific parameters
hyperliquid.fetchOpenInterests (symbols?, params?)

fetchOpenInterest

retrieves the open interest of a contract trading pair

Kind: instance method of hyperliquid
Returns: object - an open interest structure

ParamTypeRequiredDescription
symbolstringYesunified CCXT market symbol
paramsobjectNoexchange specific parameters
hyperliquid.fetchOpenInterest (symbol, params?)

fetchFundingHistory

fetch the history of funding payments paid and received on this account

Kind: instance method of hyperliquid
Returns: object - a funding history structure

ParamTypeRequiredDescription
symbolstringNounified market symbol
sinceintNothe earliest time in ms to fetch funding history for
limitintNothe maximum number of funding history structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.subAccountAddressstringNosub account user address
hyperliquid.fetchFundingHistory (symbol?, since?, limit?, params?)

reserveRequestWeight

Instead of trading to increase the address based rate limits, this action allows reserving additional actions for 0.0005 USDC per request. The cost is paid from the Perps balance.

Kind: instance method of hyperliquid
Returns: object - a response object

ParamTypeRequiredDescription
weightnumberYesthe weight to reserve, 1 weight = 1 action, 0.0005 USDC per action
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.reserveRequestWeight (weight, params?)

createAccount

creates a sub-account under the main account

Kind: instance method of hyperliquid
Returns: object - a response object

ParamTypeRequiredDescription
namestringYesthe name of the sub-account
paramsobjectNoextra parameters specific to the exchange API endpoint
params.expiresAfterintNotime in ms after which the sub-account will expire
hyperliquid.createAccount (name, params?)

createOrdersWs

create a list of trade orders using WebSocket post request

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
ordersArrayYeslist of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.createOrdersWs (orders, params?)

createOrderWs

create a trade order using WebSocket post request

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
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNo'Gtc', 'Ioc', 'Alo'
params.postOnlyboolNotrue or false whether the order is post-only
params.reduceOnlyboolNotrue or false whether the order is reduce-only
params.triggerPricefloatNoThe price at which a trigger order is triggered at
params.clientOrderIdstringNoclient order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
params.slippagestringNothe slippage for market order
params.vaultAddressstringNothe vault address for order
hyperliquid.createOrderWs (symbol, type, side, amount, price?, params?)

editOrderWs

edit a trade order

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders

ParamTypeRequiredDescription
idstringYescancel order id
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNo'Gtc', 'Ioc', 'Alo'
params.postOnlyboolNotrue or false whether the order is post-only
params.reduceOnlyboolNotrue or false whether the order is reduce-only
params.triggerPricefloatNoThe price at which a trigger order is triggered at
params.clientOrderIdstringNoclient order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
params.vaultAddressstringNothe vault address for order
hyperliquid.editOrderWs (id, symbol, type, side, amount, price?, params?)

cancelOrdersWs

cancel multiple orders using WebSocket post request

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests

ParamTypeRequiredDescription
idsArray<string>Yeslist of order ids to cancel
symbolstringYesunified symbol of the market the orders were made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdArray<string>Nolist of client order ids to cancel instead of order ids
params.vaultAddressstringNothe vault address for order cancellation
hyperliquid.cancelOrdersWs (ids, symbol, params?)

cancelOrderWs

cancel a single order using WebSocket post request

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests

ParamTypeRequiredDescription
idstringYesorder id to cancel
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdstringNoclient order id to cancel instead of order id
params.vaultAddressstringNothe vault address for order cancellation
hyperliquid.cancelOrderWs (id, symbol, params?)

watchOrderBook

watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of hyperliquid
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the order book for
limitintNothe maximum amount of order book entries to return
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.watchOrderBook (symbol, limit?, params?)

unWatchOrderBook

unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of hyperliquid
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the order book for
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.unWatchOrderBook (symbol, params?)

watchTicker

watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
params.channelstringNo'webData2' or 'allMids', default is 'webData2'
hyperliquid.watchTicker (symbol, params?)

watchTickers

watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
params.channelstringNo'webData2' or 'allMids', default is 'webData2'
params.dexstringNofor for hip3 tokens subscription, eg: 'xyz' or 'flx`, if symbols are provided we will infer it from the first symbol's market
hyperliquid.watchTickers (symbols, params?)

unWatchTickers

unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
params.channelstringNo'webData2' or 'allMids', default is 'webData2'
hyperliquid.unWatchTickers (symbols, params?)

watchMyTrades

watches information on multiple trades made by 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/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
hyperliquid.watchMyTrades (symbol, since?, limit?, params?)

unWatchMyTrades

unWatches information on multiple trades made by 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/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
hyperliquid.unWatchMyTrades (symbol, params?)

watchTrades

watches information on multiple trades made in a market

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market trades were made in
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trade structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.watchTrades (symbol, since?, limit?, params?)

unWatchTrades

unWatches information on multiple trades made in a market

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market trades were made in
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.unWatchTrades (symbol, params?)

watchOHLCV

watches historical candlestick data containing the open, high, low, close price, and the volume of a 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/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum amount of candles to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.watchOHLCV (symbol, timeframe, since?, limit?, params?)

unWatchOHLCV

watches historical candlestick data containing the open, high, low, close price, and the volume of a 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/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.unWatchOHLCV (symbol, timeframe, params?)

watchBalance

watch balance and get the amount of funds available for trading or funds locked in orders

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.dexstringNofor for hip3 tokens subscription, eg: 'xyz' or 'flx'
hyperliquid.watchBalance (params?)

unWatchBalance

unWatches balance

Kind: instance method of hyperliquid
Returns: object - status of the unwatch request

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.unWatchBalance (params?)

watchPositions

watch all open positions

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

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
sinceintNothe earliest time in ms to fetch positions for
limitintNothe maximum number of positions to retrieve
paramsobjectYesextra parameters specific to the exchange API endpoint
hyperliquid.watchPositions (symbols?, since?, limit?, params)

unWatchPositions

unWatches all open positions

Kind: instance method of hyperliquid
Returns: object - status of the unwatch request

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
hyperliquid.unWatchPositions (symbols?, params?)

watchOrders

watches information on multiple orders made by 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/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
hyperliquid.watchOrders (symbol, since?, limit?, params?)

unWatchOrders

unWatches information on multiple orders made by 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/websocket/subscriptions

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.userstringNouser address, will default to this.walletAddress if not provided
hyperliquid.unWatchOrders (symbol, params?)

On this page