Skip to content

Fix ton.prices_daily: remove launchpads from calculations#9289

Merged
0xRobin merged 2 commits intoduneanalytics:mainfrom
ohld:ton-prices-remove-launchpads
Feb 17, 2026
Merged

Fix ton.prices_daily: remove launchpads from calculations#9289
0xRobin merged 2 commits intoduneanalytics:mainfrom
ohld:ton-prices-remove-launchpads

Conversation

@ohld
Copy link
Copy Markdown
Contributor

@ohld ohld commented Feb 9, 2026

Thank you for contributing to Spellbook 🪄

Please open the PR in draft and mark as ready when you want to request a review.

Description:

We found a bug in our jetton price calculations. Shipping hotfix


quick links for more information:

@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 9, 2026

PR Summary

Low Risk
Low risk: a single additional filter on the dex_trades source reduces the input dataset, mainly affecting price outputs for tokens predominantly traded via launchpads.

Overview
Updates ton.prices_daily (ton_jetton_price_daily.sql) to exclude project_type = 'launchpad' trades from the ALL_TRADES CTE, preventing launchpad activity from influencing daily jetton price derivation.

Written by Cursor Bugbot for commit 3dd56a6. Configure here.

@github-actions github-actions Bot marked this pull request as draft February 9, 2026 10:05
@github-actions github-actions Bot added WIP work in progress dbt: daily covers the Daily dbt subproject labels Feb 9, 2026
@ohld ohld marked this pull request as ready for review February 9, 2026 10:07
@github-actions github-actions Bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Feb 9, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

ROW(token_sold_address, amount_sold_raw)
]) AS T(token_address, amount_raw)
WHERE token_address NOT IN (SELECT * FROM {{ ref('ton_proxy_ton_addresses') }})
AND project_type != 'launchpad'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NULL project_type rows unintentionally excluded by filter

Medium Severity

The condition project_type != 'launchpad' will also filter out rows where project_type is NULL due to SQL's three-valued logic. When comparing NULL with any value using !=, the result is NULL (unknown), causing the row to be excluded from results. If the ton.dex_trades source contains trades with NULL project_type values, those legitimate trades would be unintentionally excluded from price calculations. Using project_type IS DISTINCT FROM 'launchpad' or (project_type IS NULL OR project_type != 'launchpad') would preserve NULL rows.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project_type can't be null in our case -- it is controlled by our datalake which uploads ton.dex_trades data to Dune

@ohld
Copy link
Copy Markdown
Contributor Author

ohld commented Feb 17, 2026

Any updates? This is very urgent @tomfutago

@0xRobin 0xRobin merged commit 71eca8f into duneanalytics:main Feb 17, 2026
3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dbt: daily covers the Daily dbt subproject ready-for-review this PR development is complete, please review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants