fix: use ohlcv data to calculate advanced chart percentage value#28574
fix: use ohlcv data to calculate advanced chart percentage value#28574sahar-fehri wants to merge 2 commits intomainfrom
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. |
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 50810bc. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Why no E2E tags are needed:
The risk is low — this is a self-contained UI refactor with proper unit test coverage. Performance Test Selection: |
|




Description
Fixes a bug where the Advanced Chart's percentage value remained static when users switched timeframes. The percentage now correctly updates to reflect the selected time range by calculating it from OHLCV data instead of legacy props.
Problem
When users switched timeframes in the Advanced Chart (e.g., from "Today" to "Past hour"), the descriptive text updated correctly but the percentage value remained static. This occurred because the percentage was calculated from legacy prices data that was based on a different time period than the Advanced Chart's selected time range.
Solution
Modified the Advanced Chart to calculate its own percentage from OHLCV data instead of using legacy props. This ensures the percentage always matches the selected time range.
Calculation LogicFormula:
Changelog
CHANGELOG entry: fixed percentage display on advanced charts
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3031
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
UI-only calculation change scoped to the token overview advanced price header, with added test coverage; minimal risk beyond potential edge cases when OHLCV data is missing or reordered.
Overview
Fixes the Advanced Chart header change/percentage so it recomputes per selected timeframe by deriving
comparePrice/priceDifffrom the first OHLCV candle (instead of relying on legacypriceDiff/comparePriceprops).This removes
priceDiff/comparePricefromPriceAdvancedProps, updatesPriceto pass onlycurrentPrice/currentCurrencyintoPriceAdvanced, and adds tests covering OHLCV-based percentage calculation, empty-data behavior, and updates when the OHLCV dataset changes.Reviewed by Cursor Bugbot for commit d4b6d20. Bugbot is set up for automated code reviews on this repo. Configure here.