Extend JupiterPerpsPosition with the position collateral value in USD.
Jupiter Perps Position accounts contain a collateralUsd field. This field represents the position collateral size after fees, denominated in USD atomic value.
Consider adding a suitable ValueTag such as ΩUSDCAmountΩ before implementing this.
collateralUsd is not the same as collateral token amount.
collateralCustody tells which custody/token is used for collateral, but this issue is only about the USD collateral value.
Implementation:
Decode collateralUsd from the Jupiter Perps Position account.
Keep existing decoding of entryPrice, direction, and tradedTokenMint unchanged.
Non-goals:
No collateral token amount
No collateral custody field
No liquidation price
No sizeUsd
No trading or transaction signing
Acceptance criteria:
JupiterPerpsPosition contains a collateralUsd field.
collateralUsd is decoded from the Position account.
Existing position fields still work.
Project compiles.
### Description:
Extend `JupiterPerpsPosition` with the position collateral value in USD.
Jupiter Perps `Position` accounts contain a `collateralUsd` field. This field represents the position collateral size after fees, denominated in USD atomic value.
Suggested API change:
```java
public record JupiterPerpsPosition(
ΩJupiterPerpsPositionAccountΩ positionAccount,
ΩUSDCPriceΩ entryPrice,
JupiterPerpsPositionDirection direction,
ΩSPLMintAddressΩ tradedTokenMint,
ΩUSDCAmountΩ collateralUsd
) {
}
```
### Notes:
* Consider adding a suitable ValueTag such as `ΩUSDCAmountΩ` before implementing this.
* `collateralUsd` is not the same as collateral token amount.
* `collateralCustody` tells which custody/token is used for collateral, but this issue is only about the USD collateral value.
### Implementation:
* Decode `collateralUsd` from the Jupiter Perps Position account.
* Keep existing decoding of `entryPrice`, `direction`, and `tradedTokenMint` unchanged.
**Non-goals:**
* No collateral token amount
* No collateral custody field
* No liquidation price
* No sizeUsd
* No trading or transaction signing
### Acceptance criteria:
* `JupiterPerpsPosition` contains a `collateralUsd` field.
* `collateralUsd` is decoded from the Position account.
* Existing position fields still work.
* Project compiles.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description:
Extend
JupiterPerpsPositionwith the position collateral value in USD.Jupiter Perps
Positionaccounts contain acollateralUsdfield. This field represents the position collateral size after fees, denominated in USD atomic value.Suggested API change:
Notes:
ΩUSDCAmountΩbefore implementing this.collateralUsdis not the same as collateral token amount.collateralCustodytells which custody/token is used for collateral, but this issue is only about the USD collateral value.Implementation:
collateralUsdfrom the Jupiter Perps Position account.entryPrice,direction, andtradedTokenMintunchanged.Non-goals:
Acceptance criteria:
JupiterPerpsPositioncontains acollateralUsdfield.collateralUsdis decoded from the Position account.