daniel1234567Color Test Query copy
    Updated 2023-01-12

    with big_spenders as (
    select
    buyer_address as buyer_address,
    sum(price_usd) + sum(total_fees_usd) as total_spend
    from ethereum.core.ez_nft_sales
    where
    date_trunc ('day', block_timestamp) > current_date - interval '12 weeks' and
    total_fees_usd is not null
    group by 1 order by 2 desc limit 10
    ),
    actuals as(
    SELECT
    date_trunc ('week', block_timestamp) as date,
    buyer_address,
    sum(total_fees_usd) as total_fees,
    sum(price_usd) as total_price,
    sum(total_fees_usd) + sum(price_usd) as total_cost,
    sum(total_fees_usd) / (sum(total_fees_usd) + sum(price_usd)) as fee_percent
    FROM ethereum.core.ez_nft_sales
    where
    buyer_address in (
    select
    buyer_address
    from
    big_spenders
    ) and
    date_trunc ('week', block_timestamp) > current_date - interval '52 weeks'
    group by 1, 2
    )

    select
    *,
    -total_cost as neg_total_cost,
    total_cost - 15000000 as mixed_total_cost
    Run a query to Download Data