binhachon14. [Hard] Pool Stats - Max liquidity
    Updated 2021-11-07
    with pool_stats as (
    select day,
    case when position('-', pool_name, 1) = 0 then pool_name else
    substr(pool_name, 1, position('-', pool_name, 1) - 1) end as pool_name,
    rune_liquidity*2*rune_price_usd as liquidity,
    swap_volume_rune_usd,
    swap_count,
    total_swap_fees_usd,
    total_swap_fees_usd/swap_volume_rune_usd * 1000 as fee_per_1000_swapped
    from thorchain.daily_pool_stats
    )
    select pool_name, max(liquidity) as max_liquidity, sum(swap_volume_rune_usd), sum(swap_count), sum(total_swap_fees_usd) from pool_stats
    group by pool_name
    order by max_liquidity desc
    Run a query to Download Data