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

# Positions & Collateral

> How to open, manage, and close leveraged positions on Jupiter Perps, including collateral rules, leverage, PnL, and order types.

## Opening a Position

<Steps>
  <Step title="Connect your wallet">
    Connect a Solana wallet (e.g. Phantom, Solflare) via the top-right button on the Jupiter Perps interface.
  </Step>

  <Step title="Select a market">
    Choose the asset you want to trade: SOL, ETH, or wBTC.
  </Step>

  <Step title="Choose a direction">
    Select **Long** if you expect the price to rise, or **Short** if you expect it to fall.
  </Step>

  <Step title="Set collateral and leverage">
    Enter the collateral amount and adjust the leverage slider (1.1x – 250x). Any SPL token (the standard token format on Solana) supported by Jupiter Swap can be used as input. It will be automatically swapped to the correct underlying collateral token.
  </Step>

  <Step title="Review and confirm">
    Review the order summary (position size, entry price, estimated liquidation price, fees) and confirm the transaction in your wallet.
  </Step>
</Steps>

<Note>
  Two onchain transactions are required to open a position: one to submit the request, and one executed by a keeper to fulfill it.
</Note>

***

## Collateral Rules

The underlying collateral token depends on the position direction and cannot be changed after opening.

<Tabs>
  <Tab title="Long Positions">
    | Position  | Underlying Collateral | Profits Paid In        |
    | --------- | --------------------- | ---------------------- |
    | Long SOL  | SOL                   | SOL (default) or USDC  |
    | Long ETH  | wETH                  | wETH (default) or USDC |
    | Long wBTC | wBTC                  | wBTC (default) or USDC |

    Long positions use the traded asset itself as collateral. When closing a profitable long, profits are paid in the underlying token by default.
  </Tab>

  <Tab title="Short Positions">
    | Position   | Underlying Collateral | Profits Paid In        |
    | ---------- | --------------------- | ---------------------- |
    | Short SOL  | USDC                  | USDC (default) or SOL  |
    | Short ETH  | USDC                  | USDC (default) or wETH |
    | Short wBTC | USDC                  | USDC (default) or wBTC |

    Short positions always use USDC as collateral, regardless of the shorted asset. Profits are paid in USDC by default.
  </Tab>
</Tabs>

When you deposit any SPL token as initial margin, the exchange automatically swaps it to the correct collateral token before opening the position.

### Collateral Value Is Fixed in USD

The USD value of your collateral is recorded at the time of deposit and remains fixed regardless of subsequent price movements in the collateral token.

**Example:** If you deposit \$100 worth of SOL, your collateral is recorded as \$100 USD. If SOL price later increases or decreases, your recorded collateral size remains \$100.

### Depositing and Withdrawing Collateral

You can add or remove collateral from an open position at any time via the **Edit** button in the Positions tab.

| Action              | Effect on Long                                  | Effect on Short                                 |
| ------------------- | ----------------------------------------------- | ----------------------------------------------- |
| Deposit collateral  | Liquidation price decreases, leverage decreases | Liquidation price increases, leverage decreases |
| Withdraw collateral | Liquidation price increases, leverage increases | Liquidation price decreases, leverage increases |

<Warning>
  Withdrawing collateral increases leverage and moves the liquidation price closer to the current market price. Monitor your liquidation price carefully after any withdrawal.
</Warning>

***

## Position Limits

* Maximum **6 open positions** simultaneously: one per asset (SOL, ETH, wBTC) per side (long/short).
* Opening a second position on the **same asset and side** as an existing open position will **merge** both positions into one:
  * The combined leverage is the average of both positions' leverage.
  * The combined size equals the sum of both collaterals multiplied by the combined leverage.
  * Any existing TP/SL orders are preserved after the merge.

***

## Leverage

Leverage determines how much of the position size is borrowed from the JLP relative to your collateral.

| Parameter        | Value |
| ---------------- | ----- |
| Minimum leverage | 1.1x  |
| Maximum leverage | 250x  |

**Example:** With \$500 collateral at 2x leverage, your position size is \$1,000. You borrow \$500 from the JLP and pay borrow fees on that amount.

Higher leverage amplifies both potential gains and potential losses, and moves the liquidation price closer to the entry price.

<Warning>
  At leverage above 10x, borrow fees have a meaningful effect on the liquidation price over time. Positions held for extended periods at high leverage are at elevated liquidation risk even without price movement.
</Warning>

***

## Limit Orders

A limit order opens a position when the oracle price reaches a specified target, rather than at the current market price.

