flyingfishdelete Daily metrics copy
    Updated 2024-04-18
    -- forked from m3ji / Daily metrics @ https://flipsidecrypto.xyz/m3ji/q/OEJ8zRcFufEa/daily-metrics

    WITH axl_price AS (
    select
    --date_trunc(day, HOUR) :: date as date,
    hour as date,
    TOKEN_ADDRESS,
    avg(PRICE) as usd_price
    from
    crosschain.price.ez_hourly_token_prices
    where hour::date BETWEEN '2023-08-21' and '2023-08-23'
    group by
    1,
    2

    -- date_trunc('day', recorded_hour) as day,
    -- avg(price) as usd_price
    -- FROM
    -- osmosis.price.ez_prices
    -- WHERE
    -- symbol = 'AXL'
    -- GROUP BY
    -- 1
    )

    select
    block_timestamp
    , tx_hash
    , sender
    , axl.token_address
    , amount
    , axl.usd_price
    , amount * axl.usd_price as value
    FROM
    axelar.defi.ez_bridge_satellite a
    JOIN axl_price axl ON date_trunc(hour, block_timestamp) = axl.date
    QueryRunArchived: QueryRun has been archived