MLDZMNFSR5
    Updated 2022-12-13
    with tbt as (select
    timestamp::date as day,
    token_contract,
    symbol,
    avg (price_usd) as token_price
    from flow.core.fact_prices
    group by 1,2,3),

    tb1 as (select
    date_trunc('{{Time_basis}}', block_timestamp)::date as date,
    sum(AMOUNT*token_price) as volume,
    avg(AMOUNT*token_price) as avg_volume

    from flow.core.ez_token_transfers s left join tbt a on s.block_timestamp::date=a.day and s.TOKEN_CONTRACT=a.TOKEN_CONTRACT
    where block_timestamp >= '2022-01-01'
    and TX_SUCCEEDED='TRUE'
    group by 1),


    tb2 as (select
    date_trunc('{{Time_basis}}',date1) as date,
    'Flow' as blockchain,
    max (count_txn) as TPM_MAX,
    min (count_txn) as TPM_MIN,
    avg (count_txn) as TPM_Average
    from (
    select
    date_trunc('{{TPM_TPS}}', block_timestamp) as date1,
    count(tx_id) as count_txn
    from flow.core.fact_transactions
    where tx_succeeded = 'TRUE'
    and block_timestamp >= '2022-01-01'
    group by 1
    )
    group by 1,2)
    Run a query to Download Data