binhachon6. [Easy] Number of LPs - Percentage
    Updated 2021-10-25
    select blocktime, pool_name,
    case when sum(address) over (partition by blocktime order by blocktime) = 0 then 0 else 100 * address / sum(address) over (partition by blocktime order by blocktime) end as percentage
    from
    (
    select date_trunc('Day', block_timestamp) as blocktime, substr(pool_name,1,3) as pool_name, count(distinct from_address) as address from thorchain.liquidity_actions --lp_action,
    where blocktime > getdate() - interval'30 days'
    and pool_name is not null
    group by blocktime, substr(pool_name,1,3)
    )

    Run a query to Download Data