justabfjHarmony Total TPM Average
    Updated 2022-07-19
    with tx_min_harmony as (
    select date_trunc('minute', block_timestamp) as minute,
    sum(tx_count) as tpm
    from mdao_harmony.blocks
    where block_timestamp >= {{start_date}}
    group by minute
    ),
    tx_day_harmony as (
    select date_trunc('day', minute) as day,
    avg(tpm) as tpm_daily_avg
    from tx_min_harmony
    group by day
    ),
    tx_month_harmony as (
    select date_trunc('month', day) as month,
    day,
    tpm_daily_avg,
    avg(tpm_daily_avg) over (partition by month) as tpm_monthly_avg
    from tx_day_harmony
    ),
    tx_tpm_harmony_all as (
    select 'HARMONY' as chain,
    month,
    day,
    tpm_daily_avg,
    tpm_monthly_avg
    from tx_month_harmony
    )
    select avg(distinct tpm_monthly_avg) from tx_tpm_harmony_all
    order by month