nitsWithdrawals by Pool over time
    Updated 2022-05-19
    with top_pools as
    (SELECT pool_name, sum(amt_deposits) as total_deposits from
    (SELECT date(block_timestamp) as day, pool_name, case when direction = 'OUT' then amount_usd end as amt_deposits from ethereum.dex_swaps
    where platform = 'sushiswap' and block_timestamp >= CURRENT_DATE -90 and amount_usd is not NULL and amount_usd < pow(10,8))
    where amt_deposits is not NULL
    GROUP by 1
    order by 2 desc
    limit 10 )


    SELECT day, pool_name, sum(amt_deposits) as total_deposits, sum(total_deposits) over (partition by pool_name order by day) as cumulative_deposits
    from
    (SELECT date(block_timestamp) as day, pool_name, case when direction = 'OUT' then amount_usd end as amt_deposits from ethereum.dex_swaps
    where platform = 'sushiswap' and block_timestamp >= CURRENT_DATE -90 and amount_usd is not NULL and amount_usd < pow(10,10))
    where amt_deposits is not NULL and pool_name in (SELECT pool_name from top_pools)
    GROUP by 1 ,2
    Run a query to Download Data