andre4trader joe swaps by pool 2
Updated 2024-09-30
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 top_projects AS (
SELECT
pool_name
FROM avalanche.defi.ez_dex_swaps
WHERE
platform ilike '%trader-joe%' and amount_out_usd is not null
GROUP BY
pool_name
ORDER BY
SUM(amount_out_usd) DESC
LIMIT 10
),
joe AS (
SELECT
DATE_TRUNC('day', block_timestamp) AS time,
pool_name,
sender,
tx_hash,
amount_out_usd AS volume
FROM avalanche.defi.ez_dex_swaps
WHERE DATE_TRUNC('day', block_timestamp) < DATE_TRUNC('day', CURRENT_DATE) and platform ilike '%trader-joe%'
and time>=current_date-INTERVAL '1 week' and amount_out_usd is not null
--AND pool_name IN (SELECT pool_name FROM top_projects)
),
alls AS (
SELECT
time,
pool_name,
COUNT(DISTINCT tx_hash) AS sales,
COUNT(DISTINCT sender) AS active_users,
SUM(volume) AS volume,
AVG(volume) AS avg_price
FROM joe
GROUP BY 1,2
),
alls2 AS (
QueryRunArchived: QueryRun has been archived