Query editor
withbmx_price AS (SELECTdate_trunc('day', evt_block_time) AS day, token, AVG(price / 1e18) AS priceFROM aerodrome_base.PriceFetcher_evt_PriceFetchedWHERE token = 0x548f93779fBC992010C07467cBaf329DD5F059B7GROUP BY 1, 2),_bmx_trades AS (SELECTevt_tx_hash AS tx_hash, evt_index, evt_block_date AS block_date, evt_block_time AS block_time, sender, outputToken AS token_bought_address, inputToken AS token_sold_address, amountOut AS token_bought_amount, inputAmount AS token_sold_amount, NULL AS amount_usd, NULL AS projectFROM odos_v2_base.odosrouterv2_evt_swapWHEREevt_tx_hash IN (SELECT DISTINCT evt_tx_hashFROM odos_v2_base.odosrouterv2_evt_swapWHERE evt_block_date >= current_date - INTERVAL '{{Days}}' DAY -- Use Dune parameterAND (inputToken = 0x548f93779fBC992010C07467cBaf329DD5F059B7 OR outputToken = 0x548f93779fBC992010C07467cBaf329DD5F059B7)))SELECT *FROM _bmx_tradesORDER BY block_time DESC