Query editor
/* Eth netflow in USD terms for FTX in Nov 6- Find FTX wallet, vamos a spells, labels, cex, ftx--> select * from labels.cex_ethereum WHERE name LIKE 'FTX%' -- FTX 1 0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2, FTX 2 0xc098b2a3aa256d2140208c3de6543aaef5cd3a94- Find values for Nov 6-Eth on Ethereum mainnet in USD terms-decimals, price*/with address(address) as (values(0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2),(0xc098b2a3aa256d2140208c3de6543aaef5cd3a94)), token_price_dec as (select date_trunc('day', minute) as time, decimals, avg(price) as avg_pricefrom prices.usdwhere blockchain = 'ethereum'and contract_address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48and minute > cast('2022-11-05' as TIMESTAMP) and minute < cast('2022-11-07' as TIMESTAMP)group by 1, 2limit 10), inflow as (selectdate_trunc('day', evt_block_time) as time, 'in' as category, sum(cast(value as double) / pow (10,tk.decimals)) as raw_amt, sum(cast(value as double) / pow (10,tk.decimals) * tk.avg_price) as usd_amtfrom erc20_ethereum.evt_Transfer tleft join token_price_dec tk on tk.time = date_trunc('day', evt_block_time)where t.contract_address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48and t.evt_block_time > cast('2022-11-06' as TIMESTAMP) and t.evt_block_time <= cast('2022-11-07' as TIMESTAMP)and t.to in (select address from address)group by 1,2), outflow as (selectdate_trunc('day', evt_block_time) as time, 'out' as category,-1 * sum(cast(value as double) / pow (10,tk.decimals)) as raw_amt, -1 * sum(cast(value as double) / pow (10,tk.decimals) * tk.avg_price) as usd_amtfrom erc20_ethereum.evt_Transfer tleft join token_price_dec tk on tk.time = date_trunc('day', evt_block_time)where t.contract_address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48and t.evt_block_time > cast('2022-11-06' as TIMESTAMP) and t.evt_block_time <= cast('2022-11-07' as TIMESTAMP)and t."from" in (select address from address)group by 1,2