boomer77TVL example
Updated 2021-08-10
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
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
SELECT date, total_deposits_usd, total_withdrawls_usd,
total_deposits_usd+total_withdrawls_usd as deposits_minus_withdrawl,
total_deposits_usd - LAG(total_deposits_usd) OVER (ORDER BY date) as change_in_total_deposits_usd,
-total_withdrawls_usd + LAG(total_withdrawls_usd) OVER (ORDER BY date) as change_in_total_withdrawls_usd
FROM
--starter query: Liquidity: USD Volume - Daily
(WITH liquidity_pool AS (
SELECT
tx_id,
date_trunc('week', block_timestamp) AS date,
action,
pool_address,
pool_name,
token0_address,
token1_address,
token0_symbol,
token1_symbol,
amount0_adjusted,
amount1_adjusted,
amount0_usd,
amount1_usd,
(amount0_usd + amount1_usd) AS add_amount_total
FROM uniswapv3.lp_actions
),
add_liquidity AS (
SELECT
date,
SUM(add_amount_total) AS total_deposit
FROM liquidity_pool
WHERE action = 'INCREASE_LIQUIDITY'
GROUP BY 1
),
remove_liquidity AS (
SELECT
date,
Run a query to Download Data