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.asset.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
assetAssetDisplayAsset identity
side'BUY' | 'SELL'Order direction
typeOrderTypeOrder type
sizestringOriginal order size
pricestringFill price
statusFillStatusFILLED, PARTIALLY_FILLED, CANCELLED, REJECTED
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

FillClassification

ValueDescription
OPENED_LONGOpened a new long position from zero
OPENED_SHORTOpened a new short position from zero
INCREASED_LONGAdded to an existing long position
INCREASED_SHORTAdded to an existing short position
REDUCED_LONGPartially closed a long position
REDUCED_SHORTPartially closed a short position
CLOSED_LONGFully closed a long position
CLOSED_SHORTFully closed a short position
SWITCHED_LONGClosed a short and opened a long
SWITCHED_SHORTClosed a long and opened a short
SPOT_BUYSpot market buy
SPOT_SELLSpot 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?Full URL for next page (may be absent)
API Reference: GET /fills