Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

663 + 664/ Fractional price display + handling no price data #674

Merged
merged 6 commits into from
Mar 10, 2025

Conversation

lealobanov
Copy link
Collaborator

@lealobanov lealobanov commented Mar 6, 2025

Related Issue

Closes #663 and #664

Summary of Changes

Update token formatting logic to format values > 0 and < 0.01 according to the logic outlined in #663.

Also update to hide 0.00 and "-" prices/values, replacing with an empty string.

Example:
Screenshot 2025-03-06 at 8 02 05 PM
Screenshot 2025-03-06 at 8 35 50 PM

Need Regression Testing

  • Yes
  • No

Risk Assessment

  • Low
  • Medium
  • High

Additional Notes

Screenshots (if applicable)

@lealobanov lealobanov changed the title 66/3 Fractional price display 663/ Fractional price display Mar 6, 2025
@lealobanov lealobanov marked this pull request as ready for review March 6, 2025 19:02
@lealobanov lealobanov requested a review from a team as a code owner March 6, 2025 19:02
@lealobanov lealobanov changed the title 663/ Fractional price display 663 + 664/ Fractional price display + handling no price data Mar 6, 2025
// For prices at least $0.0001, use normal formatting with min 2 and max 4 decimals.
if (price >= 0.0001) {
// Use BigDecimal for precise rounding. Scale to 4, rounding up.
val bd = BigDecimal(price).setScale(4, RoundingMode.UP)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In scenarios involving monetary amounts, it is generally recommended to use RoundingMode.DOWN to prevent users from seeing an inflated amount. This helps avoid situations where users see an available balance that they actually cannot use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JeffreyDoyle thoughts on the above? The logic in the issue suggests to round up, but agree this might be misleading to users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jaymengxy discussed this during standup, agreed to round all the values down

@lealobanov lealobanov requested a review from jaymengxy March 7, 2025 19:06
@lealobanov lealobanov merged commit 046cbbd into develop Mar 10, 2025
4 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.

2 participants