maybeyonaseth_rem_uni_lps
    Updated 2022-09-18
    with lp as (
    select
    block_timestamp,
    tx_hash,
    action,
    case
    when token0_symbol = 'WETH' then amount0_adjusted
    when token1_symbol = 'WETH' then amount1_adjusted
    else 'sus' end as amt,
    -- case when amt <0 then 'out' else 'in' end as direction,
    case
    when token0_symbol = 'WETH' then token1_symbol
    when token1_symbol = 'WETH' then token0_symbol
    else 'sus' end as token
    from ethereum.uniswapv3.ez_lp_actions
    where (token0_symbol = 'WETH' or token1_symbol ='WETH')
    )

    select *,
    case when net_vol < 0 then 'out' else 'in' end as direction
    from (
    select
    date(block_timestamp) as date,
    sum(
    case when action='INCREASE_LIQUIDITY' then amt else -amt end
    ) as net_vol
    from lp
    group by 1
    order by date desc
    limit 180
    )
    Run a query to Download Data