Query editor
-- pull swap pair address. 0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc-- count of swap event from swap events-- swap events table volue, use roll tokem amount and adjust by decimal then by prices.usd. Decimal adjust is tokens.erc20 table then prices.usd tableWith counter as(SELECTdate_trunc('{{Date DOD2}}',evt_block_time) as time, count(*) as swap_countfrom uniswap_v2_ethereum.Pair_evt_Swapwhere contract_address = (0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc)group by 1order by 1 desc),volume as(WITH base as(SELECTdate_trunc('minute',swap.evt_block_time) as time, CASEWHEN cast(swap.amount0Out AS double) = 0 then factory.token1ELSE factory.token0END AS swap_contract_address, CASEWHEN cast(swap.amount0Out AS double) = 0 then cast(swap.amount1Out AS double)ELSE cast(swap.amount0Out AS double)END AS swap_amount_rawFROM uniswap_v2_ethereum.Pair_evt_Swap as swapLEFT JOIN uniswap_v2_ethereum.Factory_evt_PairCreated as factoryON factory.pair = swap.contract_addressWHERE swap.contract_address = 0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc)SELECTdate_trunc('{{Date DOD2}}', base.time) as time, SUM(base.swap_amount_raw / pow(10,COALESCE(token.decimals,18)) * usd.price) AS total_usd_amountFROM baseLEFT JOIN tokens.erc20 as tokenON token.contract_address = base.swap_contract_addressLEFT JOIN prices.usd as usdON usd.minute = base.time AND usd.blockchain = 'ethereum' AND usd.contract_address = base.swap_contract_addressGroup by 1),dex_vol as (Selectdate_trunc('{{Date DOD2}}',block_time) as time, sum(amount_usd) as total_usd_amount_dexFROM dex.tradesWHERE blockchain = 'ethereum'AND project_contract_address = (0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc)Group by 1)Selectvol.time, vol.total_usd_amount, counter.swap_count, dxvol.total_usd_amount_dexFROM volume as volLEFT JOIN counterON vol.time = counter.timeLeft JOIN dex_vol as dxvol