Liquidity

Definition

Liquidity is an interesting topic in DeFi due to its importance and the inevitable comparison to traditional financial markets. However, unlike traditional finance markets there is no order-book in DeFi (we'll talk about uniswapV3 in a bit). This makes understanding the price of an asset difficult since you can’t see how much liquidity is available at a particular price (except for uniswapV3). This is where our liquidity endpoints come in. We can show the current liquidity price for both assets in a pair, with the latest data or all of the historical data from the inception of the pool. We also show the current amount of each token in the pool and all the information about the pool itself including the pool (pair) address, pair name, base/quote address, exchange ID and more.

Since Uniswap V3 is unique, we've built a separate endpoint just to see its liquidity which we'll talk more about below.


Details

The Amberdata liquidity endpoints allow you to see what the price of an asset should be relative to the other asset in the pair. For example, in the WBTC_WETH pool on uniswapV2 you might see a liquidityPrice of 13.730xxx for WBTC and a liquidityPrice of 0.072xxx for WETH. This means that the price of WBTC is equivalent to 13.70xxx WETH and conversely, the price of WETH is equivalent to 0.072xxx WBTC. If you’re interested in what these prices were at a certain point in time, our historical endpoint can show data all the way back from the inception date of the pool. Also, we do something unique for LP tokens. LP tokens are the tokens you receive when you add liquidity to a pool and represent your fractional ownership of that pool. However, there isn’t an easy way to understand the USD value of these tokens and hence the value of your position in the pool. With our new Snapshot endpoint you’ll be able to see the current value of the LP token in USD. Combined with the number of LP tokens you have, you can now calculate the value of your liquidity position in the pool.

Uniswap V3 Liquidity Distribution:
One of the big advantages of uniswapV3 vs uniswapV2 is the ability for the liquidity provider to choose where on the price curve their liquidity gets added. This is huge improvement from V2 where added liquidity was spread out across the entire price curve, which is less than ideal for a stable coin pool that trades in a narrow range. By allowing the user to determine at which price range the liquidity is added, this allows you to see how much liquidity is added throughout the price curve. You can think of this as a pseudo order book, which is unique in DeFi. This Amberdata endpoint allows the user to query uniswapV3 pools by token (0 or 1) and see how much liquidity is in a given price range by seeing the different ticks. In addition, we give you the option to see the Active Tick to know exactly where the market is for most recent block. This is a great way for liquidity providers to see the optimal range for adding liquidity as well as giving traders a view into the "order book" of a pool on uniswapV3.


API Endpoints

//market/defi/liquidity/information/
/market/defi/liquidity/{pool}/latest/
/market/defi/liquidity/{pool}/historical/
/market/defi/liquidity/{pool}/snapshots/
/market/defi/dex/uniswapv3/pools/{poolAddress}/liquidity-distribution


Availability

Our DeFi Liquidity endpoints are available via REST API for information, latest, historical (time series), Snapshot and uniV3 data.

Since we maintain our own nodes, we have every event from the Genesis (Ethereum for example) block forward which enables us to provide the complete historical dataset for all the protocols we support.


Frequently Asked Questions

How frequently do you report changes to the liquidity endpoints?

  • All of the Amberdata DeFi endpoints are block-based so every time there is an event or change in a particular pool, it will be displayed in the endpoints.

How is the LP Token Price Calculated?

  • The LP token price in the Snapshot endpoint is a weighted average of the tokens in a pool (like WBTC_WETH), minus the spam tokens in the pool.