zfin/docs/reference/cli/portfolio.md

86 lines
3 KiB
Markdown

# `zfin portfolio`
Load and analyze your portfolio: positions, valuations, cash, and
watchlist.
```
Usage: zfin portfolio [FILE]
```
Reads `portfolio.srf` (or the `-p` pattern / `[FILE]` argument) and
prints a summary: total value, cost, and gain/loss; trailing historical
returns; a per-position table with lot detail; and a cash-by-account
section. Watchlist symbols, if any, appear at the bottom.
## Example
```bash
ZFIN_HOME=examples/pre-retirement-both zfin portfolio
```
```
Portfolio Summary (examples/pre-retirement-both/portfolio.srf)
========================================
Value: $1,383,137.81 Cost: $658,837.01 Gain/Loss: +$724,300.80 (109.9%)
Yesterday: -$1,845.22 (-0.13%)
Lots: 13 open, 0 closed Positions: 5 symbols
Historical: 1M: +3.2% 3M: +13.3% 1Y: +24.5% 3Y: +56.4% 5Y: +56.1% 10Y: +182.6%
Symbol Shares Avg Cost Price Market Value Gain/Loss Weight ...
VTI 2480.0 $138.35 $373.38 $925,982.40 + $582,874.40 66.9%
open 1100.0 $140.00 $410,718.00 + $256,718.00 2018-06-15 LT Pat 401k
...
Cash
Account Balance Note
Joint taxable $48,000.00
...
```
Manual-priced rows render in warning color (the price may be stale).
### The session-change line
The second line is the move over a single trading session -- a brokerage
"day change". It covers equity holdings only; cash, CDs and options have
no daily price move and contribute zero. The percentage is measured
against the *previous session's whole account value*, cash included, so
it is comparable with the Gain/Loss percentage above it.
**The label names the session it describes, which is not always today:**
| label | meaning |
|-------|---------|
| `Day` | prices are from today -- live quotes, or today's close once it has posted |
| `Yesterday` | the newest prices available are yesterday's close |
| `2026-08-21` | older still: a weekend, a holiday, or a stale cache |
So a `zfin portfolio` run during Tuesday's session normally shows
`Yesterday`, because it prices from cached closes and Tuesday's bar does
not exist yet. In the TUI's live mode (`L`) it shows `Day`, updating as
ticks arrive.
A trailing marker appears when a security that *should* have a daily
price series didn't have one, and names the market value the figure is
therefore short by:
```
Day: +$12,345.67 (+0.85%) [$1.2M no history]
```
Holdings you price by hand with `price::` are **not** counted as a gap --
they can never have a daily series, so flagging them every run would be
noise. They already render in warning color. The marker is reserved for
the fixable case: try [`zfin doctor`](doctor.md) or
[`zfin cache stale`](cache.md) to find out why a security has no candle
history.
## See also
- [Read your portfolio](../../guides/read-your-portfolio.md) -- how to interpret this.
- [`portfolio.srf` reference](../config/portfolio-srf.md) -- the input file.
- [`analysis`](analysis.md) -- allocation breakdowns.
---
[CLI command reference](index.md)