fix: align perps advanced chart price precision#32913
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
7067a9d to
1f2dee3
Compare
2b9d13b to
8367052
Compare
dd66bd7 to
53845f9
Compare
53845f9 to
eabc62a
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
No changes to core Engine, controllers, navigation, browser, accounts, swaps, staking, or other unrelated areas. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit eabc62a. Configure here.
| } | ||
| let configuredPriceDecimals = getConfiguredPriceDecimals(); | ||
| if (configuredPriceDecimals !== null) { | ||
| return formatPriceWithConfiguredDecimals(p, configuredPriceDecimals); |
There was a problem hiding this comment.
Chart subscript diverges TP labels
Medium Severity
With perps priceDecimals enabled, the Advanced Chart custom formatter still prefers subscript notation for very small prices before market-aware decimals run. Auto-close TP/SL now uses formatPerpsPrice / Hyperliquid formatting without subscript. Y-axis and price pills can disagree with TP/SL text on tiny-price markets like PEPE.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit eabc62a. Configure here.
|
⚡ Performance Test Results
✅ All tests passed · 2 tests · 1 device 📱 Devices tested (1)Android: Google Pixel 8 Pro (v14.0) ✅ Passed Tests (2)
Branch: |




Description
This PR aligns Perps Advanced Charts price precision with the existing Lightweight Charts behavior, especially for markets with very small prices like PEPE and market specific price precision like LIT. Advanced Charts now receives Perps market precision from Hyperliquid
szDecimals, uses that precision for price scale labels and price pills, and resolves Perps symbols with enough internal price scale precision for tiny-price assets. Auto-close TP/SL labels also use market-aware Perps price formatting so values likeSL $2.1946are preserved instead of being rounded to two decimals.Changelog
CHANGELOG entry: Fixed Y-axis labels and price pill parity on perps Advanced Charts
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-3499
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Touches shared Advanced Chart WebView logic and Perps market-details display; behavior is opt-in via
priceDecimals/szDecimalswith broad test coverage and no auth or payment paths.Overview
Perps Advanced Charts now match Lightweight Charts and Hyperliquid price rules by threading market
szDecimalsintopriceDecimals(6 - szDecimals) onAdvancedChart, including Y-axis labels, last-price pills, and symbolpricescale/variable_tick_sizewhen precision is configured.AdvancedChart gains an optional
priceDecimalsprop baked into WebViewCONFIG; the WebView applies custom price formatters (alongside existing subscript notation) and a perps-oriented tick ladder for tiny and large prices.Perps UI forwards
szDecimalsfrom market details toPerpsAdvancedChartandPerpsPositionCard. Auto-close TP/SL copy switches from generic fiat rounding toformatPerpsPriceso values like$2.1946are not collapsed to two decimals.Reviewed by Cursor Bugbot for commit eabc62a. Bugbot is set up for automated code reviews on this repo. Configure here.