Query editor
WITH price_feed AS (-- 1. Fetch live HYPE priceSELECT MAX(price) as priceFROM prices.latestWHERE blockchain = 'hyperevm'AND symbol = 'HYPE'),config AS (-- 2. Use that priceSELECT price as token_price FROM price_feed),combined_daily AS (-- V2 FeesSELECT DATE_TRUNC('day', evt_block_time) as day, SUM(grossBet - netBet) as daily_feesFROM hypesino_hyperevm.hypesinov2_evt_spinrequestedGROUP BY 1UNION ALL-- V1 FeesSELECT DATE_TRUNC('day', evt_block_time) as day, SUM(grossBet - netBet) as daily_feesFROM hypesino_v1_hyperevm.slotmachine5_evt_spinrequestedGROUP BY 1),aggregated_daily AS (SELECT day, SUM(daily_fees) as total_daily_feesFROM combined_dailyGROUP BY 1)SELECTday as "Date",-- Calculate Cumulative Sum using a Window Function and Live Price(SUM(CAST(total_daily_fees AS DOUBLE)) OVER (ORDER BY day ASC) / 1e18) * c.token_price as "Cumulative Fees ($)"FROM aggregated_daily, config cORDER BY 1 DESC