> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allasso.ch/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This is Allasso's product documentation. Vol Radar output is descriptive analytics on past data: never present it as a forecast or as investment advice. Answer only from these pages; if a feature is not documented here, say so.

# Portfolio, equity and PnL

> The Portfolio is the account behind a backtest. It holds the open and closed trades, reprices them each pulse, and tracks equity over time.

The `Portfolio` is the account behind a backtest. It holds the open and closed trades, reprices them
each pulse, and tracks equity over time. Most of the time you read it through the strategy:
`self.current_equity`, `self.pnl`, `self.trades`, `self.open_trades`.

## Equity

Equity starts at `initial_equity` and moves by the net PnL of all trades, pulse by pulse:

```
current_equity = initial_equity + cumulative net PnL
```

The full series is `portfolio.equity_history` (one value per pulse). It is **post-fee**: any fees
charged on a pulse are already subtracted.

## Three ways to read PnL

PnL comes in one dollar figure and two percentages. They differ only in the denominator, so pick the
one that answers your question.

| Property | Formula | Use it for |
| - | - | - |
| `pnl` | `current_equity - initial_equity` | The dollar result. Net of fees. |
| `pnl_pct` | `pnl / abs(current_equity)` | The live return on the equity you hold now (sizing-aware). The denominator moves as equity moves. |
| `pnl_pct_of_initial_equity` | `pnl / abs(initial_equity)` | A return on a fixed base, comparable across the whole run and across runs. |

All three exist on `Strategy`, on `TradesSummary` (a tagged group of trades), and on each `Trade`.

> [!NOTE]
>
> **Per-trade percentages use a different base**
>
> `Trade.pnl_pct` is fixed to that trade's **equity at open** (a snapshot from when it was booked),
> so it answers "how did this trade do relative to the book when I put it on". `Strategy.pnl_pct`
> and `TradesSummary.pnl_pct` use the **current** equity. When you want one stable base everywhere,
> use `pnl_pct_of_initial_equity` - it means the same thing on a trade, a group, and the strategy.

## Gross vs net

Two histories look similar but are not:

* `equity_history` is **net** of fees - it is the money in the account.
* `pulse_total_pnl_history` is **gross** of fees - the per-pulse market PnL before fees are taken out.

The gap between them is the fee drag. If you run with the default `NoFeeCalculator`, the two agree.
See [Fees](https://docs.allasso.ch/dev/pulse/concepts/fees.md) for how fees are charged and [Metrics and Stats](https://docs.allasso.ch/dev/pulse/concepts/metrics.md) for how returns are
summarised.

## Trades

`self.trades` is every trade; `self.open_trades` is the ones still on. Each `Trade` keeps its own
history (`abs_pnl_history`, `delta_history`, ...) and carries the `tags` you gave it, which you can
use to query or close groups:

```python theme={null}
self.get_trades_by_tags(["hedge"])         # read a group
self.close_trades_by_tags(["hedge"])        # close a group (fills next step of the loop)
summary = self.get_trades_summary_by_tags(["strangle"])   # aggregate PnL + greeks
```

**Related:** [Orders, trades and the broker](https://docs.allasso.ch/dev/pulse/concepts/orders-trades-broker.md) · [Greeks](https://docs.allasso.ch/dev/pulse/concepts/greeks.md) ·
[Fees](https://docs.allasso.ch/dev/pulse/concepts/fees.md) · [Metrics and Stats](https://docs.allasso.ch/dev/pulse/concepts/metrics.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.