Skip to content

/candles/:assetA/:assetB aggregates testnet and mainnet price_points into the same candle #209

Open
Belzabeem/Lens
#1

Description

@Miracle656

src/routes/candles.ts:44-54 buckets price_points with no network predicate:

SELECT to_timestamp(floor(EXTRACT(EPOCH FROM timestamp) / $1) * $1) AS time, …
  FROM price_points
 WHERE pair_key = $2
   AND …
 GROUP BY floor(EXTRACT(EPOCH FROM timestamp) / $1)

price_points carries a network column and every other reader filters on it (/pairs at src/routes/pairs.ts:28, /price/:assetA/:assetB, /prices/history). Here both chains' prints for the same pair_key fall into the same GROUP BY bucket, so open/high/low/close and volume are computed across two different markets. The high and low in particular will be whichever chain was further from the other — an artefact, reported as a candle.

There is also no network reference anywhere in the file, so a caller cannot select one; openapi.yaml correctly does not declare the parameter (confirmed in #179).

Fix mirrors #208: read req.network ?? activeNetwork, add AND network = $n, echo the answered network in the response, declare NetworkQuery and the response field in openapi.yaml, and cover it with a test that seeds both networks at one pair_key and asserts the candle reflects only one.

Found while reviewing #179.


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Activity

  1. davidtech2026-ops commented on Oct 15, 2026

    @davidtech2026-ops

    @davidtech2026-ops has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi Maintainer, I’m familiar with this issue and can implement a fix. Please assign it to me if possible.

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

  2. Noobb-byte commented on Oct 15, 2026

    @Noobb-byte
    Contributor

    @Noobb-byte has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi maintainer please i'd love to work on this

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

  3. mansur-codes commented on Oct 15, 2026

    @mansur-codes
    Contributor

    @mansur-codes has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    This is within my skillset please assign to me

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

  4. solaawojobi00-bit commented on Oct 15, 2026

    @solaawojobi00-bit
    Contributor

    @solaawojobi00-bit has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I’ll jump on this — src/routes/candles.ts queries the price_points table without incorporating a network predicate filter. As a result, testnet and mainnet price data points sharing the same pair_key interleave into the exact same GROUP BY time buckets. This severely corrupts candlestick metrics by blending open, high, low, close prices, and trading volumes across two entirely independent markets.
    To resolve this issue completely, the following steps are required:

    • Update src/routes/candles.ts to retrieve the active network via req.network ?? activeNetwork.
    • Append an explicit AND network = $n condition to the SQL query against price_points.
    • Echo the resolved network back in the API response payload.
    • Declare NetworkQuery and the corresponding network response field inside openapi.yaml.
    • Implement a robust integration test that seeds price points for both testnet and mainnet under a single pair_key and asserts that the returned candle reflects solely the targeted network.
      Kindly assign it to me.

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

  5. deslawson commented on Oct 15, 2026

    @deslawson
    Contributor

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

    I'd love to work on this issue as it goes in line with my field of practice

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

  6. ObedChibunna commented on Oct 15, 2026

    @ObedChibunna

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

    I would love to work on this issue

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

  7. drips-wave commented on Oct 15, 2026

    @drips-wave

    Congratulations, @mansur-codes! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @mansur-codes: 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 🌊

  8. Miracle656 commented on Oct 16, 2026

    @Miracle656
    CollaboratorAuthor

    Unassigning so this can be added to the Stellar Wave — a Wave issue can't carry an assignee from outside the programme.

    @mansur-codes this isn't a reassignment away from you: nothing has been submitted against it and it stays open. If you're still working on it, claim it through the Wave and it counts toward your points there. Apologies for the shuffle.

  9. Belzabeem commented on Oct 16, 2026

    @Belzabeem

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

    I’d love to fix this by isolating candle aggregation by network, updating the OpenAPI contract, and testing that mainnet and testnet prices never mix; kindly assign it to me.

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

  10. Ahmad12developer commented on Oct 16, 2026

    @Ahmad12developer
    Contributor

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

    Hi maintainer
    I like to work on this issue with basic understanding am having for the project

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

  11. Dannnyhamps commented on Oct 16, 2026

    @Dannnyhamps

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

    Hi maintainer, I've reviewed the issue and would like to work on it

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

  12. drips-wave commented on Oct 16, 2026

    @drips-wave

    Congratulations, @Belzabeem! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @Belzabeem: 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 🌊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions