Query editor
withstat as (selectsplit_part(upper(chain), '_', 1) as blockchain, count(*) as swaps, count(distinct tx_hash) as txs, sum(amount_usd) as volume, count(distinct user) as wallets, count(*) filter(where block_time > current_timestamp - interval '1' year) as swaps_1y, count(distinct tx_hash) filter(where block_time > current_timestamp - interval '1' year) as txs_1y, sum(amount_usd) filter(where block_time > current_timestamp - interval '1' year) as volume_1y, count(distinct user) filter(where block_time > current_timestamp - interval '1' year) as wallets_1y, count(*) filter(where block_time > current_timestamp - interval '2' year and block_time < current_timestamp - interval '1' year) as swaps_1y_previos, count(distinct tx_hash) filter(where block_time > current_timestamp - interval '2' year and block_time < current_timestamp - interval '1' year) as txs_1y_previos, sum(amount_usd) filter(where block_time > current_timestamp - interval '2' year and block_time < current_timestamp - interval '1' year) as volume_1y_previos, count(distinct user) filter(where block_time > current_timestamp - interval '2' year and block_time < current_timestamp - interval '1' year) as wallets_1y_previos, count(*) filter(where block_time > current_timestamp - interval '6' month) as swaps_6m, count(distinct tx_hash) filter(where block_time > current_timestamp - interval '6' month) as txs_6m, sum(amount_usd) filter(where block_time > current_timestamp - interval '6' month) as volume_6m, count(distinct user) filter(where block_time > current_timestamp - interval '6' month) as wallets_6m, count(*) filter(where block_time > current_timestamp - interval '3' month) as swaps_3m, count(distinct tx_hash) filter(where block_time > current_timestamp - interval '3' month) as txs_3m, sum(amount_usd) filter(where block_time > current_timestamp - interval '3' month) as volume_3m, count(distinct user) filter(where block_time > current_timestamp - interval '3' month) as wallets_3m, count(*) filter(where block_time > current_timestamp - interval '6' month and block_time < current_timestamp - interval '3' month) as swaps_3m_previos, count(distinct tx_hash) filter(where block_time > current_timestamp - interval '6' month and block_time < current_timestamp - interval '3' month) as txs_3m_previos, sum(amount_usd) filter(where block_time > current_timestamp - interval '6' month and block_time < current_timestamp - interval '3' month) as volume_3m_previos, count(distinct user) filter(where block_time > current_timestamp - interval '6' month and block_time < current_timestamp - interval '3' month) as wallets_3m_previosfrom (selectblockchain as chain, block_time, tx_hash, user, call_trace_address, amount_usdfrom oneinch.swapswhereif('{{blockchain}}' = '= all =', true, blockchain = '{{blockchain}}')and (protocol = 'AR' or flags['second_side'])and tx_success and call_success)group by 1), main as (select *from statunion allselect