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//* #duneworkshop_assignment_initiation0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2 FTX10xc098b2a3aa256d2140208c3de6543aaef5cd3a94 FTX2 */WITHaddress(address) AS(values(0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2),(0xc098b2a3aa256d2140208c3de6543aaef5cd3a94)),price AS (SELECTdate_trunc('day', minute) AS time,avg(price) AS avg_priceFROMprices.usdwhereblockchain = 'ethereum'and minute = cast('2022-11-06' as TIMESTAMP)and symbol = 'WETH'group by1),inflow as (SELECTdate_trunc('day', block_time) as time,'in' as category,SUM(CAST(value as double) / 1e18) as eth_in,SUM(CAST(value as double) / 1e18 * avg_price) as usd_inFROMethereum.traces as tleft join price as p on date_trunc('day', t.block_time) = p.timeWHEREto in (SELECTaddressfromaddress)AND block_time >= CAST('2022-11-06' AS TIMESTAMP)AND block_time < CAST('2022-11-07' AS TIMESTAMP)group by1),outflow as (SELECTdate_trunc('day', block_time) as time,'out' as category,SUM(CAST(value as double) / 1e18) as eth_out,SUM(CAST(value as double) / 1e18 * avg_price) as usd_outFROMethereum.traces as tleft join price as p on date_trunc('day', t.block_time) = p.timeWHERE"from" in (SELECTaddressfromaddress