geektechSol Perps - Program TX and Users copy copy
    Updated 2024-07-18
    -- forked from banbannard / Sol Perps - Program TX and Users copy @ https://flipsidecrypto.xyz/banbannard/q/6aCkIEkQO8ko/sol-perps---program-tx-and-users-copy

    -- forked from Sol Perps - Program TX and Users @ https://flipsidecrypto.xyz/edit/queries/0ea71774-67c1-4c4d-80c0-647ed2cf766a

    with base as (select
    block_timestamp,
    tx_id,
    program_id,
    signers[0] as wallet_address,
    from solana.core.fact_events
    where succeeded = 'TRUE'
    --and program_id in ('sharpwLgpgdjgky2RMntZxR1LHuE6hnzwzUXpMsbUy4')
    and block_timestamp >= '2024-07-17')

    -- jupiter perps and flash trade do not have limit orders, so the tx count is lower
    -- zeta and drift have limit orders

    select
    date_trunc('week',block_timestamp) as date,
    program_id,
    count(distinct(tx_id)) as tx_count,
    count(distinct(wallet_address)) as user_count
    from base
    group by 1,2
    order by 3 desc




    QueryRunArchived: QueryRun has been archived