Hosein-maleki-9555Solana OA 1
    Updated 2022-11-24
    with price_table 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 >= '2022-10-01'
    and succeeded = 'TRUE'
    group by 1,2
    order by day desc
    )
    select
    block_timestamp::date as date,
    count(DISTINCT tx_id) as swaps,
    count(DISTINCT swapper) as swappers,
    sum(swap_from_amount * USDPrice) as usd_volume,
    avg(swap_from_amount * USDPrice) as avg_usd_volume,
    case
    when date >= '2022-11-08' then 'After FTX & Alameda collapse'
    when date < '2022-11-08' then 'Before FTX & Alameda collapse'
    end as timespan
    from solana.core.fact_swaps s join price_table p on s.block_timestamp::date = p.day and s.swap_from_mint = p.token
    where succeeded = 'TRUE'
    and block_timestamp >= '2022-10-01'
    group by date
    order by date desc

    -- select * from solana.core.fact_transfers where tx_id = '4ZtjBmTWTCzEY78iP7Ps7KdNKUB7QM1zDF7duyByKY6G9PnJrJDqq6ush9wYhwGAMEHH6AMjQdDD8Z23ukuLfzjY'

    -- select * from solana.core.fact_transactions where tx_id = '4ZtjBmTWTCzEY78iP7Ps7KdNKUB7QM1zDF7duyByKY6G9PnJrJDqq6ush9wYhwGAMEHH6AMjQdDD8Z23ukuLfzjY'

    -- select * from solana.core.dim_labels where address = 'xxxxa1sKNGwFtw2kFn8XauW9xq8hBZ5kVtcSesTT9fW' limit 10
    Run a query to Download Data