wiki/exchanges/hyperliquid.md
<a name="hyperliquid" id="hyperliquid"></a>
Kind: global class
Extends: <code>Exchange</code>
<a name="fetchStatus" id="fetchstatus"></a>
the latest known information on the availability of the exchange API
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a status structure
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchStatus ([params])
<a name="fetchTime" id="fetchtime"></a>
fetches the current integer timestamp in milliseconds from the exchange server
Kind: instance method of <code>hyperliquid</code>
Returns: <code>int</code> - the current integer timestamp in milliseconds from the exchange server
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchTime ([params])
<a name="fetchCurrencies" id="fetchcurrencies"></a>
fetches all available currencies on an exchange
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an associative dictionary of currencies
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchCurrencies ([params])
<a name="fetchMarkets" id="fetchmarkets"></a>
retrieves data on all markets for hyperliquid
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - an array of objects representing market data
See
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchMarkets ([params])
<a name="fetchHip3Markets" id="fetchhip3markets"></a>
retrieves data on all hip3 markets for hyperliquid
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - an array of objects representing market data
See
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchHip3Markets ([params])
<a name="fetchSwapMarkets" id="fetchswapmarkets"></a>
retrieves data on all swap markets for hyperliquid
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - an array of objects representing market data
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchSwapMarkets ([params])
<a name="calculatePricePrecision" id="calculatepriceprecision"></a>
Helper function to calculate the Hyperliquid DECIMAL_PLACES price precision
Kind: instance method of <code>hyperliquid</code>
Returns: <code>int</code> - The calculated price precision
| Param | Type | Description |
|---|---|---|
| price | <code>float</code> | the price to use in the calculation |
| amountPrecision | <code>int</code> | the amountPrecision to use in the calculation |
| maxDecimals | <code>int</code> | the maxDecimals to use in the calculation |
hyperliquid.calculatePricePrecision (price, amountPrecision, maxDecimals[])
<a name="fetchSpotMarkets" id="fetchspotmarkets"></a>
retrieves data on all spot markets for hyperliquid
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - an array of objects representing market data
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchSpotMarkets ([params])
<a name="fetchBalance" id="fetchbalance"></a>
query for balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a balance structure
See
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
| params.type | <code>string</code> | No | wallet type, ['spot', 'swap'], defaults to swap |
| params.marginMode | <code>string</code> | No | 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null |
| params.dex | <code>string</code> | No | for hip3 markets, the dex name, eg: 'xyz' |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
| params.enableUnifiedMargin | <code>boolean</code> | No | enable unified margin, CCXT tries to auto-detects this value but you can override it |
hyperliquid.fetchBalance ([params])
<a name="fetchOrderBook" id="fetchorderbook"></a>
fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the order book for |
| limit | <code>int</code> | No | the maximum amount of order book entries to return |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchOrderBook (symbol[, limit, params])
<a name="fetchTickers" id="fetchtickers"></a>
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a dictionary of ticker structures
See
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.type | <code>string</code> | No | 'spot' or 'swap', by default fetches both |
| params.hip3 | <code>boolean</code> | No | set to true to fetch hip3 markets only |
hyperliquid.fetchTickers ([symbols, params])
<a name="fetchFundingRates" id="fetchfundingrates"></a>
retrieves data on all swap markets for hyperliquid
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - an array of objects representing market data
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | No | list of unified market symbols |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.fetchFundingRates ([symbols, params])
<a name="fetchOHLCV" id="fetchohlcv"></a>
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Array<int>></code> - 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 |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch OHLCV data for |
| timeframe | <code>string</code> | Yes | the length of time each candle represents, support '1m', '15m', '1h', '1d' |
| since | <code>int</code> | No | timestamp in ms of the earliest candle to fetch |
| limit | <code>int</code> | No | the maximum amount of candles to fetch |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.until | <code>int</code> | No | timestamp in ms of the latest candle to fetch |
hyperliquid.fetchOHLCV (symbol, timeframe[, since, limit, params])
<a name="fetchTrades" id="fetchtrades"></a>
get the list of most recent trades for a particular symbol
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Trade></code> - a list of trade structures
See
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch trades for |
| limit | <code>int</code> | No | the maximum number of trades structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.until | <code>int</code> | No | timestamp in ms of the latest trade |
| params.address | <code>string</code> | No | wallet address that made trades |
| params.user | <code>string</code> | No | wallet address that made trades |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.fetchTrades (symbol[, since, limit, params])
<a name="isUnifiedEnabled" id="isunifiedenabled"></a>
returns enableUnifiedMargin so the user can check if unified account is enabled
Kind: instance method of <code>hyperliquid</code>
Returns: <code>bool</code> - enableUnifiedMargin
| Param | Type | Required | Description |
|---|---|---|---|
| method | <code>string</code> | Yes | the 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) |
| address | Yes | ||
| shouldRefresh | Yes | ||
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.isUnifiedEnabled (method, address, shouldRefresh[, params])
<a name="setUserAbstraction" id="setuserabstraction"></a>
set user abstraction mode
Kind: instance method of <code>hyperliquid</code>
Returns: dictionary response from the exchange
| Param | Type | Required | Description |
|---|---|---|---|
| abstraction | <code>string</code> | Yes | one of the strings ["disabled", "unifiedAccount", "portfolioMargin"], |
| params | <code>object</code> | No | |
| params.type | <code>string</code> | No | 'userSetAbstraction' or 'agentSetAbstraction' default is 'userSetAbstraction' |
hyperliquid.setUserAbstraction (abstraction[, params])
<a name="enableUserDexAbstraction" id="enableuserdexabstraction"></a>
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 <code>hyperliquid</code>
Returns: dictionary response from the exchange
| Param | Type | Required | Description |
|---|---|---|---|
| enabled | Yes | ||
| params | Yes | ||
| params.type | <code>string</code> | No | 'userDexAbstraction' or 'agentEnableDexAbstraction' default is 'userDexAbstraction' |
hyperliquid.enableUserDexAbstraction (enabled, params[])
<a name="setAgentAbstraction" id="setagentabstraction"></a>
set agent abstraction mode
Kind: instance method of <code>hyperliquid</code>
Returns: dictionary response from the exchange
| Param | Type | Required | Description |
|---|---|---|---|
| abstraction | <code>string</code> | Yes | one of the strings ["i", "u", "p"] where "i" is "disabled", "u" is "unifiedAccount", and "p" is "portfolioMargin" |
| params | <code>object</code> | No |
hyperliquid.setAgentAbstraction (abstraction[, params])
<a name="createOrder" id="createorder"></a>
create a trade order
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to create an order in |
| type | <code>string</code> | Yes | 'market' or 'limit' |
| side | <code>string</code> | Yes | 'buy' or 'sell' |
| amount | <code>float</code> | Yes | how much of currency you want to trade in units of base currency |
| price | <code>float</code> | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.timeInForce | <code>string</code> | No | 'Gtc', 'Ioc', 'Alo' |
| params.postOnly | <code>bool</code> | No | true or false whether the order is post-only |
| params.reduceOnly | <code>bool</code> | No | true or false whether the order is reduce-only |
| params.triggerPrice | <code>float</code> | No | The price at which a trigger order is triggered at |
| params.clientOrderId | <code>string</code> | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) |
| params.slippage | <code>string</code> | No | the slippage for market order |
| params.vaultAddress | <code>string</code> | No | the vault address for order |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.createOrder (symbol, type, side, amount[, price, params])
<a name="createTwapOrder" id="createtwaporder"></a>
create a trade order that is executed as a TWAP order over a specified duration.
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to create an order in |
| side | <code>string</code> | Yes | 'buy' or 'sell' |
| amount | <code>float</code> | Yes | how much of currency you want to trade in units of base currency |
| duration | <code>int</code> | Yes | the duration of the TWAP order in milliseconds |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.randomize | <code>bool</code> | No | whether to randomize the time intervals of the TWAP order slices (default is false, meaning equal intervals) |
| params.reduceOnly | <code>bool</code> | No | true or false whether the order is reduce-only |
| params.expiresAfter | <code>int</code> | No | time in ms after which the twap order expires |
| params.vaultAddress | <code>string</code> | No | the vault address for order |
hyperliquid.createTwapOrder (symbol, side, amount, duration[, params])
<a name="createOrders" id="createorders"></a>
create a list of trade orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
| Param | Type | Required | Description |
|---|---|---|---|
| orders | <code>Array</code> | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.createOrders (orders[, params])
<a name="createOrdersRequest" id="createordersrequest"></a>
create a list of trade orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
| Param | Type | Description |
|---|---|---|
| orders | <code>Array</code> | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params |
hyperliquid.createOrdersRequest (orders, [undefined])
<a name="cancelOrder" id="cancelorder"></a>
cancels an open order
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - An order structure
See
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | order id |
| symbol | <code>string</code> | Yes | unified symbol of the market the order was made in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderId | <code>string</code> | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) |
| params.vaultAddress | <code>string</code> | No | the vault address for order |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
| params.twap | <code>boolean</code> | No | whether the order to cancel is a twap order, (default is false) |
hyperliquid.cancelOrder (id, symbol[, params])
<a name="cancelOrders" id="cancelorders"></a>
cancel multiple orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an list of order structures
See
| Param | Type | Required | Description |
|---|---|---|---|
| ids | <code>Array<string></code> | Yes | order ids |
| symbol | <code>string</code> | No | unified market symbol |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderId | <code>string</code>, <code>Array<string></code> | No | client order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) |
| params.vaultAddress | <code>string</code> | No | the vault address |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.cancelOrders (ids[, symbol, params])
<a name="cancelTwapOrder" id="canceltwaporder"></a>
cancels a running twap order
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - An order structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | order id |
| symbol | <code>string</code> | Yes | unified symbol of the market the order was made in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.expiresAfter | <code>int</code> | No | time in ms after which the twap order expires |
| params.vaultAddress | <code>string</code> | No | the vault address for order |
hyperliquid.cancelTwapOrder (id, symbol[, params])
<a name="cancelOrdersRequest" id="cancelordersrequest"></a>
build the request payload for cancelling multiple orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - the raw request object to be sent to the exchange
See
| Param | Type | Required | Description |
|---|---|---|---|
| ids | <code>Array<string></code> | Yes | order ids |
| symbol | <code>string</code> | Yes | unified market symbol |
| params | <code>object</code> | No |
hyperliquid.cancelOrdersRequest (ids, symbol[, params])
<a name="cancelOrdersForSymbols" id="cancelordersforsymbols"></a>
cancel multiple orders for multiple symbols
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an list of order structures
See
| Param | Type | Required | Description |
|---|---|---|---|
| orders | <code>Array<CancellationRequest></code> | Yes | each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}] |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.vaultAddress | <code>string</code> | No | the vault address |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.cancelOrdersForSymbols (orders[, params])
<a name="cancelAllOrdersAfter" id="cancelallordersafter"></a>
dead man's switch, cancel all orders after the given timeout
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - the api result
| Param | Type | Required | Description |
|---|---|---|---|
| timeout | <code>number</code> | Yes | time in milliseconds, 0 represents cancel the timer |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.vaultAddress | <code>string</code> | No | the vault address |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.cancelAllOrdersAfter (timeout[, params])
<a name="editOrder" id="editorder"></a>
edit a trade order
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | cancel order id |
| symbol | <code>string</code> | Yes | unified symbol of the market to create an order in |
| type | <code>string</code> | Yes | 'market' or 'limit' |
| side | <code>string</code> | Yes | 'buy' or 'sell' |
| amount | <code>float</code> | Yes | how much of currency you want to trade in units of base currency |
| price | <code>float</code> | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.timeInForce | <code>string</code> | No | 'Gtc', 'Ioc', 'Alo' |
| params.postOnly | <code>bool</code> | No | true or false whether the order is post-only |
| params.reduceOnly | <code>bool</code> | No | true or false whether the order is reduce-only |
| params.triggerPrice | <code>float</code> | No | The price at which a trigger order is triggered at |
| params.clientOrderId | <code>string</code> | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) |
| params.vaultAddress | <code>string</code> | No | the vault address for order |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.editOrder (id, symbol, type, side, amount[, price, params])
<a name="editOrders" id="editorders"></a>
edit a list of trade orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
| Param | Type | Required | Description |
|---|---|---|---|
| orders | <code>Array</code> | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.editOrders (orders[, params])
<a name="createVault" id="createvault"></a>
creates a value
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - the api result
| Param | Type | Required | Description |
|---|---|---|---|
| name | <code>string</code> | Yes | The name of the vault |
| description | <code>string</code> | Yes | The description of the vault |
| initialUsd | <code>number</code> | Yes | The initialUsd of the vault |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.createVault (name, description, initialUsd[, params])
<a name="fetchFundingRateHistory" id="fetchfundingratehistory"></a>
fetches historical funding rate prices
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of funding rate structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the funding rate history for |
| since | <code>int</code> | No | timestamp in ms of the earliest funding rate to fetch |
| limit | <code>int</code> | No | the maximum amount of funding rate structures to fetch |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.until | <code>int</code> | No | timestamp in ms of the latest funding rate |
hyperliquid.fetchFundingRateHistory (symbol[, since, limit, params])
<a name="fetchOpenOrders" id="fetchopenorders"></a>
fetch all unfilled currently open orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Order></code> - a list of order structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch open orders for |
| limit | <code>int</code> | No | the maximum number of open orders structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
| params.method | <code>string</code> | No | 'openOrders' or 'frontendOpenOrders' default is 'frontendOpenOrders' |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
| params.dex | <code>string</code> | No | perp dex name. default is null |
hyperliquid.fetchOpenOrders (symbol[, since, limit, params])
<a name="fetchClosedOrders" id="fetchclosedorders"></a>
fetch all unfilled currently closed orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Order></code> - a list of order structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch open orders for |
| limit | <code>int</code> | No | the maximum number of open orders structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
hyperliquid.fetchClosedOrders (symbol[, since, limit, params])
<a name="fetchCanceledOrders" id="fetchcanceledorders"></a>
fetch all canceled orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Order></code> - a list of order structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch open orders for |
| limit | <code>int</code> | No | the maximum number of open orders structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
hyperliquid.fetchCanceledOrders (symbol[, since, limit, params])
<a name="fetchCanceledAndClosedOrders" id="fetchcanceledandclosedorders"></a>
fetch all closed and canceled orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Order></code> - a list of order structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch open orders for |
| limit | <code>int</code> | No | the maximum number of open orders structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
hyperliquid.fetchCanceledAndClosedOrders (symbol[, since, limit, params])
<a name="fetchOrders" id="fetchorders"></a>
fetch all orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Order></code> - a list of order structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch open orders for |
| limit | <code>int</code> | No | the maximum number of open orders structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
| params.dex | <code>string</code> | No | perp dex name. default is null |
hyperliquid.fetchOrders (symbol[, since, limit, params])
<a name="fetchOrder" id="fetchorder"></a>
fetches information on an order made by the user
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - An order structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | order id |
| symbol | <code>string</code> | Yes | unified symbol of the market the order was made in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderId | <code>string</code> | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.fetchOrder (id, symbol[, params])
<a name="fetchMyTrades" id="fetchmytrades"></a>
fetch all trades made by the user
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Trade></code> - a list of trade structures
See
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch trades for |
| limit | <code>int</code> | No | the maximum number of trades structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.until | <code>int</code> | No | timestamp in ms of the latest trade |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.fetchMyTrades (symbol[, since, limit, params])
<a name="fetchPosition" id="fetchposition"></a>
fetch data on an open position
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a position structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol of the market the position is held in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
hyperliquid.fetchPosition (symbol[, params])
<a name="fetchPositions" id="fetchpositions"></a>
fetch all open positions
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of position structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | No | list of unified market symbols |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
| params.dex | <code>string</code> | No | perp dex name, eg: XYZ |
hyperliquid.fetchPositions ([symbols, params])
<a name="setMarginMode" id="setmarginmode"></a>
set margin mode (symbol)
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - response from the exchange
| Param | Type | Required | Description |
|---|---|---|---|
| marginMode | <code>string</code> | Yes | margin mode must be either [isolated, cross] |
| symbol | <code>string</code> | Yes | unified market symbol of the market the position is held in, default is undefined |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.leverage | <code>string</code> | No | the rate of leverage, is required if setting trade mode (symbol) |
| params.vaultAddress | <code>string</code> | No | the vault address |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.setMarginMode (marginMode, symbol[, params])
<a name="setLeverage" id="setleverage"></a>
set the level of leverage for a market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - response from the exchange
| Param | Type | Required | Description |
|---|---|---|---|
| leverage | <code>float</code> | Yes | the rate of leverage |
| symbol | <code>string</code> | Yes | unified market symbol |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.marginMode | <code>string</code> | No | margin mode must be either [isolated, cross], default is cross |
hyperliquid.setLeverage (leverage, symbol[, params])
<a name="addMargin" id="addmargin"></a>
add margin
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a margin structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| amount | <code>float</code> | Yes | amount of margin to add |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.vaultAddress | <code>string</code> | No | the vault address |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.addMargin (symbol, amount[, params])
<a name="reduceMargin" id="reducemargin"></a>
remove margin from a position
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a margin structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| amount | <code>float</code> | Yes | the amount of margin to remove |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.vaultAddress | <code>string</code> | No | the vault address |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.reduceMargin (symbol, amount[, params])
<a name="transfer" id="transfer"></a>
transfer currency internally between wallets on the same account
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a transfer structure
| Param | Type | Required | Description |
|---|---|---|---|
| code | <code>string</code> | Yes | unified currency code |
| amount | <code>float</code> | Yes | amount to transfer |
| fromAccount | <code>string</code> | Yes | account to transfer from spot, swap |
| toAccount | <code>string</code> | Yes | account to transfer to swap, spot or address |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.vaultAddress | <code>string</code> | No | the vault address for order |
hyperliquid.transfer (code, amount, fromAccount, toAccount[, params])
<a name="withdraw" id="withdraw"></a>
make a withdrawal (only support USDC)
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a transaction structure
See
| Param | Type | Required | Description |
|---|---|---|---|
| code | <code>string</code> | Yes | unified currency code |
| amount | <code>float</code> | Yes | the amount to withdraw |
| address | <code>string</code> | Yes | the address to withdraw to |
| tag | <code>string</code> | Yes | |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.vaultAddress | <code>string</code> | No | vault address withdraw from |
hyperliquid.withdraw (code, amount, address, tag[, params])
<a name="fetchTradingFee" id="fetchtradingfee"></a>
fetch the trading fees for a market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a fee structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.fetchTradingFee (symbol[, params])
<a name="fetchLedger" id="fetchledger"></a>
fetch the history of changes, actions done by the user or operations that altered the balance of the user
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a ledger structure
| Param | Type | Required | Description |
|---|---|---|---|
| code | <code>string</code> | No | unified currency code |
| since | <code>int</code> | No | timestamp in ms of the earliest ledger entry |
| limit | <code>int</code> | No | max number of ledger entries to return |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.until | <code>int</code> | No | timestamp in ms of the latest ledger entry |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.fetchLedger ([code, since, limit, params])
<a name="fetchDeposits" id="fetchdeposits"></a>
fetch all deposits made to an account
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of transaction structures
| Param | Type | Required | Description |
|---|---|---|---|
| code | <code>string</code> | Yes | unified currency code |
| since | <code>int</code> | No | the earliest time in ms to fetch deposits for |
| limit | <code>int</code> | No | the maximum number of deposits structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.until | <code>int</code> | No | the latest time in ms to fetch withdrawals for |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
| params.vaultAddress | <code>string</code> | No | vault address |
hyperliquid.fetchDeposits (code[, since, limit, params])
<a name="fetchWithdrawals" id="fetchwithdrawals"></a>
fetch all withdrawals made from an account
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of transaction structures
| Param | Type | Required | Description |
|---|---|---|---|
| code | <code>string</code> | Yes | unified currency code |
| since | <code>int</code> | No | the earliest time in ms to fetch withdrawals for |
| limit | <code>int</code> | No | the maximum number of withdrawals structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.until | <code>int</code> | No | the latest time in ms to fetch withdrawals for |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
| params.vaultAddress | <code>string</code> | No | vault address |
hyperliquid.fetchWithdrawals (code[, since, limit, params])
<a name="fetchOpenInterests" id="fetchopeninterests"></a>
Retrieves the open interest for a list of symbols
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an open interest structurehttps://docs.ccxt.com/?id=open-interest-structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | No | Unified CCXT market symbol |
| params | <code>object</code> | No | exchange specific parameters |
hyperliquid.fetchOpenInterests ([symbols, params])
<a name="fetchOpenInterest" id="fetchopeninterest"></a>
retrieves the open interest of a contract trading pair
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an open interest structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified CCXT market symbol |
| params | <code>object</code> | No | exchange specific parameters |
hyperliquid.fetchOpenInterest (symbol[, params])
<a name="fetchFundingHistory" id="fetchfundinghistory"></a>
fetch the history of funding payments paid and received on this account
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a funding history structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | No | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch funding history for |
| limit | <code>int</code> | No | the maximum number of funding history structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.subAccountAddress | <code>string</code> | No | sub account user address |
hyperliquid.fetchFundingHistory ([symbol, since, limit, params])
<a name="reserveRequestWeight" id="reserverequestweight"></a>
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 <code>hyperliquid</code>
Returns: <code>object</code> - a response object
| Param | Type | Required | Description |
|---|---|---|---|
| weight | <code>number</code> | Yes | the weight to reserve, 1 weight = 1 action, 0.0005 USDC per action |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.reserveRequestWeight (weight[, params])
<a name="createAccount" id="createaccount"></a>
creates a sub-account under the main account
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a response object
| Param | Type | Required | Description |
|---|---|---|---|
| name | <code>string</code> | Yes | the name of the sub-account |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.expiresAfter | <code>int</code> | No | time in ms after which the sub-account will expire |
hyperliquid.createAccount (name[, params])
<a name="createOrdersWs" id="createordersws"></a>
create a list of trade orders using WebSocket post request
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
| Param | Type | Required | Description |
|---|---|---|---|
| orders | <code>Array</code> | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.createOrdersWs (orders[, params])
<a name="createOrderWs" id="createorderws"></a>
create a trade order using WebSocket post request
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to create an order in |
| type | <code>string</code> | Yes | 'market' or 'limit' |
| side | <code>string</code> | Yes | 'buy' or 'sell' |
| amount | <code>float</code> | Yes | how much of currency you want to trade in units of base currency |
| price | <code>float</code> | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.timeInForce | <code>string</code> | No | 'Gtc', 'Ioc', 'Alo' |
| params.postOnly | <code>bool</code> | No | true or false whether the order is post-only |
| params.reduceOnly | <code>bool</code> | No | true or false whether the order is reduce-only |
| params.triggerPrice | <code>float</code> | No | The price at which a trigger order is triggered at |
| params.clientOrderId | <code>string</code> | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) |
| params.slippage | <code>string</code> | No | the slippage for market order |
| params.vaultAddress | <code>string</code> | No | the vault address for order |
hyperliquid.createOrderWs (symbol, type, side, amount[, price, params])
<a name="editOrderWs" id="editorderws"></a>
edit a trade order
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | cancel order id |
| symbol | <code>string</code> | Yes | unified symbol of the market to create an order in |
| type | <code>string</code> | Yes | 'market' or 'limit' |
| side | <code>string</code> | Yes | 'buy' or 'sell' |
| amount | <code>float</code> | Yes | how much of currency you want to trade in units of base currency |
| price | <code>float</code> | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.timeInForce | <code>string</code> | No | 'Gtc', 'Ioc', 'Alo' |
| params.postOnly | <code>bool</code> | No | true or false whether the order is post-only |
| params.reduceOnly | <code>bool</code> | No | true or false whether the order is reduce-only |
| params.triggerPrice | <code>float</code> | No | The price at which a trigger order is triggered at |
| params.clientOrderId | <code>string</code> | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) |
| params.vaultAddress | <code>string</code> | No | the vault address for order |
hyperliquid.editOrderWs (id, symbol, type, side, amount[, price, params])
<a name="cancelOrdersWs" id="cancelordersws"></a>
cancel multiple orders using WebSocket post request
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of order structures
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests
| Param | Type | Required | Description |
|---|---|---|---|
| ids | <code>Array<string></code> | Yes | list of order ids to cancel |
| symbol | <code>string</code> | Yes | unified symbol of the market the orders were made in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderId | <code>Array<string></code> | No | list of client order ids to cancel instead of order ids |
| params.vaultAddress | <code>string</code> | No | the vault address for order cancellation |
hyperliquid.cancelOrdersWs (ids, symbol[, params])
<a name="cancelOrderWs" id="cancelorderws"></a>
cancel a single order using WebSocket post request
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - an order structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | order id to cancel |
| symbol | <code>string</code> | Yes | unified symbol of the market the order was made in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderId | <code>string</code> | No | client order id to cancel instead of order id |
| params.vaultAddress | <code>string</code> | No | the vault address for order cancellation |
hyperliquid.cancelOrderWs (id, symbol[, params])
<a name="watchOrderBook" id="watchorderbook"></a>
watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - A dictionary of order book structures indexed by market symbols
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the order book for |
| limit | <code>int</code> | No | the maximum amount of order book entries to return |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.watchOrderBook (symbol[, limit, params])
<a name="unWatchOrderBook" id="unwatchorderbook"></a>
unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - A dictionary of order book structures indexed by market symbols
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the order book for |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.unWatchOrderBook (symbol[, params])
<a name="watchTicker" id="watchticker"></a>
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a ticker structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the ticker for |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.channel | <code>string</code> | No | 'webData2' or 'allMids', default is 'webData2' |
hyperliquid.watchTicker (symbol[, params])
<a name="watchTickers" id="watchtickers"></a>
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 <code>hyperliquid</code>
Returns: <code>object</code> - a ticker structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | Yes | unified symbol of the market to fetch the ticker for |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.channel | <code>string</code> | No | 'webData2' or 'allMids', default is 'webData2' |
| params.dex | <code>string</code> | No | for 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])
<a name="unWatchTickers" id="unwatchtickers"></a>
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 <code>hyperliquid</code>
Returns: <code>object</code> - a ticker structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | Yes | unified symbol of the market to fetch the ticker for |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.channel | <code>string</code> | No | 'webData2' or 'allMids', default is 'webData2' |
hyperliquid.unWatchTickers (symbols[, params])
<a name="watchMyTrades" id="watchmytrades"></a>
watches information on multiple trades made by the user
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of order structures
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol of the market orders were made in |
| since | <code>int</code> | No | the earliest time in ms to fetch orders for |
| limit | <code>int</code> | No | the maximum number of order structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
hyperliquid.watchMyTrades (symbol[, since, limit, params])
<a name="unWatchMyTrades" id="unwatchmytrades"></a>
unWatches information on multiple trades made by the user
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of order structures
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol of the market orders were made in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
hyperliquid.unWatchMyTrades (symbol[, params])
<a name="watchTrades" id="watchtrades"></a>
watches information on multiple trades made in a market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of trade structures
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol of the market trades were made in |
| since | <code>int</code> | No | the earliest time in ms to fetch trades for |
| limit | <code>int</code> | No | the maximum number of trade structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.watchTrades (symbol[, since, limit, params])
<a name="unWatchTrades" id="unwatchtrades"></a>
unWatches information on multiple trades made in a market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of trade structures
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol of the market trades were made in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.unWatchTrades (symbol[, params])
<a name="watchOHLCV" id="watchohlcv"></a>
watches historical candlestick data containing the open, high, low, close price, and the volume of a market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Array<int>></code> - A list of candles ordered as timestamp, open, high, low, close, volume
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch OHLCV data for |
| timeframe | <code>string</code> | Yes | the length of time each candle represents |
| since | <code>int</code> | No | timestamp in ms of the earliest candle to fetch |
| limit | <code>int</code> | No | the maximum amount of candles to fetch |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.watchOHLCV (symbol, timeframe[, since, limit, params])
<a name="unWatchOHLCV" id="unwatchohlcv"></a>
watches historical candlestick data containing the open, high, low, close price, and the volume of a market
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<Array<int>></code> - A list of candles ordered as timestamp, open, high, low, close, volume
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch OHLCV data for |
| timeframe | <code>string</code> | Yes | the length of time each candle represents |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.unWatchOHLCV (symbol, timeframe[, params])
<a name="watchBalance" id="watchbalance"></a>
watch balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - a balance structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.dex | <code>string</code> | No | for for hip3 tokens subscription, eg: 'xyz' or 'flx' |
hyperliquid.watchBalance ([params])
<a name="unWatchBalance" id="unwatchbalance"></a>
unWatches balance
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - status of the unwatch request
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.unWatchBalance ([params])
<a name="watchPositions" id="watchpositions"></a>
watch all open positions
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of position structure
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | No | list of unified market symbols |
| since | <code>int</code> | No | the earliest time in ms to fetch positions for |
| limit | <code>int</code> | No | the maximum number of positions to retrieve |
| params | <code>object</code> | Yes | extra parameters specific to the exchange API endpoint |
hyperliquid.watchPositions ([symbols, since, limit, params])
<a name="unWatchPositions" id="unwatchpositions"></a>
unWatches all open positions
Kind: instance method of <code>hyperliquid</code>
Returns: <code>object</code> - status of the unwatch request
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | No | list of unified market symbols |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
hyperliquid.unWatchPositions ([symbols, params])
<a name="watchOrders" id="watchorders"></a>
watches information on multiple orders made by the user
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of order structures
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol of the market orders were made in |
| since | <code>int</code> | No | the earliest time in ms to fetch orders for |
| limit | <code>int</code> | No | the maximum number of order structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
hyperliquid.watchOrders (symbol[, since, limit, params])
<a name="unWatchOrders" id="unwatchorders"></a>
unWatches information on multiple orders made by the user
Kind: instance method of <code>hyperliquid</code>
Returns: <code>Array<object></code> - a list of order structures
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol of the market orders were made in |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.user | <code>string</code> | No | user address, will default to this.walletAddress if not provided |
hyperliquid.unWatchOrders (symbol[, params])