104: EMC Perps: show estimated Jupiter Value and mark affected totals with ≈

This commit is contained in:
2026-10-26 09:18:29 +01:00
parent cfb49ed896
commit 805e2e7e6e
18 changed files with 338 additions and 36 deletions
+14 -3
View File
@@ -18,11 +18,22 @@ The overview SHALL read the official positions response for one wallet, validate
- **THEN** the successful result clears that wallet's Jupiter scope
### Requirement: Verified metrics and unavailable valuations
The overview SHALL preserve size basis, use post-fee USD collateral and price PnL before separate fees, and calculate leverage and ROI against positive collateral. Unverified closing valuations SHALL be unavailable with an explanation; placeholder zeros and double subtraction of settled fees SHALL NOT be used.
The overview SHALL preserve size basis, post-fee USD collateral and price PnL before separate fees, with leverage/ROI against positive collateral. It SHALL preserve optional reported `valueUsd` as an unverified estimate, converting integer micro-USD exactly without fee corrections. Missing/null Value SHALL remain unavailable; present malformed amounts SHALL fail the observation. Other valid metrics SHALL survive missing Value.
#### Scenario: Unverified API closing value
- **WHEN** API value subtracts opening fees already settled in collateral or does not establish profit-cap valuation
- **THEN** closing Value is unavailable, while independently verified metrics remain available
- **WHEN** API Value subtracts opening fees already settled in collateral or does not establish profit-cap valuation
- **THEN** the reported Value is preserved unchanged as an unverified estimate while independent metrics remain available
- **AND** it is not represented as guaranteed closing proceeds or corrected by adding opening fees back
#### Scenario: Reported API closing estimate
- **WHEN** Jupiter reports `valueUsd` as `"123234567"`, `"0"` or `"-1234567"`
- **THEN** the overview preserves exactly 123.234567, 0 or -1.234567 USD respectively
- **AND** it does not add opening fees back or impose a profit-cap correction
#### Scenario: Missing or malformed Value
- **WHEN** `valueUsd` is missing or null
- **THEN** Value is unavailable while independent metrics remain available
- **AND** a present malformed amount instead fails the complete observation
#### Scenario: Nonpositive collateral
- **WHEN** a position's collateral is zero or negative