Skip to main content
Returns the account’s portfolio value and cumulative PnL over a lookback window. Points appear oldest first. The read goes direct to the provider.
The examples on this page use Hyperliquid (provider: 'hyperliquid'). Replace the provider value with any supported DEX from getProviders().
getPortfolioHistory is a method on the SDK client, not a standalone imported function.

Parameters

PortfolioHistoryRange

PortfolioHistoryRange is a string union imported from @lifi/perps-sdk.

Returns

PortfolioHistoryResponse:

PortfolioHistoryPoint fields

Auth requirements

Each provider reads portfolio history with its own credential. The requirement is per provider.

Hyperliquid

Hyperliquid needs no auth. The SDK reads portfolio history from a public Hyperliquid info endpoint using only the account address.

Ondo

Ondo needs an active session. The user signs in with siweLogin before this call. A call with no active session returns an empty points array instead of an error.

Lighter

Lighter needs the account auth token or the read-only token. The SDK resolves a token from its stored key automatically. A call with no resolvable token returns an empty points array instead of an error.