Afonso_Diazgrouping platform fee
    Updated 2024-10-31
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    seller_address,
    buyer_address,
    nft_address,
    price,
    price_usd,
    tx_fee_usd,
    platform_fee_usd,
    case
    when platform_fee_usd >= 0 and platform_fee_usd < 0.6 then 'a. < 0.6 $'
    when platform_fee_usd >= 0.6 and platform_fee_usd < 1.2 then 'b. 0.6 $ - 1.2 $'
    when platform_fee_usd >= 1.2 and platform_fee_usd < 1.8 then 'c. 1.2 $ - 1.8 $'
    when platform_fee_usd >= 1.8 and platform_fee_usd < 2.4 then 'd. 1.8 $ - 2.4 $'
    else 'e. > 2.4 $'
    end as platform_fee_group
    from
    arbitrum.nft.ez_nft_sales
    where
    block_timestamp::date between '{{ start_date }}' and '{{ end_date }}'
    and platform_name = 'okx'
    )

    select
    platform_fee_group,
    count(tx_hash) as total_transactions,
    sum(price_usd) as total_volume_usd,
    count(distinct seller_address) as unique_sellers,
    count(distinct buyer_address) as unique_buyers,
    avg(platform_fee_usd) as avg_platform_fee_usd,
    avg(price_usd) as avg_price_usd,
    sum(tx_fee_usd) as total_tx_fee_usd
    QueryRunArchived: QueryRun has been archived