Updated 2025-02-07
    -- forked from unit-query @ https://flipsidecrypto.xyz/studio/queries/54460826-0a26-461a-b81d-22a6d8da4cb8

    --this combines the ez_native_transfer and the ez_token_transfer tables together
    --grabs the amount_usd values and does a little bit of by-row analysis


    SELECT
    DATE_TRUNC('month', block_timestamp) AS rounded_month,
    COUNT(DISTINCT from_address) AS unique_users,
    SUM(amount_usd) AS tx_vol_usd,
    COUNT(*) AS tx_count,
    CASE
    WHEN amount_usd > 100000 THEN 'Large'
    ELSE 'Small'
    END AS transaction_size
    FROM (
    SELECT
    block_timestamp,
    from_address,
    amount_usd
    FROM bsc.core.ez_token_transfers
    WHERE block_timestamp BETWEEN '2022-01-01' AND '2024-12-31'
    UNION ALL
    SELECT
    block_timestamp,
    from_address,
    amount_usd,
    FROM bsc.core.ez_native_transfers
    WHERE block_timestamp BETWEEN '2022-01-01' AND '2024-12-31'
    ) AS combined_transfers
    where amount_usd < 1e9
    GROUP BY
    rounded_month,
    transaction_size
    Last run: about 1 month ago
    ROUNDED_MONTH
    UNIQUE_USERS
    TX_VOL_USD
    TX_COUNT
    TRANSACTION_SIZE
    1
    2022-01-01 00:00:00.000244511237332827285.77186990Large
    2
    2022-01-01 00:00:00.000842336082312037196.8349229847156Small
    3
    2022-02-01 00:00:00.00019834806405584589.756149428Large
    4
    2022-02-01 00:00:00.000683832858096161475.1769187931331Small
    5
    2022-03-01 00:00:00.000262454958963815502181285Large
    6
    2022-03-01 00:00:00.000721621661236022573.5705184887784Small
    7
    2022-04-01 00:00:00.000262984231854662231.23175963Large
    8
    2022-04-01 00:00:00.000714235270854452224.1389172572540Small
    9
    2022-05-01 00:00:00.00016900497573140553.005121644Large
    10
    2022-05-01 00:00:00.000645568665010066188.4042150908192Small
    11
    2022-06-01 00:00:00.0009700162766713154.68764092Large
    12
    2022-06-01 00:00:00.000516441434252947895.692117400025Small
    13
    2022-07-01 00:00:00.000168831530276791479.8201464Large
    14
    2022-07-01 00:00:00.000505851630108463369.32102080855Small
    15
    2022-08-01 00:00:00.00013938822482531673.3140743Large
    16
    2022-08-01 00:00:00.000483380231333999677.217196361848Small
    17
    2022-09-01 00:00:00.0007850505842135580.17563291Large
    18
    2022-09-01 00:00:00.000477340221351661520.694184391847Small
    19
    2022-10-01 00:00:00.0008316371071191034.93550504Large
    20
    2022-10-01 00:00:00.000593313220317890810.872685472643Small
    72
    5KB
    183s