@@ -37,6 +37,8 @@ const (
3737 realtimeFlagName = "realtime"
3838 // separateAccountsFlagName is the flag name for per-account FIFO (CRA-style).
3939 separateAccountsFlagName = "separate-accounts"
40+ // excludedFlagName is the flag name for showing only config-excluded positions.
41+ excludedFlagName = "excluded"
4042)
4143
4244// NewCommand returns a new safe-sell list command.
@@ -73,10 +75,15 @@ ACCOUNT column is shown in this mode.
7375EXCLUSIONS
7476
7577Symbols and asset types listed under safe_sell.exclude in ibctl.yaml are
76- always omitted. Use safe_sell.exclude.symbols for specific tickers (e.g.,
77- VTI, VXUS) and safe_sell.exclude.types for entire asset types (e.g., BOND,
78- HOUSE). Types are matched against the type field from the categorization
79- config.
78+ omitted by default. Use safe_sell.exclude.symbols for specific tickers
79+ (e.g., VTI, VXUS) and safe_sell.exclude.types for entire asset types
80+ (e.g., BOND, HOUSE). Types are matched against the type field from the
81+ categorization config.
82+
83+ Use --excluded to invert the filter and show only the excluded positions.
84+ The same FIFO analysis is run on them so you can see what you would be
85+ selling if they were not excluded. The results of safe-sell, safe-sell
86+ --excluded, and unsafe-sell together cover the full holding list.
8087
8188STCG THRESHOLD
8289
@@ -130,6 +137,8 @@ type flags struct {
130137 Realtime bool
131138 // SeparateAccounts applies FIFO independently per account (CRA-style).
132139 SeparateAccounts bool
140+ // Excluded shows only positions excluded by config instead of the safe-sell candidates.
141+ Excluded bool
133142}
134143
135144func newFlags () * flags {
@@ -143,6 +152,7 @@ func (f *flags) Bind(flagSet *pflag.FlagSet) {
143152 flagSet .StringVar (& f .BaseCurrency , baseCurrencyFlagName , "USD" , "Base currency for value conversion (e.g., USD, CAD)" )
144153 flagSet .BoolVar (& f .Realtime , realtimeFlagName , false , "Fetch real-time quotes and FX rates from Yahoo Finance" )
145154 flagSet .BoolVar (& f .SeparateAccounts , separateAccountsFlagName , false , "Apply FIFO independently per account (CRA-style)" )
155+ flagSet .BoolVar (& f .Excluded , excludedFlagName , false , "Show only positions excluded by config (inverse of default output)" )
146156}
147157
148158func run (ctx context.Context , container appext.Container , flags * flags ) error {
@@ -204,6 +214,7 @@ func run(ctx context.Context, container appext.Container, flags *flags) error {
204214 fxStore ,
205215 baseCurrency ,
206216 flags .SeparateAccounts ,
217+ flags .Excluded ,
207218 )
208219 if err != nil {
209220 return err
0 commit comments