mlhswap amounts
    Updated 2022-06-07
    with top_swaps as (
    Select
    date_trunc('day', block_timestamp) as date,
    SWAP_FROM_MINT,
    SWAP_TO_MINT,
    sum(iff(swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
    or swap_from_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'
    or swap_from_mint = '9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i',
    swap_from_amount,
    swap_to_amount)) as swapamount
    From
    Solana.fact_swaps
    Where
    block_timestamp::date >= '2022-04-30' And
    succeeded = 'True' and
    swap_program = 'orca' and
    (swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
    or swap_from_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'
    or swap_from_mint = '9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i') and
    SWAP_FROM_AMOUNT>0 and
    SWAP_TO_AMOUNT>0 and
    SWAP_FROM_MINT != SWAP_TO_MINT
    Group by date, SWAP_FROM_MINT, SWAP_TO_MINT
    order by swapamount desc
    ) ,top_with_label as (select
    ROW_NUMBER() OVER (PARTITION BY date ORDER BY swapamount DESC) as cnt,
    date,
    swapamount,
    concat(a.label,' to ' ,b.label) as "label"
    from top_swaps,solana.dim_labels as a,solana.dim_labels as b
    where a.address=SWAP_FROM_MINT and b.address=SWAP_TO_MINT
    order by swapamount desc
    ) (
    select * from top_with_label where cnt < 6
    Run a query to Download Data