MLDZMNuni2
    Updated 2023-05-22
    with tb1 as(SELECT
    *
    from ethereum.core.dim_labels
    where label_type='cex'
    ),

    tb2 as(SELECT
    *
    from ethereum.core.dim_labels
    where label_type='dex'
    ),

    t1 as (select
    date_trunc('week',BLOCK_TIMESTAMP) as date,
    count(distinct tx_hash) as no_transfer,
    count(distinct Origin_FROM_ADDRESS) as no_sender,
    sum(amount) as Uni_volume,
    sum(AMOUNT_USD) as total_volume,
    avg(AMOUNT_USD) as avg_volume,
    median(AMOUNT_USD) as median_volume,
    sum(total_volume) over (order by date) as cum_volume
    from ethereum.core.ez_token_transfers
    where TO_address in (select ADDRESS from tb1)
    and FROM_ADDRESS in (select ADDRESS from tb2)
    and SYMBOL = 'UNI'
    and BLOCK_TIMESTAMP>= '{{Start_date}}'
    group by 1
    ),

    t2 as (
    select
    date_trunc('week',BLOCK_TIMESTAMP) as date,
    count(distinct tx_hash) as no_transfer,
    count(distinct Origin_FROM_ADDRESS) as no_sender,
    sum(amount) as Uni_volume,
    sum(AMOUNT_USD) as total_volume,
    Run a query to Download Data