shreexMost popular tokens
    Updated 2023-02-05
    with near_price as (
    select
    date_trunc('day',timestamp) as date_price,
    avg(price_usd) as price
    from near.core.fact_prices where symbol='wNEAR'
    GROUP BY date_price
    )
    select
    token_in,
    count(distinct swap_id) as swaps,
    sum(amount_out) as volume,
    volume*avg(price) as volume_usd,
    count(distinct trader) as traders
    from near.core.ez_dex_swaps left join near_price on date_price=date_trunc('day',block_timestamp)
    WHERE block_timestamp >= current_date - interval '3 months' AND token_out='wNEAR'
    GROUP BY token_in
    ORDER BY volume_usd DESC
    Run a query to Download Data