fix: humanize portfolio P&L instead of summing raw mixed units (#551) #1082
No reviewers
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!1082
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/551-portfolio-pnl-scale"
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?
Closes #551
Summary
/portfolioand/trader/:addrOpen Positions now scale indexer raw integers by pair decimals and label the token (net = human quote; cost / realized P&L = human base; avg entry = human base per quote).GET /api/v1/traders/{addr}/positionsstill returns raw NUMERIC and addsasset_0_decimals/asset_1_decimalsplus optional denoms. Missing decimals render as—, never assume 6.$0). Total volume / fees / best / worst show—becausetraders.total_*mixes incompatible tokens (volume USD is #553).Issue criteria
formatNumof raw integers)raw × 10^(d1 − d0)), not an unscaled raw ratio—/portfolio(or/trader/:addr) for a wallet that swapped on UST1/cUSTC and cLUNC/UST1; confirm rows match tx history and header is not a unitless38.29M$1/ USTR=2.5×USTC catalog — out of scope (#556)Test plan
make verify-issue-551(docs crosslinks, indexerposition_tracker+api_traders, frontend scale helper / table / summary / portfolio)/portfolioand/trader/:addrwith mixed-decimal pairsInvariants / skills
P551-1–P551-6 in
docs/indexer-invariants.md,docs/frontend.md§ My Portfolio,skills/AGENTS_FRONTEND_PORTFOLIO_PNL.md(crosslinked fromAGENTS.mdandAGENTS_FRONTEND_PORTFOLIO.md).Important - launch was 2.5 ustc = 1 ustr, but now ustr is trading freely, so make sure that is well documented & set as invariant (ustr is set by market, not fixed) before merging
added 6 commits
main0993d192- Merge branch 'main' into fix/551-portfolio-pnl-scaleCompare with previous version
mentioned in commit
eed4be8d11mentioned in commit
da70fed37dmentioned in issue #553
mentioned in issue #556
mentioned in issue #551