Query editor
withstatic as (selectnow() - interval '60' day as ts_from, split('{{blockchain}}', ',') as blockchains), fusion as (selectupper(split_part(blockchain, '_', 1)) as blockchain, count(*) filter(where period_30d) as fills_30d, count(distinct order_hash) filter(where period_30d) as orders_30d, count(distinct tx_hash) filter(where period_30d) as txs_30d, count(distinct user) filter(where period_30d) as users_30d, sum(amount_usd) filter(where period_30d) as volume_30d, count(*) filter(where period_60d and not period_30d) as fills_30d_p, count(distinct order_hash) filter(where period_60d and not period_30d) as orders_30d_p, count(distinct tx_hash) filter(where period_60d and not period_30d) as txs_30d_p, count(distinct user) filter(where period_60d and not period_30d) as users_30d_p, sum(amount_usd) filter(where period_60d and not period_30d) as volume_30d_p, count(*) filter(where period_7d) as fills_7d, count(distinct order_hash) filter(where period_7d) as orders_7d, count(distinct tx_hash) filter(where period_7d) as txs_7d, count(distinct user) filter(where period_7d) as users_7d, sum(amount_usd) filter(where period_7d) as volume_7d, count(*) filter(where period_14d and not period_7d) as fills_7d_p, count(distinct order_hash) filter(where period_14d and not period_7d) as orders_7d_p, count(distinct tx_hash) filter(where period_14d and not period_7d) as txs_7d_p, count(distinct user) filter(where period_14d and not period_7d) as users_7d_p, sum(amount_usd) filter(where period_14d and not period_7d) as volume_7d_p, count(*) filter(where period_24h) as fills_24h, count(distinct order_hash) filter(where period_24h) as orders_24h, count(distinct tx_hash) filter(where period_24h) as txs_24h, count(distinct user) filter(where period_24h) as users_24h, sum(amount_usd) filter(where period_24h) as volume_24h, count(*) filter(where period_48h and not period_24h) as fills_24h_p, count(distinct order_hash) filter(where period_48h and not period_24h) as orders_24h_p, count(distinct tx_hash) filter(where period_48h and not period_24h) as txs_24h_p, count(distinct user) filter(where period_48h and not period_24h) as users_24h_p, sum(amount_usd) filter(where period_48h and not period_24h) as volume_24h_pfrom (selectswaps.*, if(block_time > now() - interval '60' day, true, false) as period_60d, if(block_time > now() - interval '30' day, true, false) as period_30d, if(block_time > now() - interval '14' day, true, false) as period_14d, if(block_time > now() - interval '7' day, true, false) as period_7d, if(block_time > now() - interval '49' hour, true, false) as period_48h, if(block_time > now() - interval '25' hour and block_time < now() - interval '1' hour, true, false) as period_24h, row_number() over(partition by user order by block_time, call_trace_address) as account_rn, count(*) over(partition by order_hash) as order_fillsfrom oneinch.swaps, staticwhere true