CartanGroupMarket Cap of NFT Collections in NFT Price Index copy
    Updated 2024-06-13
    -- forked from 0xDataWolf / Market Cap of NFT Collections in NFT Price Index @ https://flipsidecrypto.xyz/0xDataWolf/q/172PFfuQWP0H/market-cap-of-nft-collections-in-nft-price-index

    -- -- ctrl f to find parameters_to_adjust
    -- -- CP
    -- 0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb
    -- --azuki
    -- 0xed5af388653567af2f388e6224dc7c4b3241c544
    -- --BAYC
    -- 0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d
    -- --MAYC: there are 40 tokens with missing valuation data
    -- 0x60e4d786628fea6478f785a6d7e704777c86a7c6
    -- ppg:
    -- 0xbd3531da5cf5857e7cfaa92426877b022e612cf8
    -- nakamigos:
    -- 0xd774557b647330c91bf44cfeab205095f7e6c367

    -- Keywords to navigate:
    -- CHECKPOINT to intermediate results.
    -- TWEAK PARAMETER: areas to adjust parameters to change results
    -- MODULE_XX: A series of CTEs that perform data processing

    -- -- MODULE_01: Get a common date to start building the index and prune dataset size for faster runs
    -- -- this is to ensure that all collections start on the same date or at least 1 year before the current date
    with find_min_date as(
    select
    collection_address
    , min(valuation_date) as earliest_date
    from external.deepnftvalue.fact_valuations
    group by collection_address
    )

    -- its either you are using date a year ago or the earliest possible date accounting for the 1 mth lag
    , find_common_date as(
    select
    *
    , case
    QueryRunArchived: QueryRun has been archived