Skip to main content
Returns paginated historical fills. Results are sorted by creation time, newest first.
The examples on this page use Hyperliquid (provider: 'hyperliquid'). Replace the provider value with any supported DEX from getProviders().
import { getFills } from '@lifi/perps-sdk';

const fills = await getFills(client, {
  provider: 'hyperliquid',
  address: userAddress,
  limit: 50,
});

for (const item of fills.items) {
  console.log(item.market.baseAsset.displaySymbol, item.side, item.status, item.classification);
}

// Pagination
if (fills.pagination.hasMore) {
  const nextPage = await getFills(client, {
    provider: 'hyperliquid',
    address: userAddress,
    cursor: fills.pagination.cursor,
  });
}

Parameters

ParameterTypeRequiredDescription
clientPerpsSDKClientYesSDK client
params.providerstringYesDEX identifier
params.addressstringYesUser’s wallet address
params.cursorstringNoPagination cursor from previous response
params.limitnumberNoItems per page (default 50, max 100)
params.startTimenumberNoFilter: fills after this timestamp (ms)
params.endTimenumberNoFilter: fills before this timestamp (ms)
optionsSDKRequestOptionsNoRequest options

Returns

FillsResponse:
FieldTypeDescription
providerstringProvider identifier
itemsFill[]Historical fills
paginationPaginationPagination metadata

Fill fields

FieldTypeDescription
idstringFill ID
orderIdstringID of the parent order
marketMarketDisplayMarket identity. Display symbol is market.baseAsset.displaySymbol.
side'BUY' | 'SELL'Order direction
typeOrderType?Order type — see OrderType. Absent when the provider’s fill payload doesn’t carry it and it can’t be inferred (e.g. a Hyperliquid taker fill).
sizestringOriginal order size
pricestringFill price
statusFillStatusFILLED, PARTIALLY_FILLED, CANCELLED, REJECTED
liquidityLiquidityRole'maker' or 'taker' — whether the fill provided or removed liquidity
filledSizestring?Amount filled (absent if no fills yet)
feestring?Total fees paid (absent if no fills yet)
realizedPnlstring | null?Realized PnL (present only when closing a position, null otherwise)
startPositionstring?Position size before this fill
classificationFillClassificationHow this fill affected the position
createdAtstringISO 8601 timestamp
explorerLinkstring?Block-explorer URL for the settling on-chain tx. Absent when the fill has no on-chain tx (every Hyperliquid fill is off-chain).

OrderType

ValueDescription
MARKETMarket order — executes immediately at the best available price
LIMITLimit order — rests until filled, cancelled, or expired
STOP_MARKETStop-market — converts to a market order when the trigger price is hit
STOP_LIMITStop-limit — converts to a limit order when the trigger price is hit
TAKE_PROFIT_MARKETTake-profit market order
TAKE_PROFIT_LIMITTake-profit limit order
TRIGGER_ONLYTrigger-only order (provider-specific; e.g., Lighter’s bare-trigger marker for orders whose final type is decided when the trigger fires)

FillClassification

Wire values are Title Case strings; the SDK exports the FillClassification enum from @lifi/perps-sdk (keys: OPENED_LONG, OPENED_SHORT, …) whose values match these strings.
ValueDescription
"Opened Long"Opened a new long position from zero
"Opened Short"Opened a new short position from zero
"Increased Long"Added to an existing long position
"Increased Short"Added to an existing short position
"Reduced Long"Partially closed a long position
"Reduced Short"Partially closed a short position
"Closed Long"Fully closed a long position
"Closed Short"Fully closed a short position
"Switched Long"Closed a short and opened a long
"Switched Short"Closed a long and opened a short
"Spot Buy"Spot market buy
"Spot Sell"Spot market sell

Pagination fields

FieldTypeDescription
limitnumberItems per page
hasMorebooleanWhether more pages exist — use this as the authoritative check
cursorstring?Cursor for next page (pass to getFills for the next page)
nextUrlstring?Pre-built URL for the next page, when the provider returns one
API Reference: GET /fills