Skip to content

[Watchlists] --sector CLI flag — run pipeline across a full GICS sector universe #39

Description

@DogInfantry

Part of epic: #31
Depends on: #38 (WatchlistManager must exist first)

What

Add --sector and --sector all arguments to pipeline_v2.py so users can run the pipeline across a full GICS sector instead of specifying individual tickers. Preserves existing --tickers behaviour.

CLI usage

# Run pipeline across all Technology sector tickers
python pipeline_v2.py --sector technology

# Run across all 11 sectors (deduplicating cross-listed names)
python pipeline_v2.py --sector all

# Existing behaviour preserved
python pipeline_v2.py --tickers AAPL MSFT NVDA

Implementation

parser.add_argument('--sector', type=str, default=None,
    help='GICS sector name or "all" to run across full sector universe')

# In main:
if args.sector:
    wm = WatchlistManager()
    if args.sector == 'all':
        tickers = wm.get_all_tickers()
    else:
        tickers = wm.get_sector(args.sector)
        if not tickers:
            raise ValueError(f'Unknown sector: {args.sector}. Available: {wm.list_sectors()}')
elif args.tickers:
    tickers = args.tickers
else:
    tickers = WatchlistManager().get_sector('technology')  # sensible default

Acceptance Criteria

  • --sector technology runs pipeline on all 8 Technology tickers
  • --sector all runs on full deduplicated universe without crashing
  • --sector nonexistent raises clear ValueError with list of valid sectors
  • --tickers flag still works (no regression)
  • Both flags cannot be used simultaneously (argparse mutual exclusion group)
  • README documents --sector with 3 usage examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions