[Python] How to calculate Uniswap v3 pool's Total Value Locked (TVL) on chain?

Discussão em 'Python' iniciado por Stack, Março 10, 2025.

  1. Stack

    Stack Membro Participativo

    I want to calculate the total value locked in a particular pool in Uniswap v3. I can't use the subgraph API for this.

    [​IMG]

    I can get current liquidity / in range liquidity using uniswapV3pool contract function:

    in_range_liquidity = uniswapV3pool_contract.functions.liquidity().call()


    I get the result 10608850786221311055 for liquidity. Do I need to process it to get the USD value or something else?

    Finally this is just current liquidity, I need total locked value, which includes both active and inactive liquidity in the pool.

    Continue reading...

Compartilhe esta Página