select
date_trunc('week', block_timestamp) as "Day",
action as "Actions",
count(distinct tx_id) as "tx count",
count(distinct delegator_address) as "Unique wallet",
sum(amount) as "Volume",
avg(amount) as "AVG volume",
sum("tx count") over (partition by "Actions" order by "Day") as "Cum tx count",
sum("Volume") over (partition by "Actions" order by "Day") as "Cum volume"
from terra.core.ez_staking
where tx_succeeded = 'TRUE'
group by 1, 2
order by 1