Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/with wallets as (select distinct buyer as walletfrom sudoswap_ethereum.eventsunionselect distinct seller as walletfrom sudoswap_ethereum.events),user as (select a.wallet as walletfrom wallets aleft join nft.trades b on a.wallet = b.buyerwhere b.buyer is nullgroup by 1),sub as (selectblock_date,sum(amount_original) as native_nft_volumefrom sudoswap_ethereum.eventswhere(buyer not in(select *from user)and seller not in(select *from user))group by 1order by 1), sub2 as (selecta.block_date,native_nft_volume,sum(b.amount_original) as overall_volumefrom sub aleft join sudoswap_ethereum.events b on a.block_date = b.block_Datewhere a.block_date between date('2022-07-08') and date('2022-12-15')group by 1, 2order by 1)select *, native_nft_volume/overall_volume * 100 as percentage_native_volumefrom sub2