hessMonthly Inflow CEX
    Updated 2023-05-03
    with transaction as ( select trunc(block_timestamp,'month') as date, 'Inflow' as type, tx_hash, tx_receiver as user,project_name, deposit/pow(10,24) as near
    from near.core.fact_transfers a join near.core.dim_address_labels b on a.tx_signer = b.address
    where block_timestamp::date >= '2022-01-01'
    and label_type = 'cex' and tx_receiver not in (select DISTINCT address from near.core.dim_address_labels
    where label_type = 'cex')
    )

    select date, project_name, count(DISTINCT(user)) as users, count(DISTINCT(tx_hash)) as total_tx,
    sum(near) as near_amount, avg(near) as avg_near, median(near) as median_near,
    max(near) as max_near, min(near) as min_near,
    sum(total_tx) over (order by date asc) as cum_tx,
    sum(near_amount) over (partition by project_name order by date asc) as cum_near
    from transaction
    group by 1,2


    Run a query to Download Data