adriaparcerisasavalanche euro 2
    Updated 2025-03-25
    with
    t1 as (
    select trunc(block_timestamp,'week') as date,
    count(distinct tx_hash) as txs,
    sum(txs) over (order by date) as cum_txs,
    count(distinct origin_from_address) as users,
    sum(amount_in) as volume,
    avg(amount_in) as avg_volume,
    avg(avg_volume) over (order by date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW ) as avg_volume_ma_7hour,
    sum(volume) over (order by date) as cum_volume
    from avalanche.defi.ez_dex_swaps
    where token_in = lower('0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD')
    and block_timestamp >= '2023-05-25'
    group by 1
    ),
    t2 as (
    select trunc(block_timestamp,'week') as date,
    count(distinct tx_hash) as txs,
    sum(txs) over (order by date) as cum_txs,
    count(distinct origin_from_address) as users,
    sum(amount_out) as volume,
    avg(amount_out) as avg_volume,
    avg(avg_volume) over (order by date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW ) as avg_volume_ma_7hour,
    sum(volume) over (order by date) as cum_volume
    from avalanche.defi.ez_dex_swaps
    where token_out = lower('0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD')
    and block_timestamp >= '2023-05-25'
    group by 1
    )
    select 'Swapping from EUROC' as type, * from t1 where date<trunc(current_date,'week')
    union select 'Swapping to EUROC' as type, * from t2 where date<trunc(current_date,'week') order by 2 asc ,1



    QueryRunArchived: QueryRun has been archived