## hyperliquid{docsify-ignore} **Kind**: global class **Extends**: Exchange * [fetchCurrencies](#fetchcurrencies) * [fetchMarkets](#fetchmarkets) * [fetchMarkets](#fetchmarkets) * [fetchMarkets](#fetchmarkets) * [fetchBalance](#fetchbalance) * [fetchOrderBook](#fetchorderbook) * [fetchTickers](#fetchtickers) * [fetchOHLCV](#fetchohlcv) * [fetchTrades](#fetchtrades) * [createOrder](#createorder) * [createOrders](#createorders) * [createOrders](#createorders) * [cancelOrder](#cancelorder) * [cancelOrders](#cancelorders) * [cancelOrdersForSymbols](#cancelordersforsymbols) * [cancelAllOrdersAfter](#cancelallordersafter) * [editOrder](#editorder) * [fetchFundingRateHistory](#fetchfundingratehistory) * [fetchOpenOrders](#fetchopenorders) * [fetchClosedOrders](#fetchclosedorders) * [fetchCanceledOrders](#fetchcanceledorders) * [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) * [fetchOrders](#fetchorders) * [fetchOrder](#fetchorder) * [fetchMyTrades](#fetchmytrades) * [fetchPosition](#fetchposition) * [fetchPositions](#fetchpositions) * [setMarginMode](#setmarginmode) * [setLeverage](#setleverage) * [addMargin](#addmargin) * [reduceMargin](#reducemargin) * [transfer](#transfer) * [withdraw](#withdraw) * [fetchTradingFee](#fetchtradingfee) * [fetchLedger](#fetchledger) * [fetchDeposits](#fetchdeposits) * [fetchWithdrawals](#fetchwithdrawals) * [createOrdersWs](#createordersws) * [createOrder](#createorder) * [editOrder](#editorder) * [watchOrderBook](#watchorderbook) * [watchTickers](#watchtickers) * [watchMyTrades](#watchmytrades) * [watchTrades](#watchtrades) * [watchOHLCV](#watchohlcv) * [watchOrders](#watchorders) ### fetchCurrencies{docsify-ignore} fetches all available currencies on an exchange **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an associative dictionary of currencies **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-exchange-metadata | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.fetchCurrencies ([params]) ``` ### fetchMarkets{docsify-ignore} retrieves data on all markets for hyperliquid **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - an array of objects representing market data **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-asset-contexts-includes-mark-price-current-funding-open-interest-etc | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.fetchMarkets ([params]) ``` ### fetchMarkets{docsify-ignore} retrieves data on all swap markets for hyperliquid **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - an array of objects representing market data **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-asset-contexts-includes-mark-price-current-funding-open-interest-etc | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.fetchMarkets ([params]) ``` ### fetchMarkets{docsify-ignore} retrieves data on all spot markets for hyperliquid **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - an array of objects representing market data **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-asset-contexts-includes-mark-price-current-funding-open-interest-etc | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.fetchMarkets ([params]) ``` ### fetchBalance{docsify-ignore} query for balance and get the amount of funds available for trading or funds locked in orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-state | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | | params.type | string | No | wallet type, ['spot', 'swap'], defaults to swap | ```javascript hyperliquid.fetchBalance ([params]) ``` ### fetchOrderBook{docsify-ignore} fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#info | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified symbol of the market to fetch the order book for | | limit | int | No | the maximum amount of order book entries to return | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.fetchOrderBook (symbol[, limit, params]) ``` ### fetchTickers{docsify-ignore} fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) **See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices | Param | Type | Required | Description | | --- | --- | --- | --- | | symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.fetchTickers (symbols[, params]) ``` ### fetchOHLCV{docsify-ignore} fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market **Kind**: instance method of [hyperliquid](#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#info-1 | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | | timeframe | string | Yes | the length of time each candle represents, support '1m', '15m', '1h', '1d' | | since | int | No | timestamp in ms of the earliest candle to fetch | | limit | int | No | the maximum amount of candles to fetch | | params | object | No | extra parameters specific to the exchange API endpoint | | params.until | int | No | timestamp in ms of the latest candle to fetch | ```javascript hyperliquid.fetchOHLCV (symbol, timeframe[, since, limit, params]) ``` ### fetchTrades{docsify-ignore} get the list of most recent trades for a particular symbol **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) **See** - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | since | int | No | the earliest time in ms to fetch trades for | | limit | int | No | the maximum number of trades structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.until | int | No | timestamp in ms of the latest trade | | params.address | string | No | wallet address that made trades | | params.user | string | No | wallet address that made trades | ```javascript hyperliquid.fetchTrades (symbol[, since, limit, params]) ``` ### createOrder{docsify-ignore} create a trade order **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified symbol of the market to create an order in | | type | string | Yes | 'market' or 'limit' | | side | string | Yes | 'buy' or 'sell' | | amount | float | Yes | how much of currency you want to trade in units of base currency | | price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | | params | object | No | extra parameters specific to the exchange API endpoint | | params.timeInForce | string | No | 'Gtc', 'Ioc', 'Alo' | | params.postOnly | bool | No | true or false whether the order is post-only | | params.reduceOnly | bool | No | true or false whether the order is reduce-only | | params.triggerPrice | float | No | The price at which a trigger order is triggered at | | params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | | params.slippage | string | No | the slippage for market order | | params.vaultAddress | string | No | the vault address for order | ```javascript hyperliquid.createOrder (symbol, type, side, amount[, price, params]) ``` ### createOrders{docsify-ignore} create a list of trade orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order | Param | Type | Description | | --- | --- | --- | | orders | Array | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | ```javascript hyperliquid.createOrders (orders, [undefined]) ``` ### createOrders{docsify-ignore} create a list of trade orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order | Param | Type | Description | | --- | --- | --- | | orders | Array | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | ```javascript hyperliquid.createOrders (orders, [undefined]) ``` ### cancelOrder{docsify-ignore} cancels an open order **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) **See** - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid | Param | Type | Required | Description | | --- | --- | --- | --- | | id | string | Yes | order id | | symbol | string | Yes | unified symbol of the market the order was made in | | params | object | No | extra parameters specific to the exchange API endpoint | | params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | | params.vaultAddress | string | No | the vault address for order | ```javascript hyperliquid.cancelOrder (id, symbol[, params]) ``` ### cancelOrders{docsify-ignore} cancel multiple orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) **See** - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid | Param | Type | Required | Description | | --- | --- | --- | --- | | ids | Array<string> | Yes | order ids | | symbol | string | No | unified market symbol | | params | object | No | extra parameters specific to the exchange API endpoint | | params.clientOrderId | string, Array<string> | No | client order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | | params.vaultAddress | string | No | the vault address | ```javascript hyperliquid.cancelOrders (ids[, symbol, params]) ``` ### cancelOrdersForSymbols{docsify-ignore} cancel multiple orders for multiple symbols **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) **See** - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid | Param | Type | Required | Description | | --- | --- | --- | --- | | orders | Array<CancellationRequest> | 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 | object | No | extra parameters specific to the exchange API endpoint | | params.vaultAddress | string | No | the vault address | ```javascript hyperliquid.cancelOrdersForSymbols (orders[, params]) ``` ### cancelAllOrdersAfter{docsify-ignore} dead man's switch, cancel all orders after the given timeout **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - the api result | Param | Type | Required | Description | | --- | --- | --- | --- | | timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | | params | object | No | extra parameters specific to the exchange API endpoint | | params.vaultAddress | string | No | the vault address | ```javascript hyperliquid.cancelAllOrdersAfter (timeout[, params]) ``` ### editOrder{docsify-ignore} edit a trade order **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) **See** - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders | Param | Type | Required | Description | | --- | --- | --- | --- | | id | string | Yes | cancel order id | | symbol | string | Yes | unified symbol of the market to create an order in | | type | string | Yes | 'market' or 'limit' | | side | string | Yes | 'buy' or 'sell' | | amount | float | Yes | how much of currency you want to trade in units of base currency | | price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | | params | object | No | extra parameters specific to the exchange API endpoint | | params.timeInForce | string | No | 'Gtc', 'Ioc', 'Alo' | | params.postOnly | bool | No | true or false whether the order is post-only | | params.reduceOnly | bool | No | true or false whether the order is reduce-only | | params.triggerPrice | float | No | The price at which a trigger order is triggered at | | params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | | params.vaultAddress | string | No | the vault address for order | ```javascript hyperliquid.editOrder (id, symbol, type, side, amount[, price, params]) ``` ### fetchFundingRateHistory{docsify-ignore} fetches historical funding rate prices **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-historical-funding-rates | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | | since | int | No | timestamp in ms of the earliest funding rate to fetch | | limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | | params | object | No | extra parameters specific to the exchange API endpoint | | params.until | int | No | timestamp in ms of the latest funding rate | ```javascript hyperliquid.fetchFundingRateHistory (symbol[, since, limit, params]) ``` ### fetchOpenOrders{docsify-ignore} fetch all unfilled currently open orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | since | int | No | the earliest time in ms to fetch open orders for | | limit | int | No | the maximum number of open orders structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | | params.method | string | No | 'openOrders' or 'frontendOpenOrders' default is 'frontendOpenOrders' | ```javascript hyperliquid.fetchOpenOrders (symbol[, since, limit, params]) ``` ### fetchClosedOrders{docsify-ignore} fetch all unfilled currently closed orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | since | int | No | the earliest time in ms to fetch open orders for | | limit | int | No | the maximum number of open orders structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.fetchClosedOrders (symbol[, since, limit, params]) ``` ### fetchCanceledOrders{docsify-ignore} fetch all canceled orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | since | int | No | the earliest time in ms to fetch open orders for | | limit | int | No | the maximum number of open orders structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.fetchCanceledOrders (symbol[, since, limit, params]) ``` ### fetchCanceledAndClosedOrders{docsify-ignore} fetch all closed and canceled orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | since | int | No | the earliest time in ms to fetch open orders for | | limit | int | No | the maximum number of open orders structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.fetchCanceledAndClosedOrders (symbol[, since, limit, params]) ``` ### fetchOrders{docsify-ignore} fetch all orders **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | since | int | No | the earliest time in ms to fetch open orders for | | limit | int | No | the maximum number of open orders structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.fetchOrders (symbol[, since, limit, params]) ``` ### fetchOrder{docsify-ignore} fetches information on an order made by the user **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified symbol of the market the order was made in | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.fetchOrder (symbol[, params]) ``` ### fetchMyTrades{docsify-ignore} fetch all trades made by the user **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) **See** - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | since | int | No | the earliest time in ms to fetch trades for | | limit | int | No | the maximum number of trades structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.until | int | No | timestamp in ms of the latest trade | ```javascript hyperliquid.fetchMyTrades (symbol[, since, limit, params]) ``` ### fetchPosition{docsify-ignore} fetch data on an open position **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-state | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol of the market the position is held in | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.fetchPosition (symbol[, params]) ``` ### fetchPositions{docsify-ignore} fetch all open positions **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-state | Param | Type | Required | Description | | --- | --- | --- | --- | | symbols | Array<string> | No | list of unified market symbols | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.fetchPositions ([symbols, params]) ``` ### setMarginMode{docsify-ignore} set margin mode (symbol) **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - response from the exchange | Param | Type | Required | Description | | --- | --- | --- | --- | | marginMode | string | Yes | margin mode must be either [isolated, cross] | | symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | | params | object | No | extra parameters specific to the exchange API endpoint | | params.leverage | string | No | the rate of leverage, is required if setting trade mode (symbol) | ```javascript hyperliquid.setMarginMode (marginMode, symbol[, params]) ``` ### setLeverage{docsify-ignore} set the level of leverage for a market **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - response from the exchange | Param | Type | Required | Description | | --- | --- | --- | --- | | leverage | float | Yes | the rate of leverage | | symbol | string | Yes | unified market symbol | | params | object | No | extra parameters specific to the exchange API endpoint | | params.marginMode | string | No | margin mode must be either [isolated, cross], default is cross | ```javascript hyperliquid.setLeverage (leverage, symbol[, params]) ``` ### addMargin{docsify-ignore} add margin **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | amount | float | Yes | amount of margin to add | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.addMargin (symbol, amount[, params]) ``` ### reduceMargin{docsify-ignore} remove margin from a position **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | amount | float | Yes | the amount of margin to remove | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.reduceMargin (symbol, amount[, params]) ``` ### transfer{docsify-ignore} transfer currency internally between wallets on the same account **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer | Param | Type | Required | Description | | --- | --- | --- | --- | | code | string | Yes | unified currency code | | amount | float | Yes | amount to transfer | | fromAccount | string | Yes | account to transfer from *spot, swap* | | toAccount | string | Yes | account to transfer to *swap, spot or address* | | params | object | No | extra parameters specific to the exchange API endpoint | | params.vaultAddress | string | No | the vault address for order | ```javascript hyperliquid.transfer (code, amount, fromAccount, toAccount[, params]) ``` ### withdraw{docsify-ignore} make a withdrawal (only support USDC) **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) **See** - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault | Param | Type | Required | Description | | --- | --- | --- | --- | | code | string | Yes | unified currency code | | amount | float | Yes | the amount to withdraw | | address | string | Yes | the address to withdraw to | | tag | string | Yes | | | params | object | No | extra parameters specific to the exchange API endpoint | | params.vaultAddress | string | No | vault address withdraw from | ```javascript hyperliquid.withdraw (code, amount, address, tag[, params]) ``` ### fetchTradingFee{docsify-ignore} fetch the trading fees for a market **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.fetchTradingFee (symbol[, params]) ``` ### fetchLedger{docsify-ignore} fetch the history of changes, actions done by the user or operations that altered the balance of the user **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger-structure) | Param | Type | Required | Description | | --- | --- | --- | --- | | code | string | Yes | unified currency code | | since | int | No | timestamp in ms of the earliest ledger entry | | limit | int | No | max number of ledger entrys to return | | params | object | No | extra parameters specific to the exchange API endpoint | | params.until | int | No | timestamp in ms of the latest ledger entry | ```javascript hyperliquid.fetchLedger (code[, since, limit, params]) ``` ### fetchDeposits{docsify-ignore} fetch all deposits made to an account **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) | Param | Type | Required | Description | | --- | --- | --- | --- | | code | string | Yes | unified currency code | | since | int | No | the earliest time in ms to fetch deposits for | | limit | int | No | the maximum number of deposits structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.until | int | No | the latest time in ms to fetch withdrawals for | ```javascript hyperliquid.fetchDeposits (code[, since, limit, params]) ``` ### fetchWithdrawals{docsify-ignore} fetch all withdrawals made from an account **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) | Param | Type | Required | Description | | --- | --- | --- | --- | | code | string | Yes | unified currency code | | since | int | No | the earliest time in ms to fetch withdrawals for | | limit | int | No | the maximum number of withdrawals structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.until | int | No | the latest time in ms to fetch withdrawals for | ```javascript hyperliquid.fetchWithdrawals (code[, since, limit, params]) ``` ### createOrdersWs{docsify-ignore} create a list of trade orders using WebSocket post request **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order | Param | Type | Description | | --- | --- | --- | | orders | Array | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | ```javascript hyperliquid.createOrdersWs (orders, [undefined]) ``` ### createOrder{docsify-ignore} create a trade order using WebSocket post request **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified symbol of the market to create an order in | | type | string | Yes | 'market' or 'limit' | | side | string | Yes | 'buy' or 'sell' | | amount | float | Yes | how much of currency you want to trade in units of base currency | | price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | | params | object | No | extra parameters specific to the exchange API endpoint | | params.timeInForce | string | No | 'Gtc', 'Ioc', 'Alo' | | params.postOnly | bool | No | true or false whether the order is post-only | | params.reduceOnly | bool | No | true or false whether the order is reduce-only | | params.triggerPrice | float | No | The price at which a trigger order is triggered at | | params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | | params.slippage | string | No | the slippage for market order | | params.vaultAddress | string | No | the vault address for order | ```javascript hyperliquid.createOrder (symbol, type, side, amount[, price, params]) ``` ### editOrder{docsify-ignore} edit a trade order **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) **See** - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders | Param | Type | Required | Description | | --- | --- | --- | --- | | id | string | Yes | cancel order id | | symbol | string | Yes | unified symbol of the market to create an order in | | type | string | Yes | 'market' or 'limit' | | side | string | Yes | 'buy' or 'sell' | | amount | float | Yes | how much of currency you want to trade in units of base currency | | price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | | params | object | No | extra parameters specific to the exchange API endpoint | | params.timeInForce | string | No | 'Gtc', 'Ioc', 'Alo' | | params.postOnly | bool | No | true or false whether the order is post-only | | params.reduceOnly | bool | No | true or false whether the order is reduce-only | | params.triggerPrice | float | No | The price at which a trigger order is triggered at | | params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | | params.vaultAddress | string | No | the vault address for order | ```javascript hyperliquid.editOrder (id, symbol, type, side, amount[, price, params]) ``` ### watchOrderBook{docsify-ignore} watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified symbol of the market to fetch the order book for | | limit | int | No | the maximum amount of order book entries to return | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.watchOrderBook (symbol[, limit, params]) ``` ### watchTickers{docsify-ignore} 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](#hyperliquid) **Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions | Param | Type | Required | Description | | --- | --- | --- | --- | | symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.watchTickers (symbols[, params]) ``` ### watchMyTrades{docsify-ignore} watches information on multiple trades made by the user **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol of the market orders were made in | | since | int | No | the earliest time in ms to fetch orders for | | limit | int | No | the maximum number of order structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.watchMyTrades (symbol[, since, limit, params]) ``` ### watchTrades{docsify-ignore} watches information on multiple trades made in a market **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol of the market trades were made in | | since | int | No | the earliest time in ms to fetch trades for | | limit | int | No | the maximum number of trade structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.watchTrades (symbol[, since, limit, params]) ``` ### watchOHLCV{docsify-ignore} watches historical candlestick data containing the open, high, low, close price, and the volume of a market **Kind**: instance method of [hyperliquid](#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 | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | | timeframe | string | Yes | the length of time each candle represents | | since | int | No | timestamp in ms of the earliest candle to fetch | | limit | int | No | the maximum amount of candles to fetch | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript hyperliquid.watchOHLCV (symbol, timeframe[, since, limit, params]) ``` ### watchOrders{docsify-ignore} watches information on multiple orders made by the user **Kind**: instance method of [hyperliquid](#hyperliquid) **Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) **See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol of the market orders were made in | | since | int | No | the earliest time in ms to fetch orders for | | limit | int | No | the maximum number of order structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | | params.user | string | No | user address, will default to this.walletAddress if not provided | ```javascript hyperliquid.watchOrders (symbol[, since, limit, params]) ```