mariyaFTX hourly Inflow_Outflow _Net Flow
    Updated 2022-11-09
    with alamedaftx as (
    select *
    from ethereum.core.dim_labels
    where label ilike 'ftx%' or address_name ilike 'ftx%'), Inflowt as (
    select date_trunc (hour,block_timestamp) as date,
    count (distinct from_address) as Users_Count, sum (amount_usd) as Inflow_Volume
    from ethereum.core.ez_token_transfers
    where to_address in (select distinct address from alamedaftx)
    and from_address not in (select distinct address from alamedaftx)
    and block_timestamp >= '2022-11-01'
    group by 1), Outflowt as (
    select date_trunc (hour,block_timestamp) as date,
    count (distinct to_address) as Users_Count, sum (amount_usd) as Outflow_Volume
    from ethereum.core.ez_token_transfers
    where from_address in (select distinct address from alamedaftx)
    and to_address not in (select distinct address from alamedaftx)
    and block_timestamp >= '2022-11-01'
    group by 1)

    select t1.date, t1.users_count as Inflow_Wallets, t2.users_count as Outflow_Wallets, inflow_volume
    as Inflow, outflow_volume*-1 as Outflow, inflow_volume - outflow_volume
    as Net_Flow, sum (Net_Flow) over (order by t1.date) as Cumulative_Net_Flow
    from Inflowt t1 join Outflowt t2 on t1.date = t2.date
    Run a query to Download Data