Sleepymean&median inflow
    Updated 2023-04-19
    with cex_address as
    (
    select address, project_name from avalanche.core.dim_labels
    where label_type='cex'
    and label_subtype = 'deposit_wallet'
    )

    select month,
    project_name,
    avg(amount_usd) average_inflow_transfer_USD ,
    median(amount_usd) median_inflow_transfer_USD
    from(
    select
    date_trunc('month', block_timestamp) month,
    project_name,
    to_address,
    amount_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 and amount_usd is not null
    ) x
    group by x.month, project_name
    order by x.month, project_name


    Run a query to Download Data