Query editor
with price as (select date_trunc('hour',minute) as hour,avg(price) as pricefrom prices.usdwhere minute >=date('2023-07-18')and contract_address is nulland symbol = 'ETH'group by 1),tvl as (select hour, sum(eth) over (order by hour) as tvl from (select date_trunc('hour',block_time) as hour, sum(cast(value as double)/1e18) as ethfrom ethereum.traceswhere "to" =0xd19d4B5d358258f05D7B411E21A1460D11B0876FAND (LOWER(call_type) NOT IN ('delegatecall', 'callcode', 'staticcall') or call_type is null)AND success = trueAND block_time>=date('2023-07-18')group by 1union allselect date_trunc('hour',block_time) as hour, sum(cast(value as double)/1e18*-1) as ethfrom ethereum.traceswhere "from" =0xd19d4B5d358258f05D7B411E21A1460D11B0876FAND (LOWER(call_type) NOT IN ('delegatecall', 'callcode', 'staticcall') or call_type is null)AND success = trueAND block_time>=date('2023-07-18')group by 1)a)select a.hour, tvl, tvl*price as tvl_usdfrom tvl aleft join price bon a.hour=b.hourwhere a.hour>=date('2023-03-24')order by 1 desc