Query editor
selectblock_date as day-- ,tx_from as user_address,count(distinct if(token_bought_symbol = 'ARB',tx_hash,NULL)) AS sell_trades,count(distinct if(token_sold_symbol = 'ARB',tx_hash,NULL)) AS buy_trades,count(distinct tx_hash) AS total_trades,sum(if(token_bought_symbol = 'ARB',token_bought_amount,0)) AS total_bought_token,sum(if(token_sold_symbol = 'ARB',token_sold_amount,0)) AS total_sold_token,sum(if(token_bought_symbol = 'ARB',token_bought_amount,token_sold_amount)) AS total_volume_token -- assumes that, if the bought symbol isn't ARB then the sold symbol is.,sum(if(token_bought_symbol = 'ARB',amount_usd,0)) AS total_bought_usd,sum(if(token_sold_symbol = 'ARB',amount_usd,0)) AS total_sold_usd,sum(amount_usd) AS total_volume_usdFROM dex.tradesWHERE token_pair IS NOT NULLand date('{{airdrop_day}}') - interval '28' day <= block_dateand block_date <= date('{{airdrop_day}}') + interval '28' day-- date('2023-03-14') <= block_date and date_trunc('day',block_date) <= date('2024-06-12')and blockchain = 'arbitrum'and (token_bought_symbol = 'ARB' or token_sold_symbol = 'ARB')AND amount_usd > 0GROUP BY 1-- limit 20