Query editor
withaevo_base as (select * from query_2660871),token_balances_data as (selectdate_trunc('week',a.evt_block_time) as date,a.symbol,sum(sum(case when action = 'deposit' then tokenselse -tokens end)) over(partition by a.symbolorder by date_trunc('week',evt_block_time)) as current_bal,sum(sum(case when action = 'deposit' then tokenselse -tokens end)) over(partition by a.symbolorder by date_trunc('week',evt_block_time))*price as current_bal_usd,sum(case when action = 'deposit' then usdelse 0 end) as deposit_vol,sum(case when action = 'deposit' then 0else -usd end) as withdrawal_volfrom aevo_base ajoin prices.usd pon date_trunc('week',a.evt_block_time) = p.minuteand a.symbol = p.symboland p.blockchain = a.blockchain-- where symbol = 'USDC'group by 1,2,priceorder by 1 desc, 2 desc),days AS (with days_seq as (SELECTsequence((date('2023-03-13')),date_trunc('day', cast(now() as timestamp)),interval '7' day) as day)SELECTdays.day as dateFROM days_seqCROSS JOIN unnest(day) as days(day) --this is just doing explode like in spark sql),daily_fillers as (select * from days d cross join (select distinct symbol from token_balances_data) p),overall_balances as (select