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 / pow(10, decimal)) as "Volume",
avg(amount / pow(10, decimal)) 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 osmosis.core.fact_staking
where
tx_succeeded = TRUE and
currency = 'uosmo'
group by 1, 2
order by 1