select date_trunc('day',block_timestamp) as d1,
avg(msg_value:execute_msg:swap:belief_price) as Orion_price,
count(tx_id) as transaction_numb
from terra.msgs
where msg_value
:contract = 'terra1mxyp5z27xxgmv70xpqjk7jvfq54as9dfzug74m' and msg_value:execute_msg:swap is not null and tx_status='SUCCEEDED'
and block_timestamp > current_date - 90 group by 1 order by d1