3.2 KiB
zfin import
Synthesize a portfolio file from a brokerage positions export. Designed for managed accounts (direct-indexing baskets, accounts you don't track at lot granularity).
Usage: zfin -p <PORTFOLIO> import (--fidelity FILE | --schwab FILE | --wells-fargo FILE) [-y]
Each run replaces the target portfolio file with lots drawn from the export:
- Fidelity and Schwab exports are per-position, so each (account, symbol) becomes one synthetic lot. Per-buy history is lost; git serves as the file-level history.
- Wells Fargo exports list every tax lot, so each WF lot becomes a lot with its real trade date and cost. One WF file covers every account in the household.
Re-import merge: when the target already exists, lots still present
in the new export keep their prior note:: and every hand-edited field
(ticker::, label::, price::, price_ratio::, drip::, ...), so
git diff flags only genuine brokerage changes. A lot whose export row
has no buy date (every Fidelity/Schwab position, and a Wells Fargo
Intra-Day fund) also keeps its prior open_date and open_price; new
ones get an open_date::1970-01-01 sentinel. Disappeared positions are
dropped.
Options
| Flag | Effect |
|---|---|
-p, --portfolio <FILE> |
Target file (a single concrete path, not a glob). Required. |
--fidelity <CSV> |
Fidelity positions CSV. |
--schwab <CSV> |
Schwab per-account positions CSV. |
--wells-fargo <XLS> |
Wells Fargo positions spreadsheet (- for stdin). See below. |
-y, --yes |
Don't prompt before overwriting an existing file. |
Account resolution needs an accounts.srf
next to the target with institution:: + account_number:: entries
matching the export; import refuses to write when an export account is
unmapped.
A target that doesn't exist yet is created in the current directory, so run a first import from the portfolio's own directory.
Wells Fargo
On the WF site, download the positions spreadsheet with Download
Type "Portfolio-Expanded Detail", Portfolio View "Positions", for
all brokerage accounts. It saves as WFA_Portfolio_Positions_*.xls.
- "Portfolio-Collapsed Detail" has no per-lot rows; import rejects it.
- Each row names its account as
*1234; map it withinstitution::wells_fargo,account_number::1234. - Cash is one lot per account: cash balance, sweep, and accrued interest combined, matching WF's own cash total.
Example
zfin -p portfolio_managed.srf import --fidelity ~/Downloads/Portfolio_Positions.csv
zfin -p portfolio_wells_fargo.srf import --wells-fargo ~/Downloads/WFA_Portfolio_Positions_100326_1247.xls
See also
audit-- reconcile an existing portfolio against an export instead of replacing it.- Map your accounts -- the institution/number mapping import needs.