superflyUntitled Query
    Updated 2022-11-22
    with MIN1 as (
    select *
    from solana.core.dim_labels
    where label_type ilike '%cex%'),
    Inflowt as (
    select block_timestamp::Date as date,
    sum (amount) as Inflow_Volume
    from solana.core.fact_transfers
    where tx_to in (select distinct address from MIN1)
    and tx_from not in (select distinct address from MIN1)
    and mint = 'So11111111111111111111111111111111111111112'
    and block_timestamp >= CURRENT_DATE - 60 group by 1
    ),

    Outflowt as (
    select block_timestamp::Date as date,
    sum (amount) as Outflow_Volume
    from solana.core.fact_transfers
    where tx_from in (select distinct address from MIN1)
    and tx_to not in (select distinct address from MIN1)
    and mint = 'So11111111111111111111111111111111111111112'
    and block_timestamp >= CURRENT_DATE - 60 group by 1
    )


    select M.date,
    inflow_volume as Inflow,
    outflow_volume*-1 as Outflow,
    inflow_volume - outflow_volume as Net_Flow,
    sum(Inflow )over (order by M.date )cum_inflow,
    sum(outflow) over (order by M.date )cum_outflow
    from Inflowt M join Outflowt W on M.date = W.date
    Run a query to Download Data