You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Identifies positions that can be sold without triggering significant short-term capital gains. Walks each symbol's FIFO lots in date order and stops when a lot's unrealized short-term capital gain meets or exceeds the `safe_sell.max_stcg` threshold from `ibctl.yaml`. Lots before the stop point are sellable if they represent a capital loss or a long-term capital gain.
8
+
9
+
This is useful for portfolio simplification: sell individual positions to harvest losses or realize long-term gains at favorable rates, then reinvest proceeds into core index fund allocations.
10
+
11
+
## Account combining (IRS vs CRA)
12
+
13
+
By default, lots from all accounts for the same symbol are merged into a single FIFO queue sorted by date. This is the IRS-correct behavior for individuals whose accounts include disregarded entities (e.g., single-member LLCs) — the IRS treats all disregarded-entity holdings as the individual's own, so FIFO matching spans all accounts.
14
+
15
+
Use `--separate-accounts` for CRA-style treatment where each account is an independent entity with its own FIFO queue. The same symbol may appear multiple times in the output (once per account) with different P&L. An ACCOUNT column is shown in this mode.
16
+
17
+
## Exclusions
18
+
19
+
Symbols and asset types listed under `safe_sell.exclude` in `ibctl.yaml` are always omitted from output. Use `safe_sell.exclude.symbols` for specific tickers (e.g., VTI, VXUS) and `safe_sell.exclude.types` for entire asset types (e.g., BOND, HOUSE). Types are matched against the `type` field from the `categorization` config.
20
+
21
+
## STCG threshold
22
+
23
+
The `safe_sell.max_stcg` setting in `ibctl.yaml` controls tolerance for short-term capital gains per lot, denominated in the base currency. At the default of 0, any lot with positive STCG stops the FIFO walk for that symbol. Setting `max_stcg` to 3000 allows lots with up to $3000 of STCG to pass through, which prevents small STCG lots from blocking access to loss or LTCG lots behind them in the queue.
24
+
25
+
## Columns
26
+
27
+
| Column | Description |
28
+
|--------|-------------|
29
+
| SYMBOL | Ticker symbol |
30
+
| ACCOUNT | Account alias (only shown with `--separate-accounts`) |
31
+
| QTY | Total quantity across all sellable lots |
32
+
| QTY REMAINING | Quantity not included because the FIFO walk was stopped by a lot exceeding the STCG threshold. Zero means all lots for this symbol are sellable. |
33
+
| CURRENCY | Native currency of cost basis and market price |
34
+
| AVG PRICE | Weighted average cost basis per share in native currency |
35
+
| MKT PRICE | Current market price per share in native currency |
36
+
| MKT VAL {BASE} | Total current market value of sellable lots in base currency |
37
+
| P&L {BASE} | Total unrealized P&L of sellable lots in base currency |
38
+
| STCG {BASE} | Short-term portion of unrealized P&L in base currency |
39
+
| LTCG {BASE} | Long-term portion of unrealized P&L in base currency |
40
+
| CATEGORY | User-defined asset category from configuration |
41
+
| TYPE | User-defined asset type |
42
+
| SECTOR | User-defined sector classification |
43
+
| GEO | User-defined geographic classification |
44
+
45
+
`{BASE}` is replaced with the `--base-currency` value (e.g., `MKT VAL USD`, `P&L CAD`).
46
+
47
+
## Sort order
48
+
49
+
Results are sorted by P&L ascending (losses first, then gains by size).
50
+
51
+
## Totals row
52
+
53
+
The table output includes a totals row summing MKT VAL {BASE}, P&L {BASE}, STCG {BASE}, and LTCG {BASE}.
54
+
55
+
## Configuration
56
+
57
+
The safe-sell command reads its exclusions and STCG threshold from `ibctl.yaml`:
58
+
59
+
```yaml
60
+
safe_sell:
61
+
exclude:
62
+
symbols:
63
+
- VTI
64
+
- VXUS
65
+
- BND
66
+
types:
67
+
- BOND
68
+
- HOUSE
69
+
max_stcg: 3000
70
+
```
71
+
72
+
See the [Configuration](../configuration.md) page for full details on the `safe_sell` section.
73
+
74
+
## Examples
75
+
76
+
```bash
77
+
# Strict mode: no STCG tolerance, real-time prices
78
+
ibctl holding safe-sell list --realtime
79
+
80
+
# Per-account FIFO (CRA-style), JSON output
81
+
ibctl holding safe-sell list --realtime --separate-accounts --format json
82
+
83
+
# CSV output in CAD
84
+
ibctl holding safe-sell list --realtime --base-currency CAD --format csv
Copy file name to clipboardExpand all lines: book/src/configuration.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,19 @@ additions:
80
80
realtime_symbols:
81
81
BRK B: BRK-B
82
82
"700": "0700.HK"
83
+
84
+
# Safe-sell screener configuration.
85
+
# Optional. Controls which positions appear in "holding safe-sell list" output.
86
+
safe_sell:
87
+
exclude:
88
+
symbols:
89
+
- VTI
90
+
- VXUS
91
+
- BND
92
+
types:
93
+
- BOND
94
+
- HOUSE
95
+
max_stcg: 3000
83
96
```
84
97
85
98
## Field Reference
@@ -163,3 +176,19 @@ If tax rates are not set, they default to zero and no tax impact is shown. The `
163
176
| Value (Yahoo symbol) | The equivalent symbol on Yahoo Finance | `BRK-B`, `0700.HK` |
164
177
165
178
US-listed securities typically need no mapping. If a symbol is not mapped and Yahoo Finance cannot resolve the IBKR symbol, the command logs a warning and falls back to the cached IBKR price for that symbol.
179
+
180
+
### `safe_sell`
181
+
182
+
**Optional.** Configuration for the `holding safe-sell list` command, which identifies positions safe to sell from a tax perspective. See the [holding safe-sell list](commands/holding-safe-sell-list.md) command documentation for full details.
183
+
184
+
#### `safe_sell.exclude.symbols`
185
+
186
+
A list of ticker symbols to always exclude from safe-sell output. Use this for core index fund positions you intend to hold regardless of tax treatment (e.g., VTI, VXUS, BND).
187
+
188
+
#### `safe_sell.exclude.types`
189
+
190
+
A list of asset types to always exclude from safe-sell output. Matched against the `type` field from the `categorization` config, normalized to uppercase. For example, `BOND` excludes all symbols categorized with `type: BOND`, and `HOUSE` excludes symbols with `type: HOUSE`.
191
+
192
+
#### `safe_sell.max_stcg`
193
+
194
+
The maximum acceptable short-term capital gain per lot, denominated in the base currency specified by `--base-currency` (default USD). Lots with STCG at or above this amount stop the FIFO walk for that symbol. Defaults to 0, which means any lot with positive STCG stops the walk. Setting this to 3000 allows lots with up to $3000 of STCG to pass through, preventing small STCG lots from blocking access to loss or LTCG lots behind them in the queue.
0 commit comments