Query editor
with------------------------------ Raw Swaps ------------------------------swaps as (selectdate(block_timestamp) as date,tx_hash,swapper,platform,pool_address,token_sold_symbol,token_bought_symbol,token_bought_amount_usd as amount_usd,(token_bought_amount_usd / token_sold_amount_usd) / token_bought_amount_usd * 100 as slippagefromdune.caravanserai.result_starknet_swapswheredate(block_timestamp) >= current_date - interval '90' day),------------------------------ Aggregated Swaps ------------------------------result as (selectdate as "Date",token_bought_symbol as "Symbol",count(distinct tx_hash) as "Swaps",count(distinct swapper) as "Swappers",sum(amount_usd) as "Volume",avg(amount_usd) as "Amount",avg(slippage) as "Slippage"fromswapswheredate < current_dategroup bydate,token_bought_symbol)------------------------------ Result ------------------------------select"Date","Symbol","Swaps","Swappers","Volume","Amount","Slippage",sum("Swappers") over(order by "Date") as "Cumulative Swaps",sum("Volume") over(order by "Date") as "Cumulative Volume",avg("Swaps") over (order by "Date" rows between 7 preceding and current row) as "7D-MA Swaps",avg("Swappers") over (order by "Date" rows between 7 preceding and current row) as "7D-MA Swappers",avg("Volume") over (order by "Date" rows between 7 preceding and current row) as "7D-MA Volume"fromresultorder by"Date" desc,"Volume" desc