hbd1994Swap Activity | Swap From Status
    Updated 2022-09-13
    (with tab2 as (with tab1 as (select case when amount_out_usd is null then amount_out/1e18
    else amount_out end as correct_amount, *
    from ethereum.core.ez_dex_swaps
    where TOKEN_out in ('0xe95a203b1a91a908f9b9ce46459d101078c2c3cb')),
    price as
    (select date_trunc('day',hour::date) as "Date", avg(price) as daily_price
    from ethereum.core.fact_hourly_token_prices
    where TOKEN_ADDRESS = '0xe95a203b1a91a908f9b9ce46459d101078c2c3cb'
    group by 1)
    select case when amount_out_usd is null then correct_amount*daily_price else amount_out_usd end as usd_correct,*
    from tab1
    inner join price on "Date"=block_timestamp::date)

    Select
    'aETH' as "Token",
    count(*) as "Number of Swaps From",
    sum(correct_amount) as "Swaps From Volume",
    sum(usd_correct) as "Swaps From Volume (USD Scale)",
    count(distinct ORIGIN_FROM_ADDRESS) as "Number of Swappers",
    count(distinct TOKEN_IN) as "Number of Tokens that were Swapped Into"
    from tab2
    order by 1

    )

    union

    (with tab as (select case
    when token_out = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' then 'stETH'
    end as token_symbol , *
    from ethereum.core.ez_dex_swaps
    where TOKEN_out in ('0xae7ab96520de3a18e5e111b5eaab095312d7fe84')-- 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 --> stETH
    )

    Select
    Run a query to Download Data