bigbuddynew wallet dex activity
    Updated 2024-03-23
    -- forked from saeedmzn / [new accounts on base] swaps @ https://flipsidecrypto.xyz/saeedmzn/q/2k67uBHHKphU/new-accounts-on-base-swaps

    with

    new_accounts as (
    select
    FROM_ADDRESS ,
    min (BLOCK_TIMESTAMP) as min_date
    from ethereum.core.fact_transactions
    -- from base.core.fact_transactions
    group by 1
    -- having min_date >= current_date - (7*3)
    having min_date >= dateadd('day', -(7*104), current_date)
    ),

    swaps as (
    select
    BLOCK_TIMESTAMP::date as swap_date ,
    sender,
    count (DISTINCT tx_hash) as num_transactions ,
    -- sum (num_transactions) over (order by swap_date) as cum_trades,
    -- count (DISTINCT sender) as num_traders
    from ethereum.defi.ez_dex_swaps
    -- from base.defi.ez_dex_swaps
    where SENDER in (select FROM_ADDRESS from new_accounts )
    -- and block_timestamp >= current_date - (7*3)
    and block_timestamp >= dateadd('day', -(7*104), current_date)
    group by 1, 2
    ),

    joined as (
    select *
    from new_accounts
    left join swaps
    on new_accounts.from_address = swaps.sender
    and swaps.swap_date >= new_accounts.min_date
    QueryRunArchived: QueryRun has been archived