LTirrell2023-06-12 04:12 PM
    Updated 2023-06-19
    with
    hourly_volume as (
    select
    date_trunc('hour', block_timestamp) as datetime,
    sum(swap_from_amount * p.close) as volume_usd
    from
    solana.core.fact_swaps
    join solana.core.ez_token_prices_hourly p on date_trunc('hour', block_timestamp) = p.recorded_hour
    and swap_from_mint = p.token_address
    where
    succeeded
    and swap_program like 'jupiter%'
    and block_timestamp > current_date - interval '7 day'
    group by
    datetime
    )
    select
    date_trunc('day', datetime) as date,
    sum(volume_usd) as volume_usd
    from
    hourly_volume
    group by
    date
    order by
    date desc
    Run a query to Download Data