zfin/docs/reference/cli/enrich.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

48 lines
1.5 KiB
Markdown

# `zfin enrich`
Bootstrap a [`metadata.srf`](../config/metadata-srf.md) classification
file from public Wikidata + SEC EDGAR data.
```
Usage: zfin enrich [SYMBOL]
```
Requires `ZFIN_USER_EMAIL` (SEC EDGAR needs a contact address). Two
modes:
- **Portfolio mode** (no argument) -- classify every stock symbol in
your portfolio and write a complete SRF file to stdout. Honors the
global `-p` flag for file selection.
- **Symbol mode** (one `SYMBOL`) -- emit one appendable line for a
single symbol.
## Sources
- **Wikidata SPARQL** -- sector / industry / country / asset class,
plus a CIK lookup for the EDGAR call.
- **EDGAR XBRL company facts** -- shares outstanding, combined with the
latest cached close to derive market-cap size buckets for US stocks.
- **EDGAR mutual-fund ticker map** -- fallback when Wikidata has no
entry (open-end funds aren't exchange-listed); fills in
`geo::US,asset_class::Fund`.
## Examples
```bash
zfin enrich > metadata.srf # whole portfolio (default file)
zfin -p sample enrich > metadata.srf # whole portfolio (named file)
zfin enrich AAPL >> metadata.srf # append a single symbol
zfin enrich fagix >> metadata.srf # symbol is auto-uppercased
```
Always review the output before saving -- symbols that miss both
sources come through as `TODO` lines to complete by hand.
## See also
- [Classify your holdings](../../guides/classify-holdings.md) -- the workflow.
- [`metadata.srf` reference](../config/metadata-srf.md) -- the file this produces.
---
[CLI command reference](index.md)