MLDZMNdexliq1
    Updated 2023-09-02

    with t1 as (select
    *

    from avalanche.core.dim_labels
    )

    select
    date_trunc('{{Time_basis}}', BLOCK_TIMESTAMP) as date,
    PROJECT_NAME,
    sum(amount_usd) as volume
    from avalanche.core.ez_avax_transfers s
    left join t1 on s.avax_to_address=t1.ADDRESS
    where BLOCK_TIMESTAMP>=current_date-{{Period}}
    and PROJECT_NAME is not null
    and LABEL_TYPE in ('dex')
    and label_subtype not in ('token_contract')
    group by 1,2
    union all
    select
    date_trunc('{{Time_basis}}', BLOCK_TIMESTAMP) as date,
    PROJECT_NAME,
    sum(amount_usd) as volume

    from avalanche.core.ez_token_transfers s
    left join t1 on s.TO_ADDRESS=t1.ADDRESS
    where BLOCK_TIMESTAMP>=current_date-{{Period}}
    and PROJECT_NAME is not null
    and LABEL_TYPE in ('dex')
    and label_subtype not in ('token_contract')
    group by 1,2



    Run a query to Download Data