Skip to content
All library documents

Querying Uniswap V3 NFT Positions and Estimating Uncollected Fees

Article FMZ digest · Author: 发明者量化-小小梦

Summary

This technical guide shows how to inspect liquidity positions represented by Uniswap V3 nonfungible position tokens. It outlines a sequence for finding the position manager, checking a wallet’s NFT balance, retrieving each token ID, and querying position details such as the pool, tick range, and liquidity. The document also describes reading pool state and tick data to estimate fees that have accrued but have not yet been collected.

The fee calculation uses global fee-growth values and the fee growth recorded at the position’s lower and upper ticks. It determines fee growth inside the position’s range, accounts for whether the current tick lies below, within, or above that range, then scales the change by the position’s liquidity and token precision. Code examples illustrate contract calls and large-integer arithmetic. This is an implementation guide rather than a trading-performance study: it provides no strategy backtest, and fee estimates depend on accurate contract data and careful handling of fixed-point and wraparound arithmetic. The guide focuses on querying positions and fees; adding or removing liquidity is reserved for a later installment.

Key ideas

  • Uniswap V3 liquidity positions are represented by NFTs managed through the position manager contract.
  • A wallet’s position details can be retrieved by enumerating its position token IDs and querying each one.
  • Uncollected fees are estimated from fee growth inside the position’s tick range and its liquidity.
  • The calculation must account for the current tick’s location relative to the position boundaries.
  • The guide demonstrates data retrieval and fee accounting, not a tested trading strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.