Skip to content

fix(ton-trading-bot): replace hardcoded /3 price conversion with sdk.ton.getPrice() - #67

Merged
xlabtg merged 3 commits into
xlabtg:mainfrom
konard:issue-59-98246a5a890a
Mar 27, 2026
Merged

fix(ton-trading-bot): replace hardcoded /3 price conversion with sdk.ton.getPrice()#67
xlabtg merged 3 commits into
xlabtg:mainfrom
konard:issue-59-98246a5a890a

Conversation

@konard

@konard konard commented Mar 27, 2026

Copy link
Copy Markdown

Summary

Fixes the hardcoded / 3 USD-to-TON price conversion by using sdk.ton.getPrice(), which is already available in the plugin.

Two locations were affected:

  • ton_trading_get_token_listings: The .filter() step computed reserve_in_usd / 3 to estimate TON liquidity. Fixed by fetching sdk.ton.getPrice() in parallel with res.json() (via Promise.all) before the filter, then dividing by the real price.
  • ton_trading_get_token_info: Used reserveUsd / 3 to compute reserveTon for liquidity warnings. Fixed by calling await sdk.ton.getPrice() and using the real price.

Both locations fall back to 3 if getPrice() returns null, preserving existing behavior in edge cases.

Test plan

  • All 175 existing tests pass (npm test)
  • No ESLint errors
  • Both hardcoded /3 divisions replaced; verified with grep

Fixes #59

🤖 Generated with Claude Code

konard and others added 2 commits March 27, 2026 00:49
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: xlabtg#59
Use sdk.ton.getPrice() to convert reserve_in_usd to TON instead of
hardcoded division by 3, in both ton_trading_get_token_listings and
ton_trading_get_token_info. Fallback to 3 if getPrice() returns null.

Fixes xlabtg#59

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] bug: Hardcoded USD/3 price conversion (should use sdk.ton.getPrice()) fix(ton-trading-bot): replace hardcoded /3 price conversion with sdk.ton.getPrice() Mar 27, 2026
@konard
konard marked this pull request as ready for review March 27, 2026 00:52
@konard

konard commented Mar 27, 2026

Copy link
Copy Markdown
Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.710190
  • Calculated by Anthropic: $0.451719 USD
  • Difference: $-0.258471 (-36.39%)

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: sonnet
  • Model: Claude Sonnet 4.6 (claude-sonnet-4-6)

📎 Log file uploaded as Gist (674KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@xlabtg
xlabtg merged commit c996073 into xlabtg:main Mar 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Hardcoded USD/3 price conversion (should use sdk.ton.getPrice())

2 participants