Query editor
with trade as(select 'BUY' as type,block_month,block_time,token_pair,token_bought_amount,token_sold_amount,amount_usdfrom dex_solana.tradeswhere token_bought_mint_address = 'J27UYHX5oeaG1YbUGQc8BmJySXDjNWChdGB2Pi2TMDAq'UNION ALLselect 'SELL' as type,block_month,block_time,token_pair,token_bought_amount,token_sold_amount,amount_usdfrom dex_solana.tradeswhere token_sold_mint_address = 'J27UYHX5oeaG1YbUGQc8BmJySXDjNWChdGB2Pi2TMDAq')selectcase when type = 'BUY' then amount_usd / token_bought_amountwhen type = 'SELL' then amount_usd / token_sold_amountEND as pricefrom tradewhere amount_usd is not nullorder by block_time desclimit 1;