zfin/docs/reference/cli/history.md

61 lines
2 KiB
Markdown

# `zfin history`
Two modes in one command, selected by whether you pass a symbol.
```
Usage:
zfin history <SYMBOL> # last 30 days of candles
zfin history [flags] # portfolio-value timeline
```
## Symbol mode
With a positional symbol, shows the last 30 trading days of OHLCV
candles:
```bash
ZFIN_HOME=examples/pre-retirement-both zfin history VTI
```
```
Price History for VTI (last 30 days)
========================================
Date Open High Low Close Volume
2026-06-04 370.62 373.99 370.36 373.38 3,111,996
...
```
## Portfolio mode
With no symbol, reads your `history/*-portfolio.srf` snapshots and
renders rolling-window returns, a chart, and a recent-snapshots
table. (Build that history with [`snapshot`](snapshot.md).)
The chart renders as an inline Kitty image when your terminal supports
it, falling back to braille otherwise. Force a mode with the global
[`--chart`](index.md) flag (`auto` / `braille` / `WxH`).
| Flag | Effect |
|-----------------------|-------------------------------------------------|
| `--since <DATE>` | Earliest as-of date (inclusive). |
| `--until <DATE>` | Latest as-of date (inclusive). |
| `--metric <name>` | `liquid` (default), `illiquid`, or `net_worth`. |
| `--resolution <name>` | `daily` \| `weekly` \| `monthly` \| `auto`. |
| `--limit <N>` | Cap the recent-snapshots table (default 40). |
| `--rebuild-rollup` | Regenerate `history/rollup.srf` and exit. |
Dates accept `YYYY-MM-DD` or relative shortcuts (`1W`/`1M`/`1Q`/`1Y`).
```bash
ZFIN_HOME=examples/post-retirement zfin history --metric net_worth --since 1Y
```
## See also
- [Snapshots and history](../../guides/snapshots-and-history.md) -- the workflow.
- [`compare`](compare.md) -- diff two specific dates.
- [`snapshot`](snapshot.md) -- record the data this reads.
---
[CLI command reference](index.md)