Skip to main content
← Back to projects
Rule #1 Investment Analyzer banner

Rule #1 Investment Analyzer

MVP Complete — 27/27 Stories

An automated implementation of Phil Town's Rule #1 investment methodology — the first comprehensive open-source tool of its kind.

The platform fetches real financial data from SEC EDGAR (free, no API key), calculates the Big 5 Numbers (ROIC, Sales/EPS/Equity/FCF Growth), computes Sticker Price with Margin of Safety, and determines Payback Time.

Features include automatic stock split detection and normalization, SQLite caching for fast repeat analyses, portfolio tracking, stock screening across multiple tickers, and comprehensive data validation.

Built in a single 90-minute sprint using AI agent orchestration: 6 waves of parallel Sonnet workers shipping code while Opus coordinated architecture and quality. 27 user stories across 4 epics, 176 tests passing.

Architecture

Rule #1 Investment Analyzer architecture diagram

Tech Stack

Python 3.12Typer CLIRichSQLAlchemySQLiteSEC EDGAR APIYahoo Finance

Key Features

  • Full Phil Town Rule #1 analysis (Big 5, Sticker Price, MOS, Payback Time)
  • SEC EDGAR XBRL integration (free, 10+ years of data)
  • Automatic stock split detection and EPS normalization
  • Stock screening across 20+ tickers
  • Portfolio management with gain/loss tracking
  • SQLite caching with configurable staleness
  • Data validation and consistency checks
  • API health monitoring and rate limiting
  • Rich terminal output with color-coded recommendations

Challenges

The biggest challenge was data inconsistency across SEC filings — different companies report the same financial metrics under different names. We solved this by merging all matching data tags and selecting the source with the most historical coverage. Stock splits also distort earnings history, so the tool auto-detects splits by correlating share count jumps with earnings drops and normalizes the data automatically.