saeedmznSolana Protocol Feature -- swap from/to SOL USDC
    Updated 2022-07-13
    with sol_from as (
    select
    date_trunc(week,BLOCK_TIMESTAMP) as date ,
    count (DISTINCT tx_id) as num_swaps ,
    sum(SWAP_FROM_AMOUNT) as volume ,
    sum (volume) over (order by date) as cum_volume
    from solana.core.fact_swaps join solana.core.dim_labels
    on ADDRESS = SWAP_FROM_MINT
    where SWAP_PROGRAM = 'raydium v4'
    and SUCCEEDED = true
    and SWAP_FROM_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'--usdc
    group by 1
    ),
    sol_to as (
    select
    date_trunc(week,BLOCK_TIMESTAMP) as date ,
    count (DISTINCT tx_id) as num_swaps ,
    sum(SWAP_TO_AMOUNT) as volume ,
    sum (volume) over (order by date) as cum_volume
    from solana.core.fact_swaps join solana.core.dim_labels
    on ADDRESS = SWAP_TO_MINT
    where SWAP_PROGRAM = 'raydium v4'
    and SUCCEEDED = true
    and SWAP_TO_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' --usdc
    group by 1
    )
    select 'swap_from' as type , date , num_swaps , volume,cum_volume from sol_from
    UNION
    select 'swap_to' as type , date , num_swaps , volume,cum_volume from sol_to

    Run a query to Download Data