Skip to main content
Returns the account summary for a DEX including balances, margin, and fee tier.
The examples on this page use Hyperliquid (provider: 'hyperliquid'). Replace the provider value with any supported DEX from getProviders().
import { getAccount } from '@lifi/perps-sdk';

const account = await getAccount(client, {
  provider: 'hyperliquid',
  address: userAddress,
});

console.log('Balances:', account.balances); // { perps: [...], spot: [...] }
console.log('Margin used:', account.marginUsed);
console.log('Unrealized PnL:', account.unrealizedPnl);

Parameters

ParameterTypeRequiredDescription
clientPerpsSDKClientYesSDK client from createPerpsClient()
params.providerstringYesDEX identifier
params.addressstringYesUser’s wallet address
optionsSDKRequestOptionsNoRequest options

Returns

AccountResponse:
FieldTypeDescription
providerstringProvider identifier
addressstringUser’s wallet address
balancesRecord<string, Balance[]>Account balances grouped by venue (e.g., "perps", "spot")
marginUsedstringMargin currently in use
unrealizedPnlstringTotal unrealized PnL
feeTierFeeTierMaker and taker fee rates
configobjectDEX-specific account configuration (agent status, builder fee, etc.)
Positions and orders are fetched separately via getPositions() and getOrders().
API Reference: GET /account