angealUsing the dex_swaps table
Updated 2022-02-02Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
-- let's get daily volume for a specific pool
-- Query to get options:
--SELECT pool_name, platform, sum(amount_usd) AS volume FROM ethereum.dex_swaps WHERE block_timestamp > '2021-10-29' GROUP BY 1, 2 ORDER BY amount_usd desc
-- every swap for sushi usdc/eth since the 29th
SELECT *
FROM ethereum.dex_swaps
WHERE block_timestamp > '2021-10-29'
AND pool_address = '0x397ff1542f962076d0bfe58ea045ffa2d347aca0'
LIMIT 10
-- daily volume
-- SELECT date_trunc('day', block_timestamp) AS day, sum(amount_usd) AS volume
-- FROM ethereum.dex_swaps
-- WHERE block_timestamp > '2021-10-25'
-- AND pool_address = '0x397ff1542f962076d0bfe58ea045ffa2d347aca0'
-- AND amount_in = 0 -- don't include both"sides" of the swap
-- GROUP BY day
Run a query to Download Data