Crazy_KidOrca + Jupiter Volumes 1
    Updated 2022-03-16
    WITH jupiter AS (SELECT swap_program, swap_from_mint,
    CASE WHEN swap_from_mint = 'So11111111111111111111111111111111111111112' THEN 'SOL' END AS swap_from_token,
    swap_to_mint, sum(swap_from_amount) as volume_of_sol_swapped
    FROM solana.swaps
    WHERE date(block_timestamp) >= '2022-01-01' AND succeeded = 'TRUE'
    AND swap_from_amount != 0 AND swap_to_amount != 0
    AND swap_from_mint != swap_to_mint AND swap_program = 'jupiter aggregator v2'
    AND swap_from_mint = 'So11111111111111111111111111111111111111112'
    GROUP BY swap_program, swap_from_mint, swap_to_mint
    ORDER BY volume_of_sol_swapped DESC
    LIMIT 5),

    orca AS (SELECT swap_program, swap_from_mint,
    CASE WHEN swap_from_mint = 'So11111111111111111111111111111111111111112' THEN 'SOL' END AS swap_from_token,
    swap_to_mint, sum(swap_from_amount) as volume_of_sol_swapped
    FROM solana.swaps
    WHERE date(block_timestamp) >= '2022-01-01' AND succeeded = 'TRUE'
    AND swap_from_amount != 0 AND swap_to_amount != 0
    AND swap_from_mint != swap_to_mint AND swap_program = 'orca'
    AND swap_from_mint = 'So11111111111111111111111111111111111111112'
    GROUP BY swap_program, swap_from_mint, swap_to_mint
    ORDER BY volume_of_sol_swapped DESC
    LIMIT 5),

    combined AS (SELECT * FROM jupiter
    UNION ALL
    SELECT * FROM orca),

    labels AS (SELECT address, address_name FROM solana.labels WHERE address IN (SELECT swap_to_mint FROM combined))

    SELECT swap_program, swap_from_token, swap_to_mint, address_name as swap_to_token_name, volume_of_sol_swapped
    FROM combined JOIN labels ON swap_to_mint = address
    ORDER BY swap_program, volume_of_sol_swapped DESC
    Run a query to Download Data