select
sum(s.price_usd) as usd_vol,
count(s.tx_hash) as num_sales,
count(distinct s.tx_hash) as distinct_sales,
avg(p.price) as avg_cur_price,
s.currency_symbol
-- ,currency_address
from
ethereum.core.ez_nft_sales s
full outer join ethereum.core.fact_hourly_token_prices p
on p.symbol = s.currency_symbol
WHERE s.event_type = 'sale'
AND s.block_timestamp::DATE between '2022-12-01' and '2022-12-31'
AND p.hour::DATE between '2022-12-01' and '2022-12-31'
and price_usd is not null
group by
s.currency_symbol
-- , currency_address
order by usd_vol desc
limit 5