Query editor
with trade as (select-- distinct projectdate_trunc('week',block_date) as ds,project,tx_id,token_pair,token_bought_symbol,token_sold_symbol,amount_usdfrom dex_solana.tradeswhereblock_date >= current_date - interval '24' hour andamount_usd > 0 andlower(project) in ('bisonfi','humidifi','solfi','tessera','alphaq','goonfi','zerofi','obric','aquifer','whalestreet','scorch'))selecttoken_pair,case-- stable - stable --when lower(token_bought_symbol) like '%usd%' and lower(token_sold_symbol) like '%usd%' then 'stable-stable'-- stable - sol --when lower(token_bought_symbol) like '%usd%' and lower(token_sold_symbol) like '%sol%' then 'stable-SOL'when lower(token_sold_symbol) like '%usd%' and lower(token_bought_symbol) like '%sol%' then 'stable-SOL'-- stable - cbbtc --when lower(token_bought_symbol) like '%usd%' and lower(token_sold_symbol) = 'cbbtc' then 'stable-cbBTC'when lower(token_sold_symbol) like '%usd%' and lower(token_bought_symbol) = 'cbbtc' then 'stable-cbBTC'-- stable - wbtc --when lower(token_bought_symbol) like '%usd%' and lower(token_sold_symbol) = 'wbtc' then 'stable-WBTC'when lower(token_sold_symbol) like '%usd%' and lower(token_bought_symbol) = 'wbtc' then 'stable-WBTC'-- stable - eth --when lower(token_bought_symbol) like '%usd%' and lower(token_sold_symbol) like '%eth%' then 'stable-ETH'when lower(token_sold_symbol) like '%usd%' and lower(token_bought_symbol) like '%eth%' then 'stable-ETH'else 'other'end as token_pair_type,sum(amount_usd) as volfrom tradegroup by 1,2order by 3 desc