> ## Documentation Index
> Fetch the complete documentation index at: https://developers.jup.ag/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Position Account

> Overview of the Position account used in the Jupiter Perpetuals Program, representing trade position data for a given token

This page contains an overview of the accounts used in the Jupiter Perpetuals Program, and specifically the `Position` account.

The `Position` account is a struct which represents a set of parameters and states associated to trade position data for a given token.

> [!NOTE]
>
> **`Position` account derivation**
>
> The `Position` account's address is derived from the trader's wallet address / public key, the custody account, the collateral custody account, and a few other constant seeds. This means traders will always have the same Position account address for their open positions.
>
> This also means that traders only have nine positions available at one time:
>
> * Long SOL
> * Long wETH
> * Long wBTC
> * Short SOL (USDC as collateral)
> * Short SOL (USDT as collateral)
> * Short wETH (USDC as collateral)
> * Short wETH (USDT as collateral)
> * Short wBTC (USDC as collateral)
> * Short wBTC (USDT as collateral)
>
> This is an example [`Position` account](https://solscan.io/account/FBLzd5VM67MEKkoWerXu7Nu1ksbLXQvJDx63y5aeLEvt).

> [!TIP]
>
> **EXAMPLE TYPESCRIPT CODE**
>
> This [repository](https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing) contains Typescript code samples on interacting with the Jupiter Perpetuals program IDL with `anchor` and `@solana/web3.js`
>
> You can also find the [Custody Account fields in the repository](https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing/blob/1a0b5dc71081958895691047a9aa8ba51d2a8765/src/idl/jupiter-perpetuals-idl.ts#L2699) or on a [blockchain explorer](https://solscan.io/account/PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu#programIdl).

## Account Details

Each `Position` account contains the following data:

| Field | Description |
| :- | :- |
| `owner` | **Type:** `publicKey`   The public key of the trader's account. |
| `pool` | **Type:** `publicKey`   The public key of the [JLP pool account](https://developers.jup.ag/docs/perps/pool-account.md). |
| `custody` | **Type:** `publicKey`   The public key of the position's [`custody` account](https://developers.jup.ag/docs/perps/custody-account). |
| `collateralCustody` | **Type:** `publicKey`   The public key of the position's collateral custody account.   Like the `custody` account, a `collateralCustody` account contains information for the token that's used as collateral for the position (SOL / wETH / wBTC for long positions, USDC / USDT for short positions).   The borrow rates for the position will also be calculated based on the position's `collateralCustody`. |
| `openTime` | **Type:** `i64`   The open time of the position in UNIX timestamp format. |
| `updateTime` | **Type:** `i64`   The last updated time of the position in UNIX timestamp format. |
| `side` | **Type:** `Side`   The position's side, either `long` or `short`. |
| `price` | **Type:** `u64`   The entry price of the position when it was opened. The entry price is an integer in the atomic value (before decimals), a USDC (6 decimals) value of `158225872` is equivalent to \$158.22. |
| `sizeUsd` | **Type:** `u64`   The position size after leverage in USD in the atomic value (before decimals). A position with `sizeUsd = 0` is treated as a closed position. |
| `collateralUsd` | **Type:** `u64`   The position's collateral size after fees in USD in the atomic value (before decimals). |
| `realisedPnlUsd` | **Type:** `i64`   The position's realized PNL when closing the position partially.  When a position is closed completely, the position's `realisedPnlUsd` will be `0` as the position is considered closed (as described in `sizeUsd`). |
| `cumulativeInterestSnapshot` | **Type:** `u128`   Stores the position's interest rate snapshot when it was last updated.   - The `collateralCustody` account for the respective collateral token stores a monotonically increasing counter in `collateralCustody .fundingRateState .cumulativeInterestRate`.   - The difference between the `collateralCustody .fundingRateState .cumulativeInterestRate` and the position's `cumulativeInterestSnapshot` is used to calculate the borrow fees for the position. |
| `lockedAmount` | **Type:** `u64`   The amount of tokens (SOL / wETH / wBTC for long positions, USDC / USDT for short positions) locked to pay off the position's max potential profit. It acts as a cap on the maximum potential profit of the position. This amount is locked in the collateral custody to ensure the platform has sufficient tokens to pay out profitable trades. |
| `bump` | **Type:** `u8`   The bump seed used to derive the PDA for the `Position` account. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.