Query editor
with pool_info as (selectpool.*,token0.symbol token0_symbol,token0.decimals token0_decimals,token1.symbol token1_symbol,token1.decimals token1_decimalsfrom uniswap_ethereum.pools poolinner join (select contract_address,symbol,decimals from tokens.erc20 where blockchain = 'ethereum') token0 on token0.contract_address = pool.token0inner join (select contract_address,symbol,decimals from tokens.erc20 where blockchain = 'ethereum') token1 on token1.contract_address = pool.token1where pool.pool = 0x4b62Fa30Fea125e43780DC425C2BE5acb4BA743b or pool.pool = 0x6A9c4fC2B35EE398e7a0E75D982872466ba93cB8)selectdate_trunc('week',block_date) block_date,sum(case when token_bought_symbol='TONCOIN' then amount_usd else amount_usd end) amount_usd,sum(sum(case when token_bought_symbol='TONCOIN' then amount_usd else amount_usd end)) over( order by date_trunc('week',block_date)) cum_amount_usdfrom dex.tradeswhere (token_bought_symbol = 'TONCOIN' or token_sold_symbol ='TONCOIN' )group by 1