SpiltadavidDistribution Cex transfer volume before the FTX crisis
    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 >= '2022-11-01'
    and succeeded = 'TRUE'
    group by 1,2),

    cex as (
    SELECT
    label,
    address
    FROM solana.dim_labels
    WHERE label_type LIKE 'cex'),
    Inflowt as (
    select block_timestamp::date as date,
    sum (amount*USDPrice) as Inflow_Volume
    from solana.core.fact_transfers t1 join pricet t2 on t1.block_timestamp::date = t2.day and t1.mint = t2.token
    where tx_to in (select distinct address from cex)
    and tx_from not in (select distinct address from cex)
    and block_timestamp < '2022-11-08'
    and BLOCK_TIMESTAMP::date >= '2022-11-01'
    group by 1),

    Outflowt as (
    select block_timestamp::Date as date,
    sum (amount*USDPrice) as Outflow_Volume
    from solana.core.fact_transfers t1 join pricet t2 on t1.block_timestamp::date = t2.day and t1.mint = t2.token
    where tx_from in (select distinct address from cex)
    and tx_to not in (select distinct address from cex)
    and block_timestamp < '2022-11-08'
    Run a query to Download Data