Definition

Liquidity Pools are fundamental components driving DeFi protocols. They serve multiple purposes, including adding liquidity to earn fees, removing liquidity to claim accrued fees, and swapping one asset for another (e.g., WBTC for WETH). This section also covers impermanent loss endpoints, which are detailed further in the Portfolio and Returns sections. In total, there are seven endpoints: three related to liquidity pools and four related to impermanent loss.

Details

Liquidity Pool Endpoints Two primary perspectives are provided for liquidity pools: the pool point of view and the provider point of view.
  • Pool Point of View: This presents a comprehensive view of every liquidity provider within a specific pool. For example, the DAI_WETH pool on Uniswap V2 consists of thousands of liquidity providers. The data includes each provider’s address, percentage ownership of the pool, the number of LP tokens held (in WEI), and the timestamp of their most recent liquidity event. This perspective is useful for assessing the size and liquidity of a pool.
  • Provider Point of View: This shows every pool in which a given address has provided liquidity. The data includes percentage ownership in each pool, the number of LP tokens owned (in WEI), and the date of the last liquidity event, mirroring the information available from the pool perspective.
Additionally, an Events endpoint lists all mint (add liquidity), burn (remove liquidity), and swap events associated with a particular address. This endpoint provides a detailed transaction history for liquidity interactions by address. Impermanent Loss Impermanent loss (IL) is a critical but complex metric to understand in DeFi, conceptually similar to unrealized capital gains in traditional finance but specific to liquidity provision. Amberdata provides event-level granularity on IL for liquidity providers, ensuring accuracy beyond what can be derived from end-of-day aggregates. Example:
Provider A adds $100 worth of assets to the DAI_WETH Uniswap V2 pool on day 1. On day 2, Provider A removes $50 worth of assets and later adds that same $50 back into the pool. Although the end-of-day pool holdings appear unchanged, the fees and IL calculations would be incorrect if based solely on daily snapshots. Event-level tracking allows precise calculation of IL in such scenarios.
Four impermanent loss endpoints are available:
  • Provider Return Since Inception: Shows IL for a liquidity provider from their initial liquidity event up to a specified date, providing a macro view of the position.
  • Provider Historical Return: Offers up to 731 days of IL data for a liquidity provider, giving a micro, day-by-day view.
  • Pool Total Return: Aggregates IL and returns for all liquidity providers in a pool since its inception, including fees earned (token and USD value), fee claim status, IL, and overall return.
  • Impermanent Loss & DEX Returns: The newest endpoint, currently supporting only Uniswap V3, calculates daily changes in IL and displays results as a ratio (rather than USD) to avoid price anomaly distortions. Protocol coverage expansion is planned.

API Endpoints

/market/defi/liquidity-positions/pairs/{pair}/latest /market/defi/liquidity-positions/providers/{address}/latest /market/defi/liquidity/providers/{providerAddress}/events //market/defi/liquidity/providers/return/{liquidityPoolAddress} /market/defi/liquidity/providers/daily-return/{liquidityPoolAddress} /market/defi/liquidity/pool/daily-return/{address}

Availability

DeFi Liquidity Pool endpoints provide data from both the pool and provider perspectives, as well as detailed provider event histories. Impermanent loss endpoints support both macro (since inception) and micro (daily, up to 731 days) views, pool-level aggregation, and the latest Uniswap V3-specific returns.

Frequently Asked Questions

What is the difference between a mint, burn, and swap in the Events endpoint?
  • Mint: Represents the addition of liquidity to a pool (e.g., adding assets to the DAI_WETH pool on Uniswap V2).
  • Burn: Represents the removal of liquidity from a pool.
  • Swap: Represents the exchange of one token for another within a pool (e.g., swapping DAI for WETH or vice versa).
Displaying all three event types provides a comprehensive view of an address’s interactions with liquidity pools.