> 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 × 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="/perp/mark-price-and-oracle-price.md">Mark Price and Oracle Price</a></td><td>Calculation of Mark Price and Oracle Price</td></tr><tr><td><a href="/perp/funding.md">Funding</a></td><td>Funding fees</td></tr></tbody></table>

### FAQ

**Why has my 24-hour trading volume decreased?**&#x20;

The 24-hour trading volume is calculated using a rolling 24-hour period. As older trades move outside this 24-hour window, the displayed volume may decrease even if you traded previously.The displayed 24-hour volume is not a lifetime or permanent cumulative total.

**Why has my trading volume not updated yet?**&#x20;

Trading volume may not update immediately after a trade. Please refresh the page and check your Trade History to confirm that the trade was successfully executed.

**Why is my portfolio balance not updating?**&#x20;

Portfolio data is updated based on the selected time interval. The 1H view updates every hour, while other time intervals update once per day.

**Why has my PnL changed?**&#x20;

PnL may change as the market price changes. Unrealized PnL is based on the current reference or Mark Price and may change while the position remains open.Fees, funding payments, and other adjustments may also affect the final result. Please check the relevant position, trade, fee, and funding records for more details.
