Query editor
--select * from dex.trades where token_pair = 'GMX-WETH' and taker =0x4829f3bbd5508707339547ebefface2b4c86d3b5 or maker=0x4829f3bbd5508707339547ebefface2b4c86d3b5with tmp as (selectdate_trunc('day', block_time) as dt,token_pair,sum(amount_usd) as amount_usd,count(distinct taker) as taker_cnt,count(distinct maker) as maker_cnt,count(distinct tx_hash) as tx_cnt,count(distinct project) as dex_cntfromdex.tradeswhereblockchain = 'arbitrum'and block_time >= now() - interval '30' daygroup by 1,2)select*,sum(amount_usd) over(partition by token_pair order by dt asc) as total_amount_usd,avg(amount_usd) over(partition by token_pair order by dt rows between 6 preceding and current row ) as amount_usd_7d_ma,(amount_usd - avg(amount_usd) over(partition by token_pair order by dt rows between 6 preceding and current row ))/avg(amount_usd) over(partition by token_pair order by dt rows between 6 preceding and current row ) as delta_amt_usd_vs_7dma,sum(tx_cnt) over(partition by token_pair order by dt asc) as total_txs,avg(tx_cnt) over(partition by token_pair order by dt rows between 6 preceding and current row ) as amount_tx_7d_ma,(tx_cnt - avg(tx_cnt) over(partition by token_pair order by dt rows between 6 preceding and current row ))/avg(tx_cnt) over(partition by token_pair order by dt rows between 6 preceding and current row ) as delta_amt_tx_vs_7dmafrom tmporder by dt desc, taker_cnt desc