uniswap_v3.tvl
Documentation for eth_defi.uniswap_v3.tvl Python module.
“Analyse Uniswap v3 TVL (total value locked) and market depth.
Functions
|
Return the total value locked of the quote token. |
- fetch_uniswap_v3_pool_tvl(pool, quote_token, block_identifier=None)
Return the total value locked of the quote token.
This gets the amount of quote token locked in the pool
Note
This includes unclaimed fees.
Example how to read the historical pool TVL for WMATIC-USDC pair on Polygon:
# https://tradingstrategy.ai/trading-view/polygon/uniswap-v3/matic-usdc-fee-5 block_estimated = 45_583_631 pool_address = "0xa374094527e1673a86de625aa59517c5de346d32" pool = fetch_pool_details(web3, pool_address) tvl_estimated = fetch_uniswap_v3_pool_tvl( pool, quote_token=usdc, block_identifier=block_estimated, ) print(f"TVL {tvl_estimated:,} USDC at block {(block_estimated,)}")
- Parameters
pool (eth_defi.uniswap_v3.pool.PoolDetails) –
Uniswap v3 pool data fully resolved.
quote_token (eth_defi.token.TokenDetails) – Which side of the pool to get.
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –
Get the historically locked value.
You need to have an archive node to query this.
- Returns
Amount of quote token locked in the pool.
The US dollar TVL is this value * 2, because for the locked value both sides of the pool count, although this is irrelevant for trading
- Return type