nsa2000Daily amount of ETH swaps for derivatives tokens thereof
    Updated 2022-09-13
    select block_timestamp::date as date, case
    when token = '0xe95a203b1a91a908f9b9ce46459d101078c2c3cb' then 'aETH'
    when token = '0xae78736cd615f374d3085123a210448e74fc6393' then 'rETH'
    when token = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' then 'stETH'
    end as tokens,
    count(distinct origin_from_address) as "unique users",
    count(distinct tx_hash) as "tx numbers",
    sum (case when token = '0xe95a203b1a91a908f9b9ce46459d101078c2c3cb' and amount > 1e6 then (amount / 1e18)
    else amount end) as ETH_amount,
    sum(usd_amount) as "USD amount"
    from
    (
    select
    BLOCK_TIMESTAMP,
    TX_HASH,
    ORIGIN_FROM_ADDRESS,
    TOKEN_IN as token,
    AMOUNT_IN as amount,
    AMOUNT_IN_USD as usd_amount
    from ethereum.core.ez_dex_swaps
    where token_in in ('0xe95a203b1a91a908f9b9ce46459d101078c2c3cb','0xae78736cd615f374d3085123a210448e74fc6393','0xae7ab96520de3a18e5e111b5eaab095312d7fe84')

    union
    select
    BLOCK_TIMESTAMP,
    TX_HASH,
    ORIGIN_FROM_ADDRESS,
    TOKEN_OUT as token,
    AMOUNT_OUT as amount,
    AMOUNT_OUT_USD as usd_amount
    from ethereum.core.ez_dex_swaps
    where token_out in ('0xe95a203b1a91a908f9b9ce46459d101078c2c3cb','0xae78736cd615f374d3085123a210448e74fc6393','0xae7ab96520de3a18e5e111b5eaab095312d7fe84')
    )

    group by 1,2
    Run a query to Download Data