PS0G1ETH Inflow & Outflow & Netflow FROM/TO CEXs
    Updated 2022-12-03
    with cextable as (select * from ethereum.core.dim_labels where label_type ilike 'cex'),
    Inflowt as (
    select date_trunc('day',block_timestamp) as date,
    sum (amount) as Inflow_Volume
    from ethereum.core.ez_eth_transfers
    where eth_to_address in (select distinct address from cextable)
    and eth_from_address not in (select distinct address from cextable)
    and block_timestamp >= '2022-11-01'
    group by 1),

    Outflowt as (
    select date_trunc('day',block_timestamp) as date,
    sum (amount) as Outflow_Volume
    from ethereum.core.ez_eth_transfers
    where eth_from_address in (select distinct address from cextable)
    and eth_to_address not in (select distinct address from cextable)
    and block_timestamp >= '2022-11-01'
    group by 1)


    select t1.date,
    inflow_volume as Inflow,
    outflow_volume*-1 as Outflow,
    inflow_volume - outflow_volume as Net_Flow
    from Inflowt t1 join Outflowt t2 on t1.date = t2.date
    Run a query to Download Data