nickpayiatis_TX_last_90_days_Algorand
    Updated 2022-12-13

    SELECT distinct tx_sender as user_address,
    count(*) n_txn, --this is transactions a wallet has sent(does not include wallet as a receiver)

    count(DISTINCT date_trunc('DAY', block_timestamp) ) as n_days_active,

    MIN(DATEDIFF('days', block_timestamp, CURRENT_TIMESTAMP)) AS days_since_last_txn,
    SUM(
    case when tx_type <> 'pay' THEN 1
    ELSE 0 end) as n_non_transfer_interactions_daterange,

    count(distinct app_id) as n_contracts
    FROM algorand.core.fact_transaction t
    join algorand.core.dim_transaction_type tt on t.DIM_TRANSACTION_TYPE_ID =tt.DIM_TRANSACTION_TYPE_ID
    where date_trunc('DAY', block_timestamp) >= DATEADD('day',-{{metric_days}},CURRENT_DATE())
    GROUP BY tx_sender
    order by n_days_active desc


    /*n_txn
    n_days_active
    days_since_last_txn
    n_complex_txn
    n_contracts*/
    Run a query to Download Data