SleepyInflow & Outflow
    Updated 2023-04-18
    with cex_address as
    (
    select address, project_name from avalanche.core.dim_labels
    where label_type='cex'
    and label_subtype = 'deposit_wallet'
    ),
    -- sending the asset from cex
    cex_outflow as(
    select date_trunc('month', block_timestamp) month,
    project_name,
    count(from_address) as outflow_transactions,
    count(distinct from_address) as outflow_unique_users,
    sum(amount_usd) as outflow_volume_usd
    from avalanche.core.ez_token_transfers transfers
    join cex_address
    on transfers.from_address = cex_address.address
    where block_timestamp::date >= current_date - 365
    group by month, project_name
    order by month, project_name
    ),
    -- sending the asset to cex
    cex_inflow as(
    select date_trunc('month', block_timestamp) month,
    project_name,
    count(to_address) as inflow_transactions,
    count(distinct to_address) as inflow_unique_users,
    sum(amount_usd) as inflow_volume_usd
    from avalanche.core.ez_token_transfers transfers
    join cex_address
    on transfers.to_address = cex_address.address
    where block_timestamp::date >= current_date - 365
    group by month, project_name
    order by month, project_name
    )

    select cex_outflow.month, cex_outflow.project_name,
    Run a query to Download Data