Add collateralUsd to JupiterPerpsPosition #19

Closed
opened 2026-06-27 09:12:51 +02:00 by minimons · 0 comments
Owner

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:

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.
### 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.
minimons added the enhancement label 2026-06-27 10:51:55 +02:00
minimons added this to the AssetAZ project 2026-06-27 10:52:00 +02:00
minimons self-assigned this 2026-06-27 10:52:08 +02:00
minimons moved this to In Progress in AssetAZ on 2026-06-28 23:29:59 +02:00
minimons moved this to Done in AssetAZ on 2026-06-29 15:43:50 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: r35157/com_r35157_nenjim-hubd-impl_ref#19