MLDZMNGASg9
    Updated 2022-11-16
    with tb1 as (select block_timestamp::date as day,
    median (swap_to_amount/swap_from_amount) as price_token
    from solana.fact_swaps
    where swap_from_mint = 'So11111111111111111111111111111111111111112'
    and swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
    and swap_to_amount > 0
    and swap_from_amount > 0
    and succeeded = 'TRUE'
    group by 1)

    select
    SIGNERS[0] as users,
    sum(fee/1e9) as amount,
    sum(fee*price_token/1e9) as amount_usd,
    avg(fee*price_token/1e9) as avg_usd,
    row_number() over (order by amount_usd desc) as rank1
    from solana.core.fact_transactions s left join tb1 b on s.BLOCK_TIMESTAMP::date=b.day
    where BLOCK_TIMESTAMP>=CURRENT_DATE-30
    group by 1
    order by 3 desc limit 10
    Run a query to Download Data