Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats of collection #10

Open
Jarsen136 opened this issue Feb 18, 2023 · 9 comments
Open

Stats of collection #10

Jarsen136 opened this issue Feb 18, 2023 · 9 comments
Labels
schema Requires changing schema

Comments

@Jarsen136
Copy link

Jarsen136 commented Feb 18, 2023

Requirement

  • extends collectionEntitiesConnection resolver or provide a new resolver
  • input:
{
    offset
    limit
    where
    orderBy
}
  • output:
{
   volume:  xxx, // Total trading turnover
   highestSale: xxx, // Maximum selling price
   totalCount: xxx     // count of nfts in this colleciton
}

image

@vikiival
Copy link
Member

Should the resolver return data per one collection?

@Jarsen136
Copy link
Author

Should the resolver return data per one collection?

Yes, I think so

@vikiival vikiival transferred this issue from kodadot/rubick Apr 3, 2023
@vikiival vikiival changed the title Resolver for stats of collection Stats of collection Apr 3, 2023
@vikiival vikiival added the schema Requires changing schema label Apr 3, 2023
@vikiival
Copy link
Member

vikiival commented Apr 3, 2023

I would do that as a part of collection schema

@vikiival
Copy link
Member

So task is to extend collection to have

type CollectionEntity @entity {
  volume: BigInt!
  highestSale: BigInt!
  floor: BigInt!
  distribution: Int!
  ownerCount: Int!
}

how to modify this data

  • volume - updated when buy happens
  • highestSale - on buy if price > collection.highestSale
  • floor - updated on list and price < collection.floor
  • distribution - distinct count of owners per collection minus issuer - do not have simple algo for that
  • ownerCount - total count of owners minus issuer

@vikiival
Copy link
Member

cc @Matehoo this would imo help

@daiagi
Copy link

daiagi commented Apr 12, 2023

Hey @vikiival I'm not sure this will help in holders/flippers tabs in collection activity as it requires user centric data and not collection centric

kodadot/nft-gallery#5388 (comment)

please correct me if i'm wrong

@alko89
Copy link

alko89 commented Apr 13, 2023

  • distribution - distinct count of owners per collection minus issuer - do not have simple algo for that

  • ownerCount - total count of owners minus issuer

I'm a bit confused about the difference between distribution and ownerCount, distinct count of owners per collection and ownerCount appears to be the same thing in the context of a collection no?

Should the distribution be a new entity with a distribution of NFTs/owner (count of number of NFTs per owner) for a collection?

@vikiival
Copy link
Member

Let me make collection example:

nfts = [
  { owner: viki, id: 1 },
  { owner: viki, id: 2 },
  { owner: ales, id: 3 },
  { owner: leo, id: 4 },
  { owner: wao, id: 5 },
]

const onlyOwners = nfts.map(x => x.owner)
const ownerCount = onlyOwners.lenght // 5
const distribution = new Set(onlyOwners).size // 4

@alko89
Copy link

alko89 commented Apr 13, 2023

🤔 in your example ownerCount would correspond to total NFTs 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
schema Requires changing schema
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants