with algo_labels as(SELECT address, label from algorand.labels
where label_type = 'cex' and label not like '%group%')
SELECT date(block_timestamp) as day,label,sum(amount) as total_vol, count(*) as total_txs, count(distinct receiver) as unique_receivers,
sum(total_vol) over (order by day) as cum_volume, avg(total_vol) over (order by day) as avg_vol
from
(SELECT * from algorand.payment_transaction
inner join algo_labels
on address = sender)
where day < '2022-02-20' and day >= '2022-02-10'
GROUP by 1,2
order by 1