nasdfajskljweak-pink
    Updated 2024-09-14
    with data as (
    select
    DATEADD(
    minute,
    FLOOR(DATE_PART(minute, block_timestamp) / 15) * 15,
    DATE_TRUNC('hour', block_timestamp)
    ) AS rounded_timestamp
    ,swap_to_mint as token
    ,swap_from_amount_usd as usd
    from solana.defi.ez_dex_swaps
    where 1=1
    and swap_to_mint='FiVKJ5CJv6VZWAMdzt5vm6gU4WS3cQKKczWpQyeRFuCT'

    UNION ALL

    select
    DATEADD(
    minute,
    FLOOR(DATE_PART(minute, block_timestamp) / 15) * 15,
    DATE_TRUNC('hour', block_timestamp)
    ) AS rounded_timestamp
    ,swap_from_mint
    ,swap_to_amount_usd as usd
    from solana.defi.ez_dex_swaps
    where 1=1
    and swap_from_mint='FiVKJ5CJv6VZWAMdzt5vm6gU4WS3cQKKczWpQyeRFuCT'
    )

    select
    rounded_timestamp as rounded_time
    ,token
    ,sum(usd) as usd
    from data
    group by rounded_timestamp, token
    order by rounded_timestamp
    QueryRunArchived: QueryRun has been archived