Query editor
-- with trades as (-- select-- block_time,-- date_trunc('day', block_time) as date,-- tx_id,-- project,-- case-- when token_bought_symbol is null and token_bought_mint_address = '2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH' then 'USDG'-- else token_bought_symbol-- end as token_bought_symbol,-- case-- when token_sold_symbol is null and token_sold_mint_address = '2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH' then 'USDG'-- else token_sold_symbol-- end as token_sold_symbol,-- amount_usd,-- trader_id as trader-- from dex_solana.trades-- where token_bought_mint_address = '2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH'-- or token_sold_mint_address = '2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH'-- -- and cast(block_time as date) >= cast('2025-05-17' as date)-- and block_time >= now() - interval '31' day-- ),-- total as (-- select-- sum(case when block_time > now() - interval '1' day then amount_usd else 0 end) as "1d trade volume $",-- sum(case when block_time > now() - interval '7' day then amount_usd else 0 end) as "7d trade volume $",-- sum(case when block_time > now() - interval '14' day then amount_usd else 0 end) as "14d trade volume $",-- sum(case when block_time > now() - interval '30' day then amount_usd else 0 end) as "30d trade volume $",-- -- sum(case when block_time > now() - interval '60' day then amount_usd else 0 end) as "60d trade volume $",-- -- sum(case when block_time > now() - interval '90' day then amount_usd else 0 end) as "90d trade volume $",-- sum(amount_usd) as "total trade volume $",-- count(distinct case when block_time > now() - interval '1' day then trader end) as "1d traders",-- count(distinct case when block_time > now() - interval '7' day then trader end) as "7d traders",-- count(distinct case when block_time > now() - interval '14' day then trader end) as "14d traders",-- count(distinct case when block_time > now() - interval '30' day then trader end) as "30d traders",-- -- count(distinct case when block_time > now() - interval '60' day then trader end) as "60d traders",-- -- count(distinct case when block_time > now() - interval '90' day then trader end) as "90d traders",-- count(distinct trader) as total_traders-- from trades-- )-- select-- date,-- project,-- sum(amount_usd) as volume_usd,-- count(*) as trades,-- count(distinct trader) as traders,-- b.*-- from trades as a-- cross join total as b-- group by 1, 2, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 --, 16, 17, 18, 19-- order by 1 desc-- ;