We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
query hotNfts( $orderBy: [EventOrderByInput!] = timestamp_DESC $gte: DateTime! ) { result: events( where: { interaction_eq: BUY, timestamp_gte: $gte } orderBy: $orderBy ) { timestamp interaction nft { collection { name id } } meta } }
data we calculate
const collectionMap = groupBy(data, 'nft.collection.id') const sortOrder = [...new Set(data.map((e) => e.nft.collection.id))] const result = sortOrder.map((colId, idx) => { const collection = collectionMap[colId][0].nft.collection const nfts = sortBy(collectionMap[colId], 'timestamp').reverse() const totalVolume = toKSM(getVolume(nfts)) const buys = nfts.length const latestSale = nfts[0] const medianIdx = Math.floor(buys / 2) return { id: idx + 1, collectionId: colId, name: collection.name, totalVolume, buys, latestSoldSize: toKSM(latestSale.meta), latestSoldTime: formatDistanceToNow(new Date(latestSale.timestamp)), medianDate: formatDistanceToNow(new Date(nfts[medianIdx].timestamp)), nfts, }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
data we calculate
The text was updated successfully, but these errors were encountered: