Query editor
WITH cex_flows AS (SELECTblock_week,flow_type, -- 'CEX_inflow'SUM(unique_senders) AS unique_senders,SUM(tx_count) AS out_flow_count,SUM(amount) AS volume_native,SUM(amount_usd) AS volume_usdFROM (SELECTdate_trunc('week', f.block_time) AS block_week,'CEX_inflow' AS flow_type,COUNT(DISTINCT f."from") AS unique_senders,COUNT(DISTINCT f.tx_hash) AS tx_count,SUM(f.amount) AS amount,SUM(f.amount_usd) AS amount_usdFROM cex.flows fINNER JOIN dune.apechain.result_ape_whales_whales_list wON f."from" = w.addressAND date_trunc('week', f.block_time) = w.block_weekWHERE((f.blockchain = 'polygon' AND f.token_address = 0xB7b31a6BC18e48888545CE79e83E06003bE70930)OR (f.blockchain = 'ethereum' AND f.token_address = 0x4d224452801ACEd8B2F0aebE155379bb5D594381)OR (f.blockchain = 'arbitrum' AND f.token_address = 0x4d224452801ACEd8B2F0aebE155379bb5D594381))AND f.cex_name IS NOT NULLAND f.flow_type = 'Inflow'GROUP BY 1, 2)GROUP BY 1, 2),bridge_flows AS (SELECTblock_week,flow_type,SUM(unique_senders) AS unique_senders,SUM(tx_count) AS out_flow_count,SUM(amount) AS volume_native,SUM(amount_usd) AS volume_usdFROM (SELECTdate_trunc('week', t.block_date) AS block_week,'bridge_out' AS flow_type,COUNT(DISTINCT t."from") AS unique_senders,COUNT(DISTINCT t.tx_hash) AS tx_count,SUM(t.amount) AS amount,SUM(t.amount_usd) AS amount_usdFROM tokens.transfers tINNER JOIN labels.bridge lON t."to" = l.addressINNER JOIN dune.apechain.result_ape_whales_whales_list wON date_trunc('week', t.block_date) = w.block_weekAND t."from" = w.addressWHERE(t.blockchain = 'polygon' AND t.contract_address = 0xB7b31a6BC18e48888545CE79e83E06003bE70930)OR (t.blockchain = 'ethereum' AND t.contract_address = 0x4d224452801ACEd8B2F0aebE155379bb5D594381)OR (t.blockchain = 'arbitrum' AND t.contract_address = 0x4d224452801ACEd8B2F0aebE155379bb5D594381)GROUP BY 1, 2)GROUP BY 1, 2),