hessTotal Daily Swap Volume From ETH
    Updated 2022-11-24
    with eth as ( select 'ETH' as token , date(HOUR) as date, avg(price) as eth_price
    from ethereum.core.fact_hourly_token_prices
    where date >= CURRENT_DATE - {{N_Days}}
    and symbol = 'WETH'
    group by 1,2)

    select 'Swap To Stables' as type, date(block_timestamp) as date, count(DISTINCT(origin_from_address)) as toatl_user,
    count(DISTINCT(tx_hash)) as total_swap, sum(amount_in_Usd) as volume, avg(amount_in_usd) as avg_volume
    from ethereum.core.ez_dex_swaps
    where date >= CURRENT_DATE - {{N_Days}}
    and SYMBOL_IN = 'WETH' and symbol_out in ('USDC','USDT','DAI','BUSD')
    group by 1,2
    UNION
    select 'Swap To Other Tokens' as type, date(block_timestamp) as date, count(DISTINCT(origin_from_address)) as toatl_user,
    count(DISTINCT(tx_hash)) as total_swap, sum(amount_in_Usd) as volume, avg(amount_in_usd) as avg_volume
    from ethereum.core.ez_dex_swaps
    where date >= CURRENT_DATE - {{N_Days}}
    and SYMBOL_IN = 'WETH' and symbol_out not in ('USDC','USDT','DAI','BUSD')
    group by 1,2
    Run a query to Download Data