Skip to content

fix/web: read an LP position's money in USD, not quote units labelled as dollars - #264

Open
lgrawet wants to merge 6 commits into
hummingbot:mainfrom
lgrawet:fix/lp-money-units-usd
Open

lgrawet wants to merge 6 commits into
hummingbot:mainfrom
lgrawet:fix/lp-money-units-usd

Conversation

@lgrawet

@lgrawet lgrawet commented Oct 2, 2026

Copy link
Copy Markdown

Read an LP position's money in USD, not quote units labelled as dollars

The /dex position strip and the portfolio's liquidity rows prefixed every LP money figure with "$", but total_value_quote, fees_earned_quote and net_pnl_quote are denominated in the pair's quote — SOL on an X-SOL range. That mislabelled rather than merely rounded the figure: a 0.163 SOL range worth about $20 read as "$0.16".

Both /dex surfaces already fetch the pool row, so they hold the quote token's USD price (quote_token_price_usd). When it is known the figure is converted and shown in USD; when it is not, the number is left in quote units under the quote's own symbol rather than a dollar it is not. The portfolio table goes through the page's existing display-currency seam (formatValue / formatPnlValue) so it follows the same rule as every other money cell there.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the failed-refresh workspace issue is fixed.

Summary

The PR converts LP money from quote units to USD when a price is available and keeps the quote’s own label otherwise.

  • DEX position cards show LP money in dollars or quote units.
  • Portfolio liquidity rows follow the selected currency and keep small fees visible.

No new actionable issues were found. The previously numbered finding is fixed.

Reviews (7) · Last reviewed commit: "fix(web): keep the last good pool when a..." · Reviewed by Greptile

Comment thread frontend/src/hooks/useLpPositions.ts Resolved
…d as dollars

The /dex position strip and the portfolio's liquidity rows prefixed every
LP money figure with "$", but total_value_quote, fees_earned_quote and
net_pnl_quote are denominated in the pair's *quote* — SOL on an X-SOL
range. That mislabelled rather than merely rounded the figure: a 0.163 SOL
range worth about $20 read as "$0.16".

Both /dex surfaces already fetch the pool row, so they hold the quote
token's USD price (quote_token_price_usd). When it is known the figure is
converted and shown in USD; when it is not, the number is left in quote
units under the quote's own symbol rather than a dollar it is not. The
portfolio table goes through the page's existing display-currency seam
(formatValue / formatPnlValue) so it follows the same rule as every other
money cell there.
For a quote with no rate path (SOL, ETH, …) the fallback labelled the
still-quote-denominated figure `$`, so a 0.163 SOL range read `$0.16` — a
dollar it is not. The fallback now keeps the quote's own ticker, suffixed
where the /dex surfaces already put it, while a quote the dashboard has a
symbol for (or a USD-pegged stablecoin) keeps its prefix.
The pool query sliced to the first 30 addresses on GeckoTerminal's request
cap, so a portfolio of more than 30 ranges left the rest without a pool row
— and, now that the /dex cards and the portfolio price in USD, in quote
units. The cap is per request, not per portfolio: the backend already splits
on the same bound, so the hook chunks each network's addresses into
30-address requests instead of truncating.
@lgrawet
lgrawet force-pushed the fix/lp-money-units-usd branch from d0ac88b to 24a0065 Compare November 2, 2026 20:47
Comment thread frontend/src/hooks/useLpPositions.ts Resolved
Two regressions Greptile caught on the USD conversion:

- The portfolio's fee column ran through `formatValue`, whose `$` branch
  rounds to two decimals, so a 0.00136 USDC fee read `$0.00` while the
  /dex cards still showed the digits. Fees now convert through
  `formatCurrencyPrecise`: `formatCurrency` at and above a cent, and the
  amount's own significant digits below it.
- `quoteUsd` read `quote_token_price_usd` off a pool query with no refresh
  timer, so a /dex page left open kept multiplying by the price from when
  it was opened. The query now refetches on the positions' own beat
  (`LP_REFRESH_MS`) instead of only on focus.
The range bar multiplies by `quote_token_price_usd` from the
`dex-pool-by-address` query, which had a `staleTime` but no timer — so a
page left open kept pricing against the quote at the moment it loaded.
Poll it on the same beat as the bins query beside it.
Comment thread frontend/src/pages/DexPool.tsx Resolved
The page refreshes on a timer, so a rate limit or a network blip can land
after the pool is already on screen. Guarding on `poolError || !pool` then
replaced the chart and trade controls with the error page; only a page with
nothing to show should fall back to it.
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.

1 participant