Query editor
-- How many swaps per week, and what are the total volumes of these swaps (in USD) for USDC/WETH?-- contract address: 0xb4e16d0168e52d35cacd2c6185b44281ec28c9dcwith frequency as (selectcount(*), date_trunc('week', evt_block_time)from uniswap_v2_ethereum.Pair_evt_Swapwhere contract_address = 0xb4e16d0168e52d35cacd2c6185b44281ec28c9dcand year(evt_block_time) >= 2023group by 2order by 2 desc)with volume as (with base as (selectdate_trunc('minute', s.evt_block_time) as time, case when cast(amount0Out as double) = 0 then p.token1 else p.token0 end as token_bought_address, case when cast(amount0Out as double) = 0 then cast(amount1Out as double) else cast(amount0Out as double) end as token_bought_amount_rawfrom uniswap_v2_ethereum.Pair_evt_Swap sleft join uniswap_v2_ethereum.Factory_evt_PairCreated pon p.pair = s.contract_addresswhere s.contract_address = 0xb4e16d0168e52d35cacd2c6185b44281ec28c9dcand year(s.evt_block_time) >= 2023)selectdate_trunc('week', b.time) as week-- , token_bought_address, sum(token_bought_amount_raw / pow(10, COALESCE(t.decimals, 18)) * p.price) as total_usd_amountfrom base bleft join tokens.erc20 ton t.contract_address = b.token_bought_addressleft join prices.usd pon p.minute = b.time and p.blockchain = 'ethereum' and p.contract_address = b.token_bought_addressgroup by 1)