hessTVL Change Percentage
    Updated 2023-08-11
    with avax_price as ( select hour::date as date,
    avg(price) as avg_price
    from avalanche.core.fact_hourly_token_prices
    where hour::date >= '2022-01-01'
    group by 1)
    ,
    tvl as ( select date, tvl_usd
    from external.defillama.fact_chain_tvl
    where chain = 'Avalanche'
    and date >= '2022-01-01')
    ,
    final as (select a.date, tvl_usd, tvl_usd/avg_price as tvl_avax
    from tvl a join avax_price b on a.date = b.date)
    ,
    tvl_fix as ( select tvl_avax as previous_tvl
    from final
    where date = '2022-01-01')

    select date, tvl_avax , previous_tvl, ((tvl_avax - previous_tvl)/(previous_tvl)) * 100 as tvl_change_ratio
    from final, tvl_fix
    order by 1 desc
    limit 1




    Run a query to Download Data