**Behavior:**

* Limit orders are independent from existing positions.
* They remain active until triggered or manually cancelled.
* When triggered, a limit order opens a new position if none exists, or merges with an existing position on the same asset and side.
* A limit order remains active even if an existing position on the same market is closed or liquidated.
* Maximum **20 active limit orders** per asset/side pair.

<Warning>
  **Limit orders near the liquidation price**

  Jupiter Perps does not enforce FIFO (First-in, First-out) execution ordering. If a limit order is placed near the liquidation price of an existing position, both the limit order transaction and the liquidation transaction may be submitted to the chain simultaneously. Whichever is processed first by the network will execute. The outcome cannot be guaranteed.
</Warning>

<Note>
  The liquidation price displayed on the limit order form is a simulation based on conditions at the time you fill in the form. It does not reflect the actual liquidation price at the time the order is triggered.
</Note>

<Info>
  Limit orders cannot be created when the selected market's utilization exceeds 80%.
</Info>

***

## PnL (Profit and Loss)

PnL reflects the gain or loss on an open position relative to the entry price. It updates in real time as the oracle price changes.

| Position | PnL increases when | PnL decreases when |
| -------- | ------------------ | ------------------ |
| Long     | Price rises        | Price falls        |
| Short    | Price falls        | Price rises        |

### Unrealized vs. Realized PnL

* **Unrealized PnL** is the current gain or loss if the position were closed at the current oracle price, before fees.
* **Realized PnL** is the actual amount received after deducting the close base fee, price impact fee, and accumulated borrow fees.

### PnL Calculation

```text theme={null}
// 1. Get exit price
exitPrice = currentTokenPrice

// 2. Determine if in profit
IF isLong THEN inProfit = exitPrice > positionAvgPrice
ELSE inProfit = exitPrice < positionAvgPrice

// 3. Price delta
priceDelta = |exitPrice - positionAvgPrice|

// 4. PnL delta
pnlDelta = (tradeSizeUsd * priceDelta) / positionAvgPrice

// 5. Unrealized PnL
IF inProfit THEN unrealizedPnl = pnlDelta
ELSE unrealizedPnl = -pnlDelta

// 6. Realized PnL (after fees)
realizedPnl = unrealizedPnl - (closeBaseFee + priceImpactFee + borrowFee)
```

### PnL Call

If unrealized PnL turns sufficiently negative and the effective margin falls below the maintenance margin threshold, you will receive a **PnL call**, a prompt to deposit additional collateral to avoid liquidation.

### Receiving Profits

For long positions, profits are paid in the underlying collateral token (e.g. SOL for a SOL long) by default. The amount received is calculated as:

```text theme={null}
tokensReceived = closingValueUsd / tokenPriceAtClose
```

**Example:** A SOL long closed with \$150 total value at SOL = \$110 returns `$150 / $110 = 1.3636 SOL`.

For short positions, profits are paid in USDC by default. Both longs and shorts offer the option to receive the alternative token at close.

<Note>
  The PnL displayed on the interface is before fees. The exact net amount is shown under the Deposit/Withdraw tab.
</Note>

***

## Worked Trade Example

<Expandable title="Example: 2x long on SOL">
  **Setup:**

  | Parameter     | Value              |
  | ------------- | ------------------ |
  | Position size | \$1,000            |
  | Collateral    | \$500 SOL          |
  | Borrowed      | \$500 SOL from JLP |
  | Entry price   | \$100 / SOL        |
  | Borrow rate   | 0.012% / hour      |
  | Utilization   | 50%                |

  **After 48 hours, SOL price rises to \$110:**

  | Item                                            | Amount      |
  | ----------------------------------------------- | ----------- |
  | Final position value                            | \$1,100     |
  | Open fee (0.06% x \$1,000)                      | \$0.60      |
  | Close fee (0.06% x \$1,100)                     | \$0.66      |
  | Borrow fee (500/1,000 x 0.012% x \$1,000 x 48h) | \$2.88      |
  | **Net profit**                                  | **\$95.86** |

  <Note>
    This example excludes price impact fees and assumes constant utilization and borrow rates for simplicity. Actual fees may differ.
  </Note>
</Expandable>

***

## Closing a Position

Positions can be closed fully or partially from the **Positions tab**. Partial closure reduces the position size proportionally and adjusts the collateral to maintain the same leverage ratio.

<Note>
  When reducing position size, collateral is adjusted proportionally to preserve the leverage ratio. For example, reducing a 10x position by 50% also reduces collateral by 50%.
</Note>
