elsinajolly-violet
    Updated 2024-07-25
    with hourly_prices as (
    select
    date_trunc('day', hour) as d,
    avg(price) as avg_price
    from crosschain.price.ez_prices_hourly
    where symbol = 'OLAS'
    and blockchain = 'ethereum'
    group by d
    )
    -- ,
    -- transactions_with_prices as (
    select
    block_timestamp,
    t.tx_hash,
    t.origin_from_address,
    t.olas_amount * p.avg_price as volume_in_usd
    from crosschain.olas.ez_olas_locking t
    join hourly_prices p on block_timestamp::date = p.d
    -- )

    -- SELECT
    -- COUNT(DISTINCT tx_hash) AS total_transaction_count,
    -- COUNT(DISTINCT origin_from_address) AS unique_buyer_count,
    -- SUM(volume_in_usd) AS total_transaction_volume
    -- FROM
    -- transactions_with_prices
    -- WHERE
    -- block_timestamp::date = current_date - interval '1 day'



    QueryRunArchived: QueryRun has been archived