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

Add cumulative trading volumes of dex pools #80

Closed
Tracked by #35
bvotteler opened this issue Feb 3, 2023 · 1 comment · Fixed by #81
Closed
Tracked by #35

Add cumulative trading volumes of dex pools #80

bvotteler opened this issue Feb 3, 2023 · 1 comment · Fixed by #81
Assignees
Labels
enhancement New feature or request prio:critical

Comments

@bvotteler
Copy link
Contributor

Split off from #35 :

Trading volume 7 days per pool
Trading volume 24 hours per pool

We can achieve both by having cumulative volumes that can be queried filtering for block timestamps.

So we want to provide cumulative volumes per pool with trading volumes for each token that can be swapped in that pool.

@bvotteler bvotteler added enhancement New feature or request prio:critical labels Feb 3, 2023
@bvotteler bvotteler self-assigned this Feb 3, 2023
@nud3l nud3l added this to Backlog Feb 3, 2023
@github-project-automation github-project-automation bot moved this to New 🆕 in Backlog Feb 3, 2023
@bvotteler
Copy link
Contributor Author

We can achieve both by having cumulative volumes that can be queried filtering for block timestamps.

To add more details, here is in example of how we can get volumes for the past 7 days with cumulative volume queries.

Take this query as example for getting 7 day volume for Issued amounts.

query AggregateQuery($beforeDateTime: DateTime, $fromDateTime: DateTime) {
  issuedUntilEnd: cumulativeVolumes(limit: 1, orderBy: tillTimestamp_DESC, where: {type_eq: Issued, tillTimestamp_lt: $beforeDateTime}) {
    amount
    tillTimestamp
    type
  }
  issuedUntilBefore: cumulativeVolumes(limit: 1, orderBy: tillTimestamp_DESC, where: {type_eq: Issued, tillTimestamp_lte: $fromDateTime}) {
    amount
    tillTimestamp
    type
  }
}

with parameters

{
  "beforeDateTime": "2023-01-17T00:00:00.000000Z",
  "fromDateTime": "2023-01-10T00:00:00.000000Z"
}

The above gives us the cumulative volume (in this example of Issued tokens) before and after the time period of Jan 10th until 7 days later.
The delta between the two amounts is the volume.
We can use any start and end date to get as granular a delta as we want to.

@bvotteler bvotteler mentioned this issue Feb 3, 2023
7 tasks
@bvotteler bvotteler moved this from New 🆕 to Development 🏗️ in Backlog Feb 3, 2023
@bvotteler bvotteler added this to the Kintsugi De-Fi Hub milestone Feb 13, 2023
@github-project-automation github-project-automation bot moved this from Development 🏗️ to Done ✅ in Backlog Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prio:critical
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant