> For the complete documentation index, see [llms.txt](https://docs.txflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.txflow.com/perp/entry-price-and-pnl.md).

# Entry Price and PnL

Your **Entry Price** is the baseline for all PnL calculations. TxFlow tracks two types of PnL:

* **Unrealized PnL** — Floating profit/loss based on current Mark Price. Changes in real time.
* **Realized PnL** — Locked-in profit/loss from closed or reduced positions. Cannot change.

### Entry Price

Entry Price is the volume-weighted average price at which you opened or added to your position.

**How It's Calculated:**

```
Entry Price = ∑(Fill Price × Fill Size) ÷ Total Position Size
```

<table><thead><tr><th width="168.04296875">Action</th><th width="250.515625">Effect on Entry Price</th><th width="680.78125">Example</th></tr></thead><tbody><tr><td>Open position</td><td>Set to fill price</td><td>Buy 1 BTC @ 50,000 → Entry=50,000</td></tr><tr><td>Add to position (same direction)</td><td>Recalculate weighted average</td><td>Hold 1 BTC @ $50,000, buy 1 BTC @ $51,000 → Entry = $50,500</td></tr><tr><td>Reduce position (partial close)</td><td>No change</td><td>Hold 2 BTC @ $50,500, sell 1 BTC → Entry stays $50,500</td></tr><tr><td>Flip position (reverse direction)</td><td>Recalculate for new position</td><td>Hold 1 BTC long @ $50,000, sell 3 BTC → Close long, open 2 BTC short @ new entry</td></tr></tbody></table>

Entry price resets to `0` when the position is fully closed.

### Unrealized PnL

Unrealized PnL updates in real time with the Mark Price.

**Long positions:**

```
Unrealized PnL = (Mark Price − Entry Price) × Position
```

**Short positions:**

```
Unrealized PnL = (Entry Price − Mark Price) × Position
```

### Realized (Closed) PnL

Realized PnL is locked in when you fully or partially close a position.

**Long position:**

```
Realized PnL = (Exit Price − Entry Price) × Closed Size
```

**Short position:**

```
Realized PnL = (Entry Price − Exit Price) × Closed Size
```

**Net Closed PnL (after fees):**

```
Net Closed PnL = Gross PnL − Trading Fees − Funding Fees Paid
```

Realized PnL is immediately credited to or debited from your `USDC` balance upon settlement.

### Return on Equity (ROE)

ROE measures your profit relative to the initial margin used:

```
ROE = PnL ÷ Initial Margin  Fees × 100%
```

### Related Pages

<table><thead><tr><th width="247.62109375">Pages</th><th width="520.9921875">Description</th></tr></thead><tbody><tr><td><a href="/pages/lWdZgI2P4YIODQ7uazsl">Mark Price and Oracle Price</a></td><td>Calculation of Mark Price and Oracle Price</td></tr><tr><td><a href="/pages/JCOc7dDxeSdSQSf2US8e">Funding</a></td><td>Funding fees</td></tr></tbody></table>
