zfin/docs/reference/cli/contributions.md
Emil Lerch 74fc219afd
All checks were successful
Generic zig build / build (push) Successful in 5m48s
Generic zig build / publish-macos (push) Successful in 11s
Generic zig build / deploy (push) Successful in 23s
add docs/guides
2026-06-22 14:53:53 -07:00

55 lines
2.2 KiB
Markdown

# `zfin contributions`
Show contributions, withdrawals, and lot-level changes between two
points in your portfolio's **git history**.
```
Usage: zfin contributions [opts]
```
`contributions` diffs two git revisions of your `portfolio.srf` and
attributes the share/lot changes to new money vs. market movement. Your
portfolio must be under git with commits over time.
## Modes
| Invocation | Window |
|-----------------------------|-----------------------------------------------------------|
| (no flags), dirty tree | `HEAD` vs. working copy |
| (no flags), clean tree | `HEAD~1` vs. `HEAD` (review the last commit) |
| `--since <DATE>` | commit at/before DATE vs. HEAD (or working copy if dirty) |
| `--since <D1> --until <D2>` | commit at/before D1 vs. commit at/before D2 |
`--until` alone is rejected (the window is ambiguous). Dates accept
`YYYY-MM-DD` or `1W`/`1M`/`1Q`/`1Y`.
## Options
| Flag | Effect |
|--------------------------|-------------------------------------------------------------------------------------|
| `--since <DATE>` | Earliest side (resolves to commit at/before). |
| `--until <DATE>` | Latest side (pair with `--since`). |
| `--commit-before <SPEC>` | Pin the before commit directly (same grammar as `--commit-after`, minus `working`). |
| `--commit-after <SPEC>` | Pin the after commit: `YYYY-MM-DD`, relative, `HEAD`, `HEAD~N`, SHA, or `working`. |
Pass at most one of `--since`/`--commit-before` (same axis), and at
most one of `--until`/`--commit-after`.
## Example
```bash
zfin contributions --since 1Y
```
Internal transfers between your own accounts are excluded from the
attribution total when declared in
[`transaction_log.srf`](../config/transaction-log-srf.md).
## See also
- [Track contributions](../../guides/track-contributions.md) -- the full workflow.
- [`compare`](compare.md) -- attribution alongside value and price moves.
---
[CLI command reference](index.md)