kalomichiCurve #2
    Updated 2021-09-19
    with stETH_out as (
    select
    date_trunc('day', block_timestamp) as day1,
    -1*sum(amount_out) as outSum_stETH,
    -1*avg(amount_out) as outAvg_stETH
    from ethereum.dex_swaps
    where pool_name = 'stETH'
    and platform = 'curve'
    and token_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
    and direction = 'OUT'
    group by token_address, direction, pool_name, platform, day1
    order by day1 desc
    limit 30),

    stETH_in as (
    select
    date_trunc('day', block_timestamp) AS day2,
    sum(amount_in) as inSum_stETH,
    avg(amount_in) as inAvg_stETH
    from ethereum.dex_swaps
    where pool_name = 'stETH'
    and direction = 'IN'
    and platform = 'curve'
    and token_address = lower('0xae7ab96520de3a18e5e111b5eaab095312d7fe84')
    group by token_address, direction, pool_name, platform, day2
    order by day2 desc
    limit 30
    ),

    stETH as (
    select * from stETH_out
    left JOIN stETH_in
    on stETH_out.day1 = stETH_in.day2
    ),
    WETH_out as (
    Run a query to Download Data