adriaparcerisasNear report 5
    Updated 2024-12-09
    with

    hourly as (
    select
    trunc(block_timestamp,'hour') as date,
    sum(TRANSACTION_FEE/1e24) as fees,
    sum(fees) over (order by date) as cum_fees,
    avg(TRANSACTION_FEE/1e24) as avg_tx_fee
    from near.core.fact_transactions x
    --join near.price.fact_prices y on trunc(x.block_timestamp,'hour')=trunc(y.timestamp,'hour')
    where x.block_timestamp > getdate() - interval '1 WEEK' --and symbol='wNEAR'
    group by 1
    ),
    daily as (
    select
    trunc(block_timestamp,'day') as date,
    sum(TRANSACTION_FEE/1e24) as fees,
    sum(fees) over (order by date) as cum_fees,
    avg(TRANSACTION_FEE/1e24) as avg_tx_fee
    from near.core.fact_transactions x
    --join near.price.fact_prices y on trunc(x.block_timestamp,'hour')=trunc(y.timestamp,'hour')
    where x.block_timestamp > getdate() - interval '1 MONTH' --and symbol='wNEAR'
    group by 1
    ),
    weekly as (
    select
    trunc(block_timestamp,'week') as date,
    sum(TRANSACTION_FEE/1e24) as fees,
    sum(fees) over (order by date) as cum_fees,
    avg(TRANSACTION_FEE/1e24) as avg_tx_fee
    from near.core.fact_transactions x
    --join near.price.fact_prices y on trunc(x.block_timestamp,'hour')=trunc(y.timestamp,'hour')
    where x.block_timestamp > getdate() - interval '3 MONTHS' --and symbol='wNEAR'
    group by 1
    )
    select * from {{granularity}} where date <trunc(current_date,'hour') order by 1 asc
    QueryRunArchived: QueryRun has been archived