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