Query editor
withall_cex as (selectaddress,cex_name as namefrom addresses_ethereum.cexwhere cex_name in ('Binance', 'FTX', 'Coinbase', 'OKX', 'Huobi', 'Gate.io', 'Kraken', 'Bitfinex', 'KuCoin', 'Crypto.com', 'Gemini')unionselectaddress,cex_name as namefrom cex.addresseswhere 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('minute', 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 '1' dayAND contract_address in (0xdac17f958d2ee523a2206206994597c13d831ec7, --USDT0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, --USDC0x6b175474e89094c44da98b954eedeac495271d0f --DAI)GROUP BY 1, 2union allSELECTdate_trunc('minute', t."evt_block_time") AS time,c.name as exchange,SUM(CAST(t."value" AS DOUBLE)/1e18) AS amount_receivedFROM erc20_bnb.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 '1' dayAND contract_address in (0x55d398326f99059ff775485246999027b3197955, --BUSD0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d, --USDC0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3 --DAI)GROUP BY 1, 2union allSELECTdate_trunc('minute', t."evt_block_time") AS time,c.name as exchange,SUM(CAST(t."value" AS DOUBLE)/1e18) AS amount_receivedFROM erc20_arbitrum.evt_Transfer tleft join cex c on c.address = t."to"