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

Top 7 assets endpoint #276

Closed
gipsh opened this issue May 2, 2023 · 1 comment
Closed

Top 7 assets endpoint #276

gipsh opened this issue May 2, 2023 · 1 comment
Assignees
Labels
api Api component v1 v1 release
Milestone

Comments

@gipsh
Copy link
Contributor

gipsh commented May 2, 2023

Create the top 7 assets endpoint to show transferred assets with more volume in a chain

/api/v1/top7assets

Use influx metric to generate the data for 7/15/30 days

the flux query should be like this

from(bucket: "wormhole")
  |> range(start: -100d)
  |> filter(fn: (r) => r["token"] != "none")
  |> group(columns: ["origin_chain","token"])
  |> count()
  |> group()
  |> sort(columns: ["_value"], desc: true)
  |> limit(n:10)
  |> yield(name:"_results")
  • At first the result must be multiplied by the notional of the assets.
  • When we have the backfilled notional ready the value of the total should be summarized directly in the query.

Example of response table:

table_results _valueno grouplong _startno groupdateTime:RFC3339 _stopno groupdateTime:RFC3339 origin_chainno groupstring tokenno groupstring
0 27124 2022-07-06T20:51:50.795Z 2023-05-02T20:51:50.795Z solana USDCso
0 22268 2022-07-06T20:51:50.795Z 2023-05-02T20:51:50.795Z ethereum ETH
0 17966 2022-07-06T20:51:50.795Z 2023-05-02T20:51:50.795Z polygon USDCpo
0 17478 2022-07-06T20:51:50.795Z 2023-05-02T20:51:50.795Z solana SOL
0 15922 2022-07-06T20:51:50.795Z 2023-05-02T20:51:50.795Z solana ETH
0 15292 2022-07-06T20:51:50.795Z 2023-05-02T20:51:50.795Z ethereum USDCet
0 13502 2022-07-06T20:51:50.795Z 2023-05-02T20:51:50.795Z solana USDCet
0 10694 2022-07-06T20:51:50.795Z 2023-05-02T20:51:50.795Z bsc BUSDbs
@gipsh gipsh added this to the v1 milestone May 2, 2023
@gipsh gipsh added the api Api component label May 2, 2023
@agodnic agodnic added the v1 v1 release label May 2, 2023
@agodnic agodnic self-assigned this May 8, 2023
agodnic added a commit that referenced this issue May 10, 2023
### Summary

Tracking issue: #276

This pull request implements the endpoint `GET /api/v1/top-assets-by-volume`, which returns the assets that have the highest volume. Internally, the endpoint uses data summarized daily to speed up query execution times.

This endpoint has a mandatory query parameter named `timerange`, which must be set to `7d`, `15d` or `30d`.
@agodnic
Copy link
Contributor

agodnic commented May 10, 2023

Implemented in a21f40e

@agodnic agodnic closed this as completed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Api component v1 v1 release
Projects
None yet
Development

No branches or pull requests

2 participants