ben-wyattpolygon
    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 polygon.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 polygon.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.000410040830046955.278468772Large
    2
    2022-01-01 00:00:00.0001913573172387618121.41982577391Small
    3
    2022-02-01 00:00:00.000385347541266791.19654515Large
    4
    2022-02-01 00:00:00.000137043421797973425.194349762356Small
    5
    2022-03-01 00:00:00.000397033668922583.585549880Large
    6
    2022-03-01 00:00:00.000175970323145250885.452442215978Small
    7
    2022-04-01 00:00:00.000401530877128297.455659769Large
    8
    2022-04-01 00:00:00.000197037026752072599.031164172644Small
    9
    2022-05-01 00:00:00.0004870348024676800.676216199Large
    10
    2022-05-01 00:00:00.000176247037083583333.499563416825Small
    11
    2022-06-01 00:00:00.0003324195538580855.464132701Large
    12
    2022-06-01 00:00:00.000207493128754517294.734262438064Small
    13
    2022-07-01 00:00:00.000248127186309119.937471193Large
    14
    2022-07-01 00:00:00.000191666124677587929.80456235482Small
    15
    2022-08-01 00:00:00.00039714932342777070.69206244Large
    16
    2022-08-01 00:00:00.000191237426294156469.084953611350Small
    17
    2022-09-01 00:00:00.00037876411238271925.19206047Large
    18
    2022-09-01 00:00:00.000186543224243236819.81853336284Small
    19
    2022-10-01 00:00:00.00035092614104195174.3994120Large
    20
    2022-10-01 00:00:00.000310018217428402511.206760101877Small
    72
    5KB
    141s