drethereumLSD Net Deposits & Withdrawals by Day
Updated 2023-11-07
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
›
⌄
WITH deposits AS (
SELECT
date_trunc('day',block_timestamp) AS day,
platform,
token_symbol,
SUM(eth_amount) AS total_eth_deposit,
SUM(eth_amount_usd) AS total_usd_deposit
FROM ethereum.defi.ez_liquid_staking_deposits
WHERE day >= CURRENT_DATE - {{days}}
GROUP BY 1,2,3
),
withdrawals AS (
SELECT
date_trunc('day',block_timestamp) AS day,
platform,
token_symbol,
SUM(eth_amount) AS total_eth_withdrawn,
SUM(eth_amount_usd) AS total_usd_withdrawn
FROM ethereum.defi.ez_liquid_staking_withdrawals
WHERE day >= CURRENT_DATE - {{days}}
GROUP BY 1,2,3
),
net AS (
SELECT
day,
platform,
token_symbol,
ROUND(total_eth_deposit,0) AS total_eth_deposit,
ROUND(total_eth_withdrawn,0) AS total_eth_withdrawn,
ROUND(total_eth_deposit - COALESCE(total_eth_withdrawn,0),0) AS net_eth,
ROUND(total_usd_deposit - COALESCE(total_usd_withdrawn,0),0) AS net_usd
FROM deposits
LEFT JOIN withdrawals USING(platform,day)
ORDER BY 1 DESC, 6 DESC
Run a query to Download Data