> ## 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.

# Fees

> All fees charged on Jupiter Perps: base fee, price impact fee (linear and additive), borrow fee, swap fee, JLP mint/burn fee, and transaction fees.

This page covers every fee type charged on Jupiter Perps, including when each fee applies, how it is calculated, and worked examples.

## Fee Summary

| Fee Type                    | When Charged                        | Rate                                                         |
| --------------------------- | ----------------------------------- | ------------------------------------------------------------ |
| Base fee                    | Open and close                      | 0.06% of trade size                                          |
| Price impact fee (linear)   | Open and close                      | Scales with trade size                                       |
| Price impact fee (additive) | Open and close                      | Applies when OI imbalance exceeds threshold                  |
| Borrow fee                  | Continuously while position is open | Hourly, based on utilization and position size               |
| Swap fee                    | When a token swap is needed         | 10 BPS (non-stables), 2 BPS (stables), adjusted by weightage |
| JLP mint/burn fee           | When minting or redeeming JLP       | Same weightage-based calculation as swap fee                 |
| Transaction fee             | On every transaction                | SOL network fee + optional priority fee / Jito tip           |
| Liquidation penalty         | On liquidation                      | All remaining collateral                                     |

***

## When Do You Pay Fees?

Fees are charged at three different moments in the life of a position. This summary covers what you can expect at each stage. Each fee is documented in detail in its own section below.

**Opening a position:**

* Base fee (0.06% of trade size)
* Price impact fee (scales with trade size and open interest imbalance)
* Swap fee (only if your input token differs from the position's underlying collateral token)
* SOL transaction fee (network fee + optional priority fee or Jito tip)
* SOL rent for the position's escrow account (returned when the position is closed)

**While the position is open:**

* Borrow fee, charged hourly and deducted from your collateral, for as long as the position is open

**Closing a position:**

* Base fee (0.06% of trade size)
* Price impact fee
* Swap fee (only if you choose to receive profits in a token different from the underlying collateral token)
* SOL transaction fee

<Note>
  If a position is liquidated instead of closed manually, all remaining collateral is forfeited to the JLP. See the [Liquidation Penalty](#liquidation-penalty) section.
</Note>

***

## Base Fee

A flat fee of **0.06%** is charged on the trade size when opening or closing a position.

The base fee applies to:

* Opening a position (market or limit order)
* Closing a position (manual, TP/SL, or liquidation)

**Example:**

* Trade size: \$10,000
* Base fee: \$10,000 x 0.06% = **\$6**

<Expandable title="Calculating the Base Fee (code)">
  ```typescript theme={null}
  const BPS_POWER = 10 ** 4; // 10_000

  // Use 'increasePositionBps' for opening, 'decreasePositionBps' for closing
  const baseFeeBps = custody.increasePositionBps;

  const baseFeeBpsDecimals = baseFeeBps / BPS_POWER;
  const openCloseFeeUsd = tradeSizeUsd * baseFeeBpsDecimals;
  ```
</Expandable>

***

## Price Impact Fee

Jupiter Perps executes trades at oracle prices, which means traders receive the displayed price regardless of trade size (no orderbook slippage). To compensate for the risk this creates for JLP holders, a **price impact fee** is charged to simulate the price impact that would occur on a traditional orderbook exchange.

The price impact fee has two components that are summed and capped at a per-asset maximum.

***

### Linear Price Impact Fee

The linear component scales proportionally with trade size. Each asset has a fixed scalar constant (`pricing.tradeImpactFeeScalar`) stored in its custody account.

**Formula:**

```text theme={null}
Linear Fee Coefficient = Trade Size / Price Impact Fee Scalar Constant
Final Linear Fee       = Trade Size × Linear Fee Coefficient
```

<Note>
  The `tradeImpactFeeScalar` value in the custody account is stored in BPS format. Divide by 10,000 to use against USD trade sizes.
</Note>

**Custody accounts (for scalar values):**

* SOL: [7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz](https://solscan.io/account/7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz#accountData)
* BTC: [5Pv3gM9JrFFH883SWAhvJC9RPYmo8UNxuFtv5bMMALkm](https://solscan.io/account/5Pv3gM9JrFFH883SWAhvJC9RPYmo8UNxuFtv5bMMALkm#accountData)
* ETH: [AQCGyheWPLeo6Qp9WpYS9m3Qj479t7R636N9ey1rEjEn](https://solscan.io/account/AQCGyheWPLeo6Qp9WpYS9m3Qj479t7R636N9ey1rEjEn#accountData)

**Example (SOL, at time of writing):**

| Step                   | Value                                 |
| ---------------------- | ------------------------------------- |
| Trade size             | \$10,000                              |
| Scalar constant (raw)  | 1,250,000,000,000,000                 |
| Scalar (÷ 10,000)      | 125,000,000,000                       |
| Linear fee coefficient | 10,000 / 125,000,000,000 = 0.00000008 |
| **Linear fee**         | 10,000 × 0.00000008 = **\$0.0008**    |

<Expandable title="Calculating the Linear Price Impact Fee (code)">
  ```typescript theme={null}
  const USDC_DECIMALS = 10 ** 6;
  const BPS_POWER = 10 ** 4;

  // 1. Get scalar from custody account
  const scalar = custody.pricing.tradeImpactFeeScalar;

  // 2. Convert trade size to base units
  const sizeBase = tradeSizeUsd * USDC_DECIMALS;

  // 3. Scale to BPS format
  const sizeBps = sizeBase * BPS_POWER;

  // 4. Fee rate in BPS
  const feeBps = sizeBps / scalar;

  // 5. Final fee in USD
  const feeUsd = (sizeBase * feeBps / BPS_POWER) / USDC_DECIMALS;
  ```
</Expandable>

Reference: [Chaos Labs initial proposal](https://discuss.jup.ag/t/jupiter-perpetuals-price-impact-fee-mechanism/17140)

***

### Additive Price Impact Fee

The additive component applies on top of the linear fee when the **open interest (OI) imbalance** — the difference between total long OI and total short OI for an asset — exceeds a predefined threshold.

Each asset has its own threshold (`priceImpactBuffer.deltaImbalanceThresholdDecimal`), `factor`, `exp`, and `maxPriceImpactFee` values stored in its custody account.

**Formula:**

```math theme={null}
Additive Penalty (BPS) = factor * (newImbalance / Threshold) ^ exp

Additive Penalty (USD) = Trade Size * (Additive Penalty (BPS) / 10000)

Final Price Impact Fee (USD) = min(Linear Fee (USD) + Additive Penalty (USD), Max Fee (USD))
```

If the imbalance is below the threshold, the additive penalty is zero.

**Example (SOL long, at time of writing):**

| Parameter                 | Value                     |
| ------------------------- | ------------------------- |
| Trade size                | \$10,000                  |
| New OI imbalance          | \$2,000,000               |
| `tradeImpactFeeScalar`    | 1,250,000,000 (USD terms) |
| `deltaImbalanceThreshold` | \$750,000                 |
| `maxPriceImpactFee`       | 50 BPS (0.50%)            |

1. **Linear fee:** \$10,000 × 0.000000008 = \$0.00008
2. **Additive penalty:** The imbalance (\$2,000,000) exceeds the threshold (\$750,000), so the penalty formula applies using the SOL-specific `factor` and `exp` values.
3. **Final fee:** min(Linear Fee + Additive Penalty, \$10,000 × 0.50%) = min(..., **\$50**)

<Note>
  `factor` and `exp` are per-custody parameters defined onchain. The exact values can be read from the custody accounts linked above.
</Note>

Reference implementation: [price-impact-fee.ts](https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing/blob/main/src/examples/price-impact-fee.ts)

Additional references:

* [Price Impact Parameter Recommendations – June 2025](https://discuss.jup.ag/t/price-impact-parameter-recommendations-june-3rd-2025/38497)
* [Additive On-Imbalance Price Impact Model](https://discuss.jup.ag/t/additive-on-imbalance-price-impact-model/38562)

***

## Borrow Fee

Traders pay a **borrow fee** for the duration their leveraged position is open. This fee compensates liquidity providers for the capital locked in the position.

Borrow fees compound **hourly** and are deducted from the position's collateral.

### Formula

```math theme={null}
Hourly Borrow Fee = (Total Tokens Locked / Total Tokens in Pool) * Hourly Borrow Rate * Position Size (USD)
```

| Variable             | Definition                                                                                                |
| -------------------- | --------------------------------------------------------------------------------------------------------- |
| Total Tokens Locked  | All tokens locked across all open positions for this asset                                                |
| Total Tokens in Pool | Total tokens deposited for this asset in the JLP                                                          |
| Hourly Borrow Rate   | Per-asset rate, found in the trade form or via `fundingRateState.hourlyFundingBps` in the custody account |
| Position Size        | USD value of the leveraged position                                                                       |

<Expandable title="Calculating Utilization and Borrow Rate (code)">
  ```text theme={null}
  // Utilization
  IF custody.assets.owned > 0 AND custody.assets.locked > 0:
    utilizationPct = custody.assets.locked / custody.assets.owned
  ELSE:
    utilizationPct = 0

  // Hourly borrow rate
  hourlyFundingDbps = custody.fundingRateState.hourlyFundingDbps
  hourlyBorrowRate  = (hourlyFundingDbps / 1000) * utilizationPct
  ```
</Expandable>

### Worked Example

| Parameter             | Value                                                 |
| --------------------- | ----------------------------------------------------- |
| SOL price             | \$100                                                 |
| Position size         | 100 SOL (\$10,000)                                    |
| Total tokens locked   | 200 SOL                                               |
| Total tokens in pool  | 1,010 SOL                                             |
| Utilization           | 200 / 1,010 = 19.8%                                   |
| Hourly borrow rate    | 0.012% (0.00012)                                      |
| **Hourly borrow fee** | (200 / 1,010) × 0.00012 × 10,000 = **\$0.238 / hour** |

<Warning>
  Borrow fees are continuously deducted from your collateral. Over time, this reduces your effective margin and increases your liquidation price. Positions held for extended periods — especially at high leverage — require regular monitoring.
</Warning>

***

## Swap Fee

When a trade involves swapping between JLP-held assets (e.g. depositing SOL collateral to open a USDC-collateral short), a swap fee is charged.

**Base rates:**

* Non-stablecoin assets (SOL, ETH, wBTC): **10 BPS (0.10%)**
* Stablecoin assets (USDC, USDT): **2 BPS (0.02%)**

The final fee is adjusted based on how the swap affects each asset's **current weightage** relative to its **target weightage** in the JLP:

* Swaps that move an asset's current weightage **closer** to its target → fee decreases
* Swaps that move an asset's current weightage **further** from its target → fee increases

The pool uses the **maximum** of the input and output asset's fee when calculating the final swap fee.

**Example:** Swapping SOL → USDC: the SOL base fee (10 BPS) is used, as it is higher than the USDC base fee (2 BPS).

Reference implementation: [calculate-swap-amount-and-fee.ts](https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing/blob/main/src/examples/calculate-swap-amount-and-fee.ts)

***

## JLP Mint & Burn Fee

Minting (depositing assets into the JLP) and burning (redeeming JLP for assets) use the same weightage-based fee calculation as swaps, since both actions change the pool composition.

Reference implementation: [calculate-mint-burn-jlp.ts](https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing/blob/main/src/examples/calculate-mint-burn-jlp.ts)

***

## Transaction and Priority Fees

* Traders pay a SOL network fee for each transaction submitted to Solana.
* Optional **priority fees** or **Jito bundle tips** can be set in the interface to improve transaction processing speed.
* A small SOL amount is used as **rent** to create an escrow account (PDA) when opening a position. This rent is returned when the position is closed.

The estimated transaction fee and rent amount (in SOL) are shown in the trade form before confirming.

***

## Liquidation Penalty

When a position is liquidated, **all remaining collateral** is collected by the protocol and distributed to the JLP.

<Warning>
  You will lose your entire remaining collateral upon liquidation, not just the amount required to cover the loss. See the [Liquidation](/user-docs/trade/perps-and-jlp/liquidation) page for how to monitor and avoid liquidation.
</Warning>
