Query editor
-- with tickers as (-- select-- token_bought_address, token_sold_address-- from query_2279996 -- ethereum uniswap v3 trades-- where cast(lp_addr as VARCHAR) = lower('{{lp address}}')-- group by 1,2-- limit 1-- ),with tickers as (selecttoken_bought_address, token_sold_addressfrom dex.tradeswhere cast(project_contract_address as VARCHAR) = lower('{{lp address}}') and blockchain = 'ethereum'order by block_time desclimit 1),-- token1_buys as (-- select-- token_bought_symbol as token_name,-- sum(amount_usd) as volume_usd,-- date_trunc('day', block_time) as _date,-- 'buy' as action-- from dex.trades-- where token_bought_address = (select token_bought_address from tickers) and token_bought_symbol is not null-- and blockchain = 'ethereum'-- group by 1,3-- ),-- token1_sells as (-- select-- token_sold_symbol as token_name,-- sum(amount_usd) as volume_usd,-- date_trunc('day', block_time) as _date,-- 'sell' as action-- from dex.trades-- where token_sold_address = (select token_bought_address from tickers) and token_sold_symbol is not null-- and blockchain = 'ethereum'-- group by 1,3-- ),token2_buys as (selecttoken_bought_symbol as token_name,sum(amount_usd) as volume_usd,date_trunc('day', block_time) as _date,'buy' as actionfrom dex.tradeswhere token_bought_address = (select token_sold_address from tickers) and token_bought_symbol is not nulland blockchain = 'ethereum'group by 1,3),token2_sells as (selecttoken_sold_symbol as token_name,sum(amount_usd) as volume_usd,date_trunc('day', block_time) as _date,'sell' as actionfrom dex.trades