elsinaTime Pattern
    Updated 2025-04-11
    with price as (
    select
    date_trunc('day', hour) as date,
    avg(price) as price_usd
    from crosschain.price.ez_prices_hourly
    where
    blockchain = 'ethereum' and
    token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
    group by 1
    ),

    base as (
    SELECT
    block_timestamp,
    from_address,
    tx_hash,
    value as amount,
    amount * price_usd as amount_usd,
    tx_fee
    from ink.core.fact_transactions left join price on block_timestamp::date = date
    where
    tx_succeeded = TRUE and
    block_timestamp::date >= '2024-12-18'
    )

    SELECT
    date_part('hour', block_timestamp) as "Hour",
    case when dayofweek(block_timestamp)=0 then 7 else dayofweek(block_timestamp) end||' - '||dayname(block_timestamp) as "Day Name",
    COUNT(DISTINCT tx_hash) AS tx_count
    FROM base
    GROUP BY 1, 2
    ORDER BY 1,2 asc


    Last run: 11 days ago
    Hour
    Day Name
    TX_COUNT
    1
    01 - Mon155863
    2
    02 - Tue122475
    3
    03 - Wed200355
    4
    04 - Thu156838
    5
    05 - Fri169326
    6
    06 - Sat139864
    7
    07 - Sun138885
    8
    11 - Mon143895
    9
    12 - Tue174208
    10
    13 - Wed193574
    11
    14 - Thu158387
    12
    15 - Fri158293
    13
    16 - Sat143524
    14
    17 - Sun203121
    15
    21 - Mon123942
    16
    22 - Tue138967
    17
    23 - Wed142539
    18
    24 - Thu147920
    19
    25 - Fri143997
    20
    26 - Sat130347
    ...
    168
    4KB
    12s