Moecompare 9
    Updated 2023-04-01
    (
    with flow_whale as (
    select top 100
    buyer,
    count(DISTINCT tx_id) as sale_flow_count,
    sum(price) as volume
    from flow.core.ez_nft_sales
    where block_timestamp::date >= '2022-04-21'
    group by 1
    order by 3 desc
    )
    , flow as (
    select
    date_trunc('{{Granularity}}',BLOCK_TIMESTAMP)::date as date,
    count(DISTINCT tx_id) as sale_flow_count,
    sum(sale_flow_count) over (order by date asc) as cum_sales,
    sum(price) as volume
    from flow.core.ez_nft_sales
    where block_timestamp::date >= '2023-01-01'
    and NFT_COLLECTION ilike '%DimensionX'
    and buyer in ( select buyer from flow_whale)
    group by 1
    order by 1
    )


    select 'DimensionX' as collection, date, sale_flow_count, cum_sales, volume
    from flow
    )
    union all
    (
    with flow_whale as (
    select top 100