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 = 0x12b4356c65340fb02cdff01293f95febb1512f3band 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