Query editor
withaddress (address) as (values(0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2),(0xc098b2a3aa256d2140208c3de6543aaef5cd3a94)), token_price_usd as (selectdate_trunc('hour', minute) as time, decimals, avg(price) as avg_pricefrom prices.usdwhere 1=1and blockchain = 'ethereum'and contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2and minute >= cast('2022-11-06 00:00' as timestamp)and minute <= cast('2022-11-06 23:59' as timestamp)group by 1,2), inflow as (selectdate_trunc('hour',t.block_time) as time, sum(cast(value as double) / pow(10,18)) as value, sum(cast(value as double) / pow(10,18) * tk.avg_price) as usd_valuefrom ethereum.traces tleft join token_price_usd tk on tk.time = date_trunc('hour',t.block_time)where 1=1and t.block_time >= cast('2022-11-06 00:00' as timestamp)and t.block_time <= cast('2022-11-06 23:59' as timestamp)and t.to in (select address from address)group by 1), outflow as (selectdate_trunc('hour',t.block_time) as time, sum(cast(value as double) / pow(10,18)) * (-1) as value, sum(cast(value as double) / pow(10,18) * tk.avg_price) * (-1) as usd_valuefrom ethereum.traces tleft join token_price_usd tk on tk.time = date_trunc('hour',t.block_time)where 1=1and t.block_time >= cast('2022-11-06 00:00' as timestamp)and t.block_time <= cast('2022-11-06 23:59' as timestamp)and "from" in (select address from address)group by 1)selecttime, eth_value, sum(eth_value) over (order by 1) as cumulative_eth_value, usd_value as "USD Value", sum(usd_value) over (order by 1) as cumulative_usd_valuefrom (selecttime, sum(value) as eth_value, sum(usd_value) as usd_value