Afonso_DiazUntitled Query
    Updated 2023-02-05
    with
    t1 as (
    select
    swapper as trader,
    swap_to_mint,
    swap_from_amount as amount_sol,
    swap_to_amount as swap_amount,
    swap_from_amount / swap_to_amount as token_price_sol
    from solana.core.fact_swaps
    where swap_from_mint = 'So11111111111111111111111111111111111111112'
    and not swap_to_amount = 0
    and block_timestamp > current_date - 90
    ),

    t2 as (
    select
    trader,
    swap_to_mint,
    sum(amount_sol) as volume_swap_sol,
    sum(amount_sol * token_price_sol) / sum(amount_sol) as avg_price_sum
    from t1
    where not amount_sol = 0
    group by 1, 2
    ),

    t3 as (
    select
    swapper,
    swap_from_mint,
    swap_from_amount as amount_sol,
    swap_to_amount as swap_amount,
    swap_to_amount / swap_from_amount as token_price_sol
    from solana.core.fact_swaps
    where swap_to_mint = 'So11111111111111111111111111111111111111112'
    and not swap_from_amount = 0
    and block_timestamp > current_date - 90
    Run a query to Download Data