Madimain metrics total
    Updated 2023-04-13
    /*select * from near.core.ez_dex_swaps
    where TOKEN_IN = 'wNEAR' or TOKEN_IN = 'STNEAR'
    limit 1000
    --wNEAR STNEAR NearX */

    select
    date_trunc('week', block_timestamp) as date,
    token_out as token,
    count(DISTINCT tx_hash) as Tx_count,
    count(DISTINCT trader) as unique_traders,
    sum(amount_in) as amount_near,
    avg(amount_in) as avg_amount,
    sum(amount_near) over (order by date) as cumulative_amount,
    sum(Tx_count) over (order by date) as cumulative_swaps,
    sum(unique_traders) over (order by date) as cumulative_traders

    from near.core.ez_dex_swaps
    where token_in = 'wNEAR'
    group by date, token
    Run a query to Download Data