with klay_price as (
select date_trunc(day,HOUR)::date BLOCK_TIMESTAMP ,
median(PRICE) usd_price
from kaia.price.ez_prices_hourly
where symbol = 'KLAY'
and date_trunc(day,HOUR)::date >='2024-01-01'
group by 1
),
new_users as (
select FROM_ADDRESS,
min (BLOCK_TIMESTAMP)::date date
from kaia.core.fact_transactions
group by 1 having date>='2024-01-01'
)
select date_trunc(week,date)::date weekly ,
count (FROM_ADDRESS) num_new_users ,
sum (num_new_users) over (order by weekly ) cum_new_users
from new_users
group by 1