Portfolio page: realized P&L, cost basis, volume and fees are shown in raw base units and summed across pairs with different quote tokens #551
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#551
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Where:
/portfolio(and the public Trader page it links to) — the P&L Summary and Open Positions cards.What's wrong:
Repro: open Portfolio for any wallet that has swapped on both a 6-dec/6-dec pair (UST1/cUSTC) and cLUNC/UST1; compare the per-row values against the actual amounts in the wallet's tx history.
Likely cause: same class as #522 (price/chart/tape scaled and converted after launch) — the Portfolio/Trader views still consume the indexer's raw quote-exposure fields.
Suggested fix: scale each row by its quote token's decimals and label the quote symbol; only aggregate across pairs after converting to USD (or drop the cross-pair totals and show per-pair only). Worth doing before the page is used as a public trader leaderboard, since the current numbers rank by whoever traded the smallest-unit token.
mentioned in issue #556
mentioned in issue #557
mentioned in merge request !1082
mentioned in merge request !1083
mentioned in commit
0993d1926cmentioned in commit
eed4be8d11mentioned in commit
da70fed37dMerged in !1082. Combined with !1081: header Total Volume (USD) uses catalog USD; fees / best / worst stay
—; realized P&L is a USD sum of per-pair human base via P522-Q helper.Shipped vs #551 AC: per-pair net/cost/P&L/avg entry scaled by decimals and labeled; avg entry is
raw × 10^(d1−d0); missing decimals →—(never assume 6); JSON positions stay raw +asset_*_decimals.USTR 2.5× comment on !1082: that invariant belongs to #556 / !1083 (USTR is market-priced from largest USD-TVL hub pool, not a fixed peg). Documented there (H3 + oracle runbook).
Problem remaining after !1083:
/portfolioTotal realized P&L USD still goes through frontendquoteTokenUsd(UST1 = $1,USTR = 2.5 × USTC) intraderPositionDisplay.ts, notGET /api/v1/hub-prices. Per-pair human token amounts are correct; the header USD total can disagree with hub marks. Follow-up issue after !1080–!1084.Manual mixed-decimal
/portfolioQA still needed after production indexer+frontend deploy.mentioned in issue #560
marked as related to #560
Post-merge follow-up: #560
Post-merge review extras (after !1082 landed with !1081 volume USD):
N/AviaPnlValue(null)(PnlValue.tsx), while fees use—. Invariant says em dash for mixed totals.GET /traders/{addr}/positionsusesfilter_map+asset_map.get(traders.rs). A missing asset hides the row instead of returning it with empty decimals (UI would then show—).—until positions resolve (null vs empty array). Cosmetic.Hub USD for that header is already on #560. Items 1–2 should be included there.
mentioned in issue #565
mentioned in merge request !1093
mentioned in issue #589
mentioned in issue #653
mentioned in issue #657
mentioned in issue #674
mentioned in issue #675