Query editor
WITH daily_stats AS (SELECTDATE_TRUNC('day', block_time) AS date,COUNT(DISTINCT token_pair) as active_pairs,-- what PNUT is being traded againstSUM(CASEWHEN token_bought_mint_address = '2qEHjDLDLbuBgRYvsxhc5D6uDWAivNFZGan56P1tpump'THEN token_bought_amount_raw/POWER(10,9) -- convert raw units into the standard token unitsWHEN token_sold_mint_address = '2qEHjDLDLbuBgRYvsxhc5D6uDWAivNFZGan56P1tpump'THEN token_sold_amount_raw/POWER(10,9)END) AS pnut_volume,SUM(amount_usd) as volume_usdFROM dex_solana.tradesWHERE (token_bought_mint_address = '2qEHjDLDLbuBgRYvsxhc5D6uDWAivNFZGan56P1tpump'OR token_sold_mint_address = '2qEHjDLDLbuBgRYvsxhc5D6uDWAivNFZGan56P1tpump')AND block_time >= TIMESTAMP '2023-10-31' -- beginning of PNUT meme coinGROUP BY DATE_TRUNC('day', block_time))SELECTdate AS "Date",active_pairs AS "Active Trading Pairs",pnut_volume AS "PNUT Trading Volume",volume_usd AS "Volume in USD"FROM daily_statsORDER BY date ASC