ben-wyattpolygon-tx-value-graph
    Updated 2025-01-27
    -- forked from Avalanche-tx-value-graph @ https://flipsidecrypto.xyz/studio/queries/8133a2f0-f254-4096-b62e-2e369ad89ebb

    -- grabs transactions, joins on hourly price data
    -- "Large" transactions are > $100k
    -- Make sure to check what the token of account for the fact_transactions.value column is.
    WITH transaction_data AS (
    SELECT
    value as native_value,
    block_timestamp,
    DATE_TRUNC('hour', block_timestamp) AS rounded_hour,
    from_address
    FROM
    polygon.core.fact_transactions
    WHERE
    block_timestamp BETWEEN '2022-01-01' AND '2024-12-31 23:59:59'
    ),
    price_data AS (
    SELECT
    symbol,
    price,
    hour
    FROM
    polygon.price.ez_prices_hourly
    WHERE
    optimism.core.fact_transactions
    hour BETWEEN '2022-01-01' AND '2024-12-31 23:59:59'
    ),
    transactions_with_prices AS (
    SELECT
    t.native_value,
    t.rounded_hour,
    t.from_address,
    p.price,
    t.native_value * COALESCE(p.price, 0) AS usd_value,
    DATE_TRUNC('month', t.rounded_hour) AS rounded_month,
    CASE
    Last run: 3 months ago
    TRANSACTION_MONTH
    TRANSACTION_SIZE
    TX_VALUE_USD
    TX_VALUE_NATIVE
    TX_COUNT
    UNIQUE_USERS
    1
    2022-01-01 00:00:00.000Large2867529037.09211456746140.243728092933
    2
    2022-01-01 00:00:00.000Small2994000029.302161545588152.330042008206942349302
    3
    2022-02-01 00:00:00.000Large3020300079.258711765790653.127715562702
    4
    2022-02-01 00:00:00.000Small2677978694.662321613129491.651181729086161897998
    5
    2022-03-01 00:00:00.000Large1363055295.03905892432744.7749643314538
    6
    2022-03-01 00:00:00.000Small2030210963.406751321891551.505261764997042347593
    7
    2022-04-01 00:00:00.000Large1199452757.81016855755743.9462013250488
    8
    2022-04-01 00:00:00.000Small1943274255.734741371572351.204481961374542532947
    9
    2022-05-01 00:00:00.000Large1938781581.585822408202852.092325502661
    10
    2022-05-01 00:00:00.000Small1911448051.303752410101404.622851941483282337510
    11
    2022-06-01 00:00:00.000Large943538492.2969371877023071.340232840372
    12
    2022-06-01 00:00:00.000Small1271212001.898112555970650.545381795859562444328
    13
    2022-07-01 00:00:00.000Large1436944654.840292035874232.49133946395
    14
    2022-07-01 00:00:00.000Small1750408645.330712477453909.653361697836902254950
    15
    2022-08-01 00:00:00.000Large2452972928.488192826363683.100277860578
    16
    2022-08-01 00:00:00.000Small1910588436.43122187581059.031341796728962418328
    17
    2022-09-01 00:00:00.000Large1414212640.840271699183751.943593490455
    18
    2022-09-01 00:00:00.000Small1496308348.243141823613915.909041627255982920830
    19
    2022-10-01 00:00:00.000Large834429305.336573980741197.0779272238337
    20
    2022-10-01 00:00:00.000Small1407182082.215951659553547.808571620141985892593
    72
    6KB
    235s