Query editor
with price as (selectdate_trunc('day', minute) as time,symbol,contract_address,decimals,avg(price) as avg_pricefromprices.usdwhereminute >= cast('2022-11-06' as timestamp)and minute < cast('2022-11-07' as timestamp)and blockchain = 'ethereum'and contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- wethgroup by1,2,3,4),inflow as (selectdate_trunc('day', block_time) as time,to,t.address,sum(cast(value as double) / pow(10, p.decimals)) as raw_amt,sum(cast(value as double) / pow(10, p.decimals) * p.avg_price) as usd_amtfromethereum.traces tleft join price as p on date_trunc('day', block_time) = p.timewheret.block_time >= cast('2022-11-06' as timestamp)and t.block_time < cast('2022-11-07' as timestamp)and t."to" in ((0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2),(0xc098b2a3aa256d2140208c3de6543aaef5cd3a94))group by1,2,3),outflow as (selectdate_trunc('day', block_time) as time,"from",t.address,sum(cast(value as double) / pow(10, p.decimals)) as raw_amt,sum(cast(value as double) / pow(10, p.decimals) * p.avg_price) * (-1) as usd_amtfromethereum.traces tleft join price as p on date_trunc('day', block_time) = p.timewheret.block_time >= cast('2022-11-06' as timestamp)and t.block_time < cast('2022-11-07' as timestamp)and t."from" in (