Market Cap: $2.7555T 2.30%
Volume(24h): $87.7675B -15.51%
Fear & Greed Index:

51 - Neutral

  • Market Cap: $2.7555T 2.30%
  • Volume(24h): $87.7675B -15.51%
  • Fear & Greed Index:
  • Market Cap: $2.7555T 2.30%
Cryptos
Topics
Cryptospedia
News
CryptosTopics
Videos
Top Cryptospedia

Select Language

Select Language

Select Currency

Cryptos
Topics
Cryptospedia
News
CryptosTopics
Videos

How to Calculate Unrealized PnL on OKX

Unrealized PnL in crypto derivatives—like on OKX—is the floating profit/loss on open positions, calculated in real time using mark price (not last price), impacts margin and liquidation risk, but isn’t taxed or settled until closure.

Oct 16, 2026 at 10:00 pm

Understanding Unrealized PnL in Crypto Derivatives

1. Unrealized PnL refers to the profit or loss on open positions that have not yet been closed. It reflects the difference between the entry price and the current market price, scaled by position size and contract multiplier.

2. On OKX, this value is recalculated continuously using the latest mark price—not the last traded price—to ensure fairness amid volatile market conditions.

3. Unlike realized PnL, unrealized PnL does not affect account equity until the position is closed or liquidated. However, it directly influences margin utilization and liquidation risk assessment.

4. For inverse perpetual contracts, unrealized PnL is denominated in the base asset (e.g., BTC), while for USDT-margined contracts, it is expressed in USDT.

5. The system displays unrealized PnL separately for each open position in the 'Positions' tab, with color-coded indicators: green for gains and red for losses.

Mathematical Formulation per Contract Type

1. For long positions in USDT-margined linear contracts: (Mark Price − Entry Price) × Position Size × Contract Multiplier.

2. For short positions in USDT-margined linear contracts: (Entry Price − Mark Price) × Position Size × Contract Multiplier.

3. For inverse perpetual contracts (e.g., BTC-USD): (1 ÷ Entry Price − 1 ÷ Mark Price) × Position Size × Face Value, where face value is typically 1 USD.

4. In coin-margined futures, unrealized PnL impacts wallet balance in the settlement asset—meaning BTC-denominated PnL changes the BTC wallet balance directly.

5. Funding payments are excluded from unrealized PnL calculations; they are accounted for separately as realized cash flows upon each funding interval.

Real-Time Data Sources on OKX

1. OKX uses a proprietary mark price mechanism combining index price, bid-ask midpoint, and decaying premium to prevent manipulation during illiquid periods.

2. The index price aggregates real-time feeds from multiple spot exchanges weighted by volume and reliability—Binance, Coinbase, Kraken, and Bybit contribute to the OKX Index.

3. Mark price updates occur every 200 milliseconds during active trading hours and are published via WebSocket streams under the publicTickers channel.

4. Users accessing API endpoints such as GET /api/v5/account/positions receive fields including upl (unrealized PnL) and avgPx (average entry price).

5. Historical unrealized PnL cannot be retrieved retroactively via public APIs—only the current snapshot is served per request.

Impact of Risk Limit Tiers and Leverage

1. Higher risk limit tiers allow larger positions but do not alter the formula for unrealized PnL—only the maximum allowable position size changes.

2. Leverage settings influence initial margin and maintenance margin thresholds, indirectly affecting when unrealized losses trigger margin calls.

3. When leverage is adjusted post-entry, unrealized PnL remains unchanged—the calculation basis stays anchored to original entry price and size.

4. Cross-margin mode pools all available balance to absorb unrealized losses; isolated margin restricts loss absorption to the designated margin amount only.

5. A position under isolated margin with zero available margin will enter forced liquidation if unrealized loss exceeds allocated margin—even if the overall account holds surplus funds elsewhere.

Frequently Asked Questions

Q: Does unrealized PnL include funding fees?A: No. Funding fees are settled separately at fixed intervals and appear as realized PnL entries in the transaction history.

Q: Why does my unrealized PnL differ from what I calculate manually using last price?A: OKX uses mark price—not last price—for PnL computation. Mark price incorporates index data and spread adjustments to resist volatility spikes.

Q: Can unrealized PnL turn negative even if the market hasn’t moved since entry?A: Yes. If funding rates shift significantly or index composition changes, the mark price may diverge from entry price without spot movement.

Q: Is unrealized PnL taxable upon generation?A: Tax treatment depends on jurisdiction. Most regulatory frameworks consider it non-taxable until realization through closure or liquidation.

Disclaimer:info@kdj.com

The information provided is not trading advice. kdj.com does not assume any responsibility for any investments made based on the information provided in this article. Cryptocurrencies are highly volatile and it is highly recommended that you invest with caution after thorough research!

If you believe that the content used on this website infringes your copyright, please contact us immediately (info@kdj.com) and we will delete it promptly.

Related knowledge

See all articles

User not found or password invalid

Your input is correct