For the complete documentation index, see llms.txt. This page is also available as Markdown.

Position Value

Position Value

Calculate the current total value of your position including liquidity and accumulated fees.

Basic Value Calculation

// Get total position value
async function getPositionValue(
  pair: LBPair,
  positionId: string
) {
  // Get amounts from all bins (includes fees)
  const amounts = await sdk.Position.getPositionBinsAmount(pair, positionId);
  
  // Sum totals
  const totals = amounts.reduce((sum, bin) => ({
    x: sum.x + bin.amountX,
    y: sum.y + bin.amountY
  }), { x: 0n, y: 0n });
  
  return totals;
}

Calculate USD Value

Quick Value Check

What's Included

The value includes:

  • Original liquidity amounts

  • Accumulated trading fees

  • Current market prices

  • All bins in the position

Display Format

Track Changes

Important Notes

  • Value changes with price movements

  • Includes all accumulated fees

  • No need for manual fee calculations

  • Updates in real-time with market

Last updated