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

# Technical Reference

> Technical details for developers: price oracle system, request fulfillment model, onchain accounts, and code references for Jupiter Perps.

## Price Oracles

Jupiter Perps aggregates token prices from three independent onchain price oracles:

| Oracle                 | Role                      |
| ---------------------- | ------------------------- |
| **Edge by Chaos Labs** | Primary oracle            |
| **Chainlink**          | Verification and fallback |
| **Pyth**               | Verification and fallback |

### Oracle Selection Logic

1. If the Edge oracle is **not stale** and its price is within a defined threshold of both Chainlink and Pyth, the **Edge price is used**.
2. If the Edge oracle is stale or outside the threshold, Chainlink and Pyth prices are compared. If they are within the threshold of each other, **the more recent of the two is used**.
3. If two or more oracles fail, **no price update occurs**.

<Note>
  Oracle price updates happen both during trade execution and via a dedicated keeper that runs independently. Prices used in Jupiter Perps may differ from prices on other venues. The Jupiter Perps price chart is the source of truth for trade decisions.
</Note>

<Accordion title="Oracle Price Accounts (onchain)">
  | Asset | Account                                                                                                                 |
  | ----- | ----------------------------------------------------------------------------------------------------------------------- |
  | SOL   | [FYq2BWQ1V5P1WFBqr3qB2Kb5yHVvSv7upzKodgQE5zXh](https://solscan.io/account/FYq2BWQ1V5P1WFBqr3qB2Kb5yHVvSv7upzKodgQE5zXh) |
  | ETH   | [AFZnHPzy4mvVCffrVwhewHbFc93uTHvDSFrVH7GtfXF1](https://solscan.io/account/AFZnHPzy4mvVCffrVwhewHbFc93uTHvDSFrVH7GtfXF1) |
  | BTC   | [hUqAT1KQ7eW1i6Csp9CXYtpPfSAvi835V7wKi5fRfmC](https://solscan.io/account/hUqAT1KQ7eW1i6Csp9CXYtpPfSAvi835V7wKi5fRfmC)   |
  | USDC  | [6Jp2xZUTWdDD2ZyUPRzeMdc6AFQ5K3pFgZxk2EijfjnM](https://solscan.io/account/6Jp2xZUTWdDD2ZyUPRzeMdc6AFQ5K3pFgZxk2EijfjnM) |
  | USDT  | [Fgc93D641F8N2d1xLjQ4jmShuD3GE3BsCXA56KBQbF5u](https://solscan.io/account/Fgc93D641F8N2d1xLjQ4jmShuD3GE3BsCXA56KBQbF5u) |
</Accordion>

### Migration Note

If you are using the old oracle account referenced in the custody account's `dovesOracle` field, migrate to the new accounts by using the `dovesAgOracle` field instead.

***

## Request Fulfillment Model

Jupiter Perps uses an onchain **request fulfillment model** for all trade actions. Every trade requires two separate transactions:

1. **Request transaction** — The trader (or API client) submits a transaction to Solana containing all required trade parameters (size, collateral, direction, etc.).
2. **Fulfillment transaction** — A keeper detects the request onchain, validates it, and submits a second transaction to execute the trade. The trade is only finalized when this second transaction is confirmed by the Solana network.

### Keepers

Keepers are offchain services operated by Jupiter that continuously poll the Solana blockchain for pending trade requests. Jupiter runs two keepers in parallel.

**Actions processed by keepers:**

* Opening and closing positions
* Increasing or decreasing position size
* Depositing or withdrawing collateral
* Creating, editing, and triggering TP/SL orders
* Creating, editing, and triggering limit orders

<Note>
  Because execution requires a keeper transaction, there is a short delay between request submission and trade execution. The trade is not live until the keeper's fulfillment transaction is confirmed.
</Note>

***

## Custody Accounts (Onchain)

Each asset in the JLP has a corresponding **custody account** storing all pool and fee parameters for that asset.

<Accordion title="Custody account addresses">
  | Asset | Custody Account                                                                                                         |
  | ----- | ----------------------------------------------------------------------------------------------------------------------- |
  | SOL   | [7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz](https://solscan.io/account/7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz) |
  | ETH   | [AQCGyheWPLeo6Qp9WpYS9m3Qj479t7R636N9ey1rEjEn](https://solscan.io/account/AQCGyheWPLeo6Qp9WpYS9m3Qj479t7R636N9ey1rEjEn) |
  | BTC   | [5Pv3gM9JrFFH883SWAhvJC9RPYmo8UNxuFtv5bMMALkm](https://solscan.io/account/5Pv3gM9JrFFH883SWAhvJC9RPYmo8UNxuFtv5bMMALkm) |
  | USDC  | [G18jKKXQwBbrHeiK3C9MRXhkHsLHf7XgCSisykV46EZa](https://solscan.io/account/G18jKKXQwBbrHeiK3C9MRXhkHsLHf7XgCSisykV46EZa) |
  | USDT  | [4vkNeXiYEUizLdrpdPS1eC2mccyM4NUPRtERrk6ZETkk](https://solscan.io/account/4vkNeXiYEUizLdrpdPS1eC2mccyM4NUPRtERrk6ZETkk) |
</Accordion>

<Accordion title="Key fields in custody accounts">
  | Field                                              | Description                                                                                    |
  | -------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
  | `pricing.tradeImpactFeeScalar`                     | Scalar constant for linear price impact fee calculation (BPS format, divide by 10,000 for USD) |
  | `priceImpactBuffer.deltaImbalanceThresholdDecimal` | OI imbalance threshold for additive price impact fee                                           |
  | `fundingRateState.hourlyFundingBps`                | Current hourly borrow rate for the asset                                                       |
  | `assets.owned`                                     | Total tokens owned by the custody                                                              |
  | `assets.locked`                                    | Tokens currently locked in open positions                                                      |
  | `assets.guaranteedUsd`                             | Estimate of total long position size (updated on position changes, not in real time)           |
  | `assets.globalShortSizes`                          | USD value of all open short positions                                                          |
  | `assets.globalShortAveragePrices`                  | Average entry price across all open shorts                                                     |
  | `increasePositionBps`                              | Base fee (BPS) for opening positions                                                           |
  | `decreasePositionBps`                              | Base fee (BPS) for closing positions                                                           |
</Accordion>

***

## Code References

<CardGroup cols={2}>
  <Card title="Base fee calculation" icon="calculator" href="/user-docs/trade/perps-and-jlp/fees#base-fee">
    Formula and code snippet for the flat 0.06% open/close fee.
  </Card>

  <Card title="Linear price impact fee" icon="chart-line" href="/user-docs/trade/perps-and-jlp/fees#linear-price-impact-fee">
    Scalar-based fee that scales with trade size.
  </Card>

  <Card title="Additive price impact fee" icon="code" href="https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing/blob/main/src/examples/price-impact-fee.ts">
    Reference implementation for the OI-imbalance penalty.
  </Card>

  <Card title="Swap fee calculation" icon="arrow-right-arrow-left" href="https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing/blob/main/src/examples/calculate-swap-amount-and-fee.ts">
    Weightage-based swap fee between JLP-held assets.
  </Card>

  <Card title="JLP mint/burn fee" icon="coins" href="https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing/blob/main/src/examples/calculate-mint-burn-jlp.ts">
    Same weightage logic applied to minting and redeeming JLP.
  </Card>

  <Card title="PnL calculation" icon="chart-bar" href="/user-docs/trade/perps-and-jlp/positions-and-collateral#pnl-calculation">
    Unrealized and realized PnL formula and pseudocode.
  </Card>
</CardGroup>

***

## External References

* [Jupiter Perps IDL parsing examples (GitHub)](https://github.com/julianfssen/jupiter-perps-anchor-idl-parsing)
* [Jupiter Research, Risk Assessments](https://www.jupresear.ch/tag/risk)
* [Chaos Labs, Linear Price Impact Fee Proposal](https://discuss.jup.ag/t/jupiter-perpetuals-price-impact-fee-mechanism/17140)
* [Chaos Labs, Price Impact Parameter Recommendations (June 2025)](https://discuss.jup.ag/t/price-impact-parameter-recommendations-june-3rd-2025/38497)
* [Chaos Labs, Additive On-Imbalance Price Impact Model](https://discuss.jup.ag/t/additive-on-imbalance-price-impact-model/38562)
