nitsEthereum liquidity over time
    Updated 2022-04-09
    with tvl as (SELECT pool_name, sum(amt_net) as liquidity
    from
    (SELECT *, case when direction = 'IN' then amount_usd else amount_usd *(-1) end as amt_net
    from ethereum.dex_swaps
    where platform = 'sushiswap' and amount_usd is not NULL )
    GROUP by 1
    ORDER by 2 desc
    limit 10 )
    SELECT date(block_timestamp) as day,pool_name, sum(amt_net) as liquidity, sum(liquidity) over (partition by pool_name order by day) as cumulative_liquidity from
    (SELECT *, case when direction = 'IN' then amount_usd else amount_usd*(-1) end as amt_net
    from ethereum.dex_swaps
    where platform = 'sushiswap' and pool_name in (SELECT pool_name from tvl))
    GROUP by 1 ,2

    Run a query to Download Data