Skip to content

[Watchlists] Sector sweep ranked summary table — HTML + Markdown output for batch runs #40

Description

@DogInfantry

Part of epic: #31
Depends on: #39 (--sector CLI flag must exist first)

What

When --sector is used, generate a ranked summary table across all tickers in the sweep in addition to individual stock notes. Output in both HTML and Markdown formats. This is the key demo artifact: a single file that shows the engine operating at institutional scale.

Output format

Technology Sector Sweep — 2026-04-16
┌────────┬─────────┬─────────┬─────────┬──────────┬──────────────┐
│ Rank   │ Ticker  │ Rating  │ TP ($)  │ Score    │ Key Driver   │
├────────┼─────────┼─────────┼─────────┼──────────┼──────────────┤
│ 1      │ NVDA    │ BUY     │ 950     │ 92/100   │ AI capex     │
│ 2      │ MSFT    │ BUY     │ 520     │ 88/100   │ Cloud growth │
│ 3      │ AAPL    │ HOLD    │ 210     │ 74/100   │ Services mix │
│ ...    │ ...     │ ...     │ ...     │ ...      │ ...          │
└────────┴─────────┴─────────┴─────────┴──────────┴──────────────┘

Implementation

def generate_sector_sweep_table(results: list[dict], sector: str) -> dict:
    """
    results: list of per-ticker pipeline output dicts, sorted by score desc
    Returns: {'html': str, 'markdown': str}
    """
    sorted_results = sorted(results, key=lambda x: x['score'], reverse=True)
    # build HTML table with color-coded rating cells
    # build Markdown table
    ...

Output files

  • outputs/sector_{sector}_sweep_{date}.html
  • outputs/sector_{sector}_sweep_{date}.md
  • outputs/demo/sector_technology_sweep.html (committed demo)

Acceptance Criteria

  • Sweep table generated automatically when --sector flag used
  • Table sorted by screener score descending
  • Rating cells colour-coded (BUY=green, HOLD=grey, SELL=red) in HTML
  • Both HTML and Markdown outputs saved to outputs/
  • Demo sweep committed to /outputs/demo/sector_technology_sweep.html
  • Table renders correctly on GitHub (Markdown version)

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