daniel12345672022-12-07 08:25 PM
    Updated 2022-12-08
    -- Test Query 2.1 — Weekly Time Series, Numerical, Categorical (5)

    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 5
    )

    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

    Run a query to Download Data