with algo_price as (
select date(BLOCK_HOUR) as day, avg(PRICE_USD) as average_algo_price
from flipside_prod_db.algorand.prices_swap
where ASSET_NAME='ALGO'
group by day
)
,
algo_dex_app_call as (
select * from flipside_prod_db.algorand.application_call_transaction
where APP_ID in (354073718,354073834)
or TX_GROUP_ID in (select TX_GROUP_ID from flipside_prod_db.algorand.application_call_transaction
where APP_ID in (354073718,354073834))
)
select t1.day ,average_algo_price ,total_number_of_app_call
from (
select date(BLOCK_TIMESTAMP) as day,count(distinct TX_ID) as total_number_of_app_call
from algo_dex_app_call
group by day
)
as t1 join algo_price as t2
on t1.day=t2.day
order by day