with A as(select count(distinct (TRADER)) as users ,count(TX_ID) as tx_count , sum(TO_AMOUNT/1000000) as amount_swaped,
date_trunc('day', block_timestamp) as block_day
from osmosis.core.fact_swaps
where TO_CURRENCY='ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A'
and block_day >= current_date -90
group by block_day
order by block_day desc),
B as(select avg(PRICE) as price ,date_trunc('day',RECORDED_AT) as block_day
from osmosis.core.dim_prices
where SYMBOL='SCRT'
and block_day >= current_date -90
group by block_day
order by block_day)
select A.users ,A.tx_count , A.amount_swaped ,B.price ,A.block_day from A inner join B on A.block_day=B.block_day