Query editor
-- Daily Transfer Volume in Native Tokens and USDWITH daily_transfers AS (SELECTDATE_TRUNC('day', evt_block_time) as date,SUM(value) / 1e18 as volume_native_tokens,COUNT(*) as transfer_count,COUNT(DISTINCT "from") as unique_senders,COUNT(DISTINCT "to") as unique_receiversFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xc11158c5da9db1d553ed28f0c2ba1cbedd42cfcbAND "from" != 0x0000000000000000000000000000000000000000AND "to" != 0x0000000000000000000000000000000000000000GROUP BY DATE_TRUNC('day', evt_block_time)),pool_prices AS (SELECTDATE_TRUNC('day', evt_block_time) as date,AVG(CASEWHEN amount0In > 0 AND amount1Out > 0 THEN amount1Out / amount0InWHEN amount1In > 0 AND amount0Out > 0 THEN amount0Out / amount1InELSE NULLEND) as avg_daily_priceFROM uniswap_v2_ethereum.Pair_evt_SwapWHERE contract_address = 0x54d094a26e6b021e719bd7cfc0cf332c68b78e05GROUP BY DATE_TRUNC('day', evt_block_time)),eth_prices AS (SELECTDATE_TRUNC('day', minute) as date,AVG(price) as eth_price_usdFROM prices.usdWHERE contract_address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 -- WETHGROUP BY DATE_TRUNC('day', minute))SELECTdt.date,ROUND(dt.volume_native_tokens, 0) as volume_native_tokens,ROUND(dt.volume_native_tokens * COALESCE(pp.avg_daily_price, 0) * COALESCE(ep.eth_price_usd, 0), 2) as volume_usd_estimated,dt.transfer_count,dt.unique_senders,dt.unique_receivers,ROUND(COALESCE(pp.avg_daily_price, 0), 12) as avg_token_price_eth,ROUND(COALESCE(pp.avg_daily_price, 0) * COALESCE(ep.eth_price_usd, 0), 10) as avg_token_price_usd,dt.volume_native_tokens / NULLIF(dt.transfer_count, 0) as avg_transfer_size_native,(dt.volume_native_tokens * COALESCE(pp.avg_daily_price, 0) * COALESCE(ep.eth_price_usd, 0)) / NULLIF(dt.transfer_count, 0) as avg_transfer_size_usdFROM daily_transfers dtLEFT JOIN pool_prices pp ON dt.date = pp.dateLEFT JOIN eth_prices ep ON dt.date = ep.dateORDER BY dt.date DESC;