snapshot-labs / snapshot-hub

GraphQL API for Snapshot
https://hub.snapshot.org/graphql
MIT License
104 stars 198 forks source link

Add aggregate types to the GraphQL API #199

Open stephenthoma opened 2 years ago

stephenthoma commented 2 years ago

This is a feature request to extend the GraphQL API to add support for querying aggregate counts for the existing types (votes, spaces, follows, etc.)

This would make computing metrics of Snapshot entities easier. For example, the proposals_1d metric returned by the explore endpoint could be queried via the GraphL API.

The snapshot twitter bot posts weekly and monthly summaries. Pulling data for the summaries via aggregates would be a big improvement as well.

An example query might look like this:

query VoteCount($id: String, $date: String) {
  vote_aggregate(where: {space: $id, created_gte: $date}) { count }
}

# response
{
  "data": {
    "vote_aggregate": {
      "count": 92
    }
  }
}
zzuziak commented 1 year ago

@ChaituVR could we handle that during upcoming cooldown?