nitinpatel17hsUntitled Query
    Updated 2023-02-03

    with a as
    (
    select date,
    address,
    balance/power(10,6) as balance,
    rank() over (partition by date order by balance/power(10,6) desc) as rnk
    from osmosis.core.fact_daily_balances
    where currency = 'uosmo' and date = date_trunc('month' , date) + interval '1 month' - interval '1 day'
    )
    select a.date as mnth,
    count(distinct case when a.balance > 0 then a.address else null end) as token_holders,
    sum(case when a.rnk <= 100 then a.balance else 0 end)*100.0/(1000000000) as top_100_whales_holding,
    sum(case when a.rnk <= 10 then a.balance else 0 end)*100.0/(1000000000) as top_10_whales_holding
    -- sum(case when a.rnk <= 100 then a.balance else 0 end)*100.0/sum(a.balance) as top_100_whales_holding,
    -- sum(case when a.rnk <= 10 then a.balance else 0 end)*100.0/sum(a.balance) as top_10_whales_holding
    from a
    group by 1
    order by 1


    -- select date_trunc('month' , cast('2021-09-09' as date)) + interval '1 month' - interval '1 day'













    Run a query to Download Data