Query editor
with tmp as(select sum(amount_usd) as total_usd_amount, sum(token_bought_amount) as total_token_amountfrom dex.trades where blockchain = 'bnb' and token_bought_address = 0x6d5ad1592ed9d6d1df9b93c793ab759573ed6714and amount_usd is not null and block_time <= TIMESTAMP '2025-03-13 23:59:59 UTC')select total_usd_amount / total_token_amount as avg_buy_price from tmp