Query editor
-- Aggregate MOG token transactions by dayWITH mog_transactions AS (SELECTDATE_TRUNC('day', evt_block_time) AS day,COUNT(*) AS transaction_count, -- Count of transactions per daySUM(TRY_CAST(value AS DECIMAL(38, 0))) AS total_value -- Total transaction value per dayFROM moggo_ethereum.MOG_evt_TransferGROUP BY1),-- Using Wrapped ETHer (WETH) to calculate the aveage price of MOG tokenprice_changes AS (SELECTDATE_TRUNC('day', minute) AS day,AVG(price) AS avg_price -- Average price per dayFROM prices.usdWHEREblockchain = 'ethereum' AND symbol = 'WETH'GROUP BY1)-- Combine transaction data with price dataSELECTmt.day,mt.transaction_count,TRY_CAST(mt.total_value / POWER(10, 25) AS DECIMAL(38, 2)) AS total_value,TRY_CAST(pc.avg_price AS DECIMAL(10, 2)) AS avg_priceFROM mog_transactions AS mtJOIN price_changes AS pcON mt.day = pc.day -- Join on the day to align transaction and price dataORDER BYmt.day DESCLIMIT 180 -- Limit results to the last 180 days