Get Position Bins

View all bins where a position has active liquidity. This method shows the liquidity distribution across different price levels within a specific position.

Prerequisites

Before fetching position bins:

  • Have a valid position ID

  • Have the associated LBPair object

  • Understand bin IDs and price relationships

  • Position must belong to the specified pair

Basic Usage

// Get pair and position
const pair = await sdk.Pair.getPair(pairAddress);
const positionId = "0x123...abc";

// Fetch bins with liquidity
const bins = await sdk.Position.getPositionBins(pair, positionId);

console.log(`Position has liquidity in ${bins.length} bins`);

// Display bin details
bins.forEach(bin => {
  console.log(`Bin ${bin.id}: ${bin.liquidity.toString()} liquidity`);
});

Method Signature

Parameters

  • pair: The LBPair object where position exists

  • positionId: The position NFT address

Returns

Array of BinData objects sorted by bin ID:

Understanding Bin Data

Liquidity Values

Price Range Coverage

Get Position Token Amounts

For detailed token amounts per bin:

Analyze Position Shape

Liquidity Concentration

Common Patterns

Check if Position is Active

Visualize Distribution

Error Handling

Last updated