jackguystETH 8
Updated 2023-10-07
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
›
⌄
SELECT
*,
sum(net_buy_volume_usd) over (ORDER BY day) as cumulative_net_buy_volume_usd
FROM (
SELECT
date_trunc('day', block_timestamp) as day,
CASE when block_timestamp > '2023-05-15' then 'Post withdraw open' else 'Pre withdraw open' end as time_period,
count(DISTINCT tx_hash) as swaps,
count(DISTINCT ORIGIN_FROM_ADDRESS) as swappers,
sum(CASE when AMOUNT_IN_USD is NULL then AMOUNT_OUT_USD else AMOUNT_IN_USD end) as volume_usd,
sum(CASE when AMOUNT_IN_USD is NULL then AMOUNT_OUT_USD else AMOUNT_IN_USD end * CASE when symbol_in LIKE 'stETH' then -1 else 1 end) as net_buy_volume_usd
FROM ethereum.core.ez_dex_swaps
WHERE (symbol_in LIKE 'stETH' or symbol_out LIKE 'stETH')
and block_timestamp > '2023-05-01'
GROUP BY 1,2
)
Run a query to Download Data