# Portfolio Performance

> Retrieve cash-flow-adjusted daily P&L, time-weighted returns, and optional benchmark comparisons for master and customer portfolios.

Use `GET /portfolio/performance` for the partner master account and
`GET /users/{userId}/portfolio/performance` for a customer sub-account. These endpoints are distinct
from `/portfolio/history`, which intentionally returns raw equity snapshots without cash-flow adjustment.

```bash
curl "https://mystocks.africa/api/v1/partner/users/usr_abc123/portfolio/performance?period=1Y&benchmark=SCOM.KE" \
  -H "Authorization: Bearer pk_live_<key>"
```

period (string, optional): 1M | 3M | 6M | 1Y | ALL. Defaults to 1Y.

from (date, optional): Optional inclusive ISO date override.

to (date, optional): Optional inclusive ISO date override.

benchmark (string, optional): Exchange-qualified symbol used for a rebased price-return comparison.

Each point includes `equity`, `marketValue`, `netCashFlow`, `dailyPnl`, `dailyReturn`,
`cumulativeReturn`, and—when requested—`benchmarkReturn` plus `excessReturn`.

## Methodology

- Daily P\&L is `end equity - start equity - net external cash flow`.
- Each interval uses Modified Dietz, weighting completed cash flows by the time remaining in the interval.
- Daily returns are geometrically linked to produce cumulative time-weighted return.
- Sub-account `DEPOSIT` and `WITHDRAWAL` entries are external cash flows.
- Master-account internal transfers and completed top-ups/payouts are adjusted so funding movement is not reported as investment return.
- Benchmark comparison is price return rebased to the first available close. It excludes dividends and FX and must be labelled accordingly.

> Performance is only as complete as the available daily valuation snapshots. Do not fabricate intraday
> returns from delayed quotes, and do not present the benchmark comparison as total return.
