with SCRTpricet as (
select recorded_at::date as day,
avg (price) as SCRTPrice
from osmosis.core.dim_prices
where symbol = 'SCRT'
and recorded_at >= CURRENT_DATE - 7
group by 1)
select from_currency,
project_name,
count (distinct tx_id) as Swaps_Count,
count (distinct trader) as Swappers_Count,
sum ((to_amount/1e6)*SCRTPrice) as USD_Volume
from osmosis.core.fact_swaps t1 join SCRTPricet t2 on t1.block_timestamp::date = t2.day
full outer join osmosis.core.dim_labels t3 on t1.from_currency = t3.address
where to_currency = 'ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A'
and block_timestamp >= CURRENT_DATE - 7
and tx_status = 'SUCCEEDED'
group by 1,2
order by 3 DESC
limit 5