superflyUntitled Query
    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 ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDav','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
    and swap_to_amount > 0
    and swap_from_amount > 0
    and block_timestamp >='2022-10-01'
    and succeeded = 'TRUE'
    group by 1,2)

    select block_timestamp::date as date,
    case when day <'2022-11-08 ' then 'Before FTX' when day >= '2022-11-08' then 'After FTX' end as period,
    count (distinct tx_id) as NUBMER_OF_SWAPS,
    count (distinct swapper) as NUMBER_OF_USERS,
    sum (swap_from_amount*usdprice) as TOTAL_VOLUME_USD,
    avg (swap_from_amount*usdprice) as AVG_USD_Volume
    from solana.core.fact_swaps W
    join pricet Q on W.block_timestamp::Date = Q.day and W.swap_from_mint = Q.token
    where succeeded = 'TRUE'
    and block_timestamp >= '2022-10-01'
    group by 1,2
    order by 1
    Run a query to Download Data