Alexaysolana swaps
    Updated 2022-11-22
    with pricet as ( select block_timestamp::date as day, swap_from_mint as token, median(swap_to_amount/swap_from_amount) as USDPrice
    from solana.fact_swaps
    where swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB') --USDC,USDT
    and swap_to_amount > 0
    and swap_from_amount > 0
    and block_timestamp >= CURRENT_DATE - 20
    and succeeded = 'TRUE'
    group by 1,2)

    select block_timestamp::date as date, case when date >= '2022-11-08' then 'After FTX' else 'Before FTX' end as type,
    count(distinct tx_id) as swaps, count(distinct swapper) as Swappers, sum(swap_from_amount*usdprice) as USD_Volume
    from solana.core.fact_swaps t1 join pricet t2 on t1.block_timestamp::Date = t2.day and t1.swap_from_mint = t2.token
    where succeeded = 'TRUE'
    and block_timestamp >= CURRENT_DATE - 20
    group by 1,2
    order by 1
    Run a query to Download Data