0xtollexBLAST 2
    Updated 2024-05-31
    with price as (
    select
    hour::date as date,
    avg(PRICE) as Avg_Price
    from ethereum.price.ez_hourly_token_prices
    where SYMBOL = 'WETH'
    and HOUR > '2024-02-29'
    group by 1
    )

    SELECT
    -- date_trunc(day, block_TIMESTAMP) as date,
    COUNT(DISTINCT TX_HASH) as txn,
    count(DISTINCT FROM_ADDRESS) as user,
    sum(tx_fee) as Gas_fee,
    SUM(Value) as eth_trading_volume,
    SUM(Value * Avg_price) as Trading_volume_usd,
    Avg (Value * Avg_price) as avg_Trading_volume_usd,
    AVG(tx_fee * Avg_price) as Avg_fee,
    sum(tx_fee * Avg_Price) as amount_usd
    -- SUM(txn) over (order by date) as cumulative_txn,
    --SUM(user) over (order by date) as cumulative_users
    FROM blast.core.fact_transactions t JOIN price p on t.block_timestamp::date = p.date
    WHERE
    STATUS = 'SUCCESS' AND
    block_timestamp::date >= '2024-02-29'
    --GROUP BY 1
    QueryRunArchived: QueryRun has been archived