Query editor
-- This query has been migrated to run on DuneSQL.-- If you need to change back because you’re seeing issues, use the Query History view to restore the previous version.-- If you notice a regression, please email [email protected].WITHnew_transfers AS (SELECTto AS wallet,MIN(evt_block_time) AS timeFROMerc20_{{chain}}.evt_TransferWHEREcontract_address = {{token_address}}GROUP BY1),new_wallets AS (SELECTCOUNT(*) AS new_wallets,DATE_TRUNC('day', time) AS dayFROMnew_transfersGROUP BY2),prices AS (SELECTAVG(price) AS price,DATE_TRUNC('day', minute) AS dayFROMprices.usdWHEREcontract_address = {{token_address}}AND blockchain = '{{chain}}'AND minute > NOW() - INTERVAL '{{day}}' dayGROUP BY2)SELECTa.new_wallets AS new_wallets_created,SUM(a.new_wallets) OVER (ORDER BYa.day NULLS FIRST) AS cum_new_wallets,a.day AS day,b.price AS token_priceFROMnew_wallets AS aLEFT JOIN prices AS b ON a.day = b.dayWHEREa.day > NOW() - INTERVAL '{{day}}' dayORDER BYa.day DESC