boomer77uni easy
Updated 2021-08-03
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
›
⌄
WITH swap_raw AS (
SELECT
date_trunc('week', block_timestamp) AS date,
CASE WHEN amount0_usd < 0 THEN amount0_usd ELSE amount1_usd END AS swap_usd_amount_out,
CASE WHEN amount0_usd >= 0 THEN amount0_usd ELSE amount1_usd END AS swap_usd_amount_in
FROM uniswapv3.swaps
)
SELECT
date,
SUM(swap_usd_amount_in) AS swap_usd_amount_in,
SUM(swap_usd_amount_out) AS swap_usd_amount_out
FROM swap_raw
GROUP BY 1
ORDER BY 1 DESC
limit 10
Run a query to Download Data