Query editor
WITH b AS (SELECT DISTINCT address FROM labels.owner_addresses WHERE blockchain='ethereum' AND (lower(owner_key)='binance' OR lower(custody_owner)='binance' OR lower(account_owner)='binance')), t AS (SELECT t.*, a.address IS NOT NULL from_binance,c.address IS NOT NULL to_binance FROM tokens.transfers t LEFT JOIN b a ON t."from"=a.address LEFT JOIN b c ON t."to"=c.address WHERE t.blockchain='ethereum' AND t.block_month=DATE '2026-10-01' AND t.block_time>=TIMESTAMP '2026-10-30 00:00:00' AND t.block_time<TIMESTAMP '2026-10-31 11:06:12' AND t.contract_address=0x8207c1ffc5b6804f6024322ccf34f29c3541ae26) SELECT CASE WHEN from_binance AND to_binance THEN 'Binance internal transfer' WHEN to_binance THEN 'External inflow to Binance' ELSE 'External outflow from Binance' END category, count(*) transfers,sum(amount) ogn,min(block_time) first_time,max(block_time) last_time FROM t WHERE from_binance OR to_binance GROUP BY 1