Skip to content

Add a TWAP price endpoint returning the time-weighted average price for a creator key over a configurable window #866

Description

@Chucks1093

Summary

The client TWAP display needs a backend endpoint. A GET /keys/:keyId/twap endpoint that reads price snapshots and computes the average over a requested window should be added.

Scope

  • Add GET /keys/:keyId/twap?window=1h|24h|7d endpoint (no auth required)
  • Call the get_twap contract view function with the window converted to ledger units
  • Return twapPrice, spotPrice, windowLedgers, and snapshotCount in the response
  • Cache the response in Redis for 60 seconds and invalidate on each trade
  • Return null for twapPrice when fewer than 2 snapshots exist in the window

Acceptance Criteria

  • twapPrice computed correctly for each window
  • spotPrice included alongside twapPrice
  • null returned for twapPrice when insufficient snapshots exist
  • Redis cache invalidated after each trade
  • Invalid window param returns 422

ETA: 12 hours


Coordinate on Telegram

Activity

  1. dot-enny commented on Sep 24, 2026

    @dot-enny

    @dot-enny has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hi there, I'd like to work on this.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @dot-enny to this issue.

  2. EzikeChikelu commented on Sep 24, 2026

    @EzikeChikelu

    @EzikeChikelu has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hello maintainer, this issue is within my area of experience, and i am confident i can work toward resolving it correctly, kindly consider assigning it to me.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @EzikeChikelu to this issue.

  3. olaide2001 commented on Sep 24, 2026

    @olaide2001

    @olaide2001 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    I’ve gone through the issue and understand what needs to be done. I’m ready to take it on.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @olaide2001 to this issue.

  4. plainer-rgb commented on Sep 24, 2026

    @plainer-rgb

    @plainer-rgb has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hello Maintainer, I’ve gone through the issue thoroughly and believe I can provide a clean, maintainable solution that aligns with the project’s existing patterns and requirements. I’d appreciate being assigned the issue.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @plainer-rgb to this issue.

  5. MJ-RWA commented on Sep 24, 2026

    @MJ-RWA

    @MJ-RWA has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hello accesslAyerorg,can l work on this to implement this fix?

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @MJ-RWA to this issue.

  6. Yerimahjr commented on Sep 24, 2026

    @Yerimahjr

    @Yerimahjr has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hi maintainer I would like to work on this issue please assign

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Yerimahjr to this issue.

  7. babatundealao407-alt commented on Sep 24, 2026

    @babatundealao407-alt

    @babatundealao407-alt has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    I'd be glad to handle this issue. I'll keep the implementation concise, maintainable, and well-documented.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @babatundealao407-alt to this issue.

  8. Bolajiomo99 commented on Sep 24, 2026

    @Bolajiomo99

    @Bolajiomo99 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Please assign this issue to me

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Bolajiomo99 to this issue.

  9. somotochukwu-dev commented on Sep 24, 2026

    @somotochukwu-dev

    @somotochukwu-dev has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hi
    Please assign this issue to me
    Thanks

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @somotochukwu-dev to this issue.

  10. Jessicaayegh commented on Sep 24, 2026

    @Jessicaayegh

    @Jessicaayegh has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hi maintainer! I’d love to work on this issue if it’s still available. I have a good understanding of the requirements and would be happy to implement the solution. Thanks for considering my request!

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Jessicaayegh to this issue.

  11. TS-mfon commented on Sep 24, 2026

    @TS-mfon
    Contributor

    @TS-mfon has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    GM

    i'm a blockchain developer

    please can i work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @TS-mfon to this issue.

  12. ponmileleke54-dev commented on Sep 24, 2026

    @ponmileleke54-dev

    @ponmileleke54-dev has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    I would like to work on this

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @ponmileleke54-dev to this issue.

  13. drips-wave commented on Sep 24, 2026

    @drips-wave

    Congratulations, @TS-mfon! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.

    🧑‍💻 @TS-mfon: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  14. added a commit that references this issue on Sep 24, 2026
    392f6a1
  15. grantfox-oss commented on Oct 1, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox!

    @TS-mfon's PR #1007 was approved and merged by @Chucks1093.

    🏆 @TS-mfon: You earned 40 FoxPoints for this contribution! Your current tier: Builder (1,062 total points). Track your full progress on GrantFox.

    👏 Great work, @TS-mfon! Keep contributing to accesslayerorg.

  16. added a commit that references this issue on Oct 2, 2026
    c7bb0fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions