fix(frontend): Issue with small cap coins precision#240
Merged
Conversation
lwaekfjlk
approved these changes
Nov 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Micro-cap Token Price Formatting and Backtest Parametrization
Problem
Micro-cap cryptocurrency tokens (PEPE, BONK, SHIB, FLOKI, etc.) were displaying as $0.00 in both LLM
prompts and frontend charts due to fixed 2-decimal place formatting. This caused:
Example Issue:
PEPEUSDT: Current price is $0.00 ❌ (actual price: $0.00001234)
Solution
Implemented adaptive price formatting with scientific notation for small-value assets:
New Formatting Logic:
Benefits:
Changes Made
Files:
Current Price Display:
if price >= 1.0:
# Standard formatting for larger prices
analysis_parts.append(f"{symbol}: Current price is ${price:,.4f}")
else:
# Scientific notation for micro-cap tokens (PEPE, BONK, etc.)
analysis_parts.append(f"{symbol}: Current price is ${price:.2e}")
Historical Price Display:
if hist_price >= 1.0:
price_str = f"{hist_price:.4f}"
else:
price_str = f"{hist_price:.2e}"
File: frontend/src/components/charts/AreaChart.tsx (lines 45-61, 175-183, 213-215)
Added formatPrice() utility function:
Applied to:
File: examples/backtest_demo.py