Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/withall_cex as (selectaddress,cex_name as namefrom addresses_ethereum.cex-- where cex_name in ('Binance', 'FTX', 'Coinbase', 'OKX', 'Huobi', 'Gate.io', 'Kraken', 'Bitfinex', 'KuCoin', 'Crypto.com', 'Gemini')unionselectaddress,cex_name as namefrom cex.addresses-- where cex_name in ('Binance', 'FTX', 'Coinbase', 'OKX', 'Huobi', 'Gate.io', 'Kraken', 'Bitfinex', 'KuCoin', 'Crypto.com', 'Gemini')),CEX as (selectDISTINCT address, name from all_cex),inflow as (SELECTdate_trunc('day', t."evt_block_time") AS time,c.name as exchange,SUM(CAST(t."value" AS DOUBLE)/1e18) AS amount_receivedFROM erc20_ethereum.evt_Transfer tleft join cex c on c.address = t."to"WHERE "to" in (select address from CEX)-- AND t.evt_block_time >= NOW() - interval '7' dayAND contract_address in (0x0d02755a5700414B26FF040e1dE35D337DF56218)GROUP BY 1, 2),outflow as (SELECTdate_trunc('day', t."evt_block_time") AS time,c.name as exchange,SUM(CAST(t."value" AS DOUBLE)/1e18) AS amount_receivedFROM erc20_ethereum.evt_Transfer tleft join cex c on c.address = t."from"WHERE "from" in (select address from CEX)-- AND t.evt_block_time >= NOW() - interval '7' dayAND contract_address in (0x0d02755a5700414B26FF040e1dE35D337DF56218)GROUP BY 1, 2),flow as (selecttime,exchange,sum(amount_received) as amount_receivedfrom inflowgroup by 1, 2union allselect