CryptoLionuniswap tvl top 5
Updated 2021-08-11
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
›
⌄
WITH base as (
SELECT
pool_name,
pool_address,
avg(token0_balance_usd+token1_balance_usd) as tvl
FROM uniswapv3.pool_stats
WHERE block_timestamp >= getdate() - interval '1 week'
GROUP BY 1,2
HAVING tvl IS NOT NULL
ORDER BY 3 DESC
LIMIT 5
)
SELECT
date_trunc('week',block_timestamp) as week,
ps.pool_name,
avg(token0_balance_usd+token1_balance_usd) as tvlb,
lag(tvlb) ignore nulls over (partition by ps.pool_name order by week) as last_tvl,
tvlb-last_tvl as change_tvl
FROM uniswapv3.pool_stats ps
INNER JOIN base on base.pool_name = ps.pool_name
WHERE block_timestamp >= getdate() - interval '10 weeks'
GROUP BY 1,2
ORDER BY 1
Run a query to Download Data