S1-5: Eligibility rules in one place #38
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
epic:E1-foundation
epic:E2-correct-metrics
epic:E3-fast-jobs
epic:E4-cli
epic:E5-web-ui
epic:E6-history
good first issue
help wanted
invalid
question
sprint-tracking
story
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ckreidl/screener!38
Loading…
Reference in a new issue
No description provided.
Delete branch "10-eligibility-rules"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
🤖 Claude: Closes #10
Fixes #2 (6-month window), #3 (EBIT ≤ 0 ranked), #5 (old prices ranked).
What changed
src/eligibility.ts(new) is the one definition. A company is eligible when its latest 10-K was filed within 13 months, EBIT > 0, it has a price from this run (so it has a ticker), market cap ≥ $50M, and its sector is not Financial Services or Utilities.isEligibleForPricingis the same rule without the parts that need a price.enrich-prices.tsprices exactly the companies that passisEligibleForPricing. Companies with no ticker mapping now have their old price cleared instead of kept (#5).export-ranking.tsfilters withisEligible. The filter and the rank columns moved from SQL into TypeScript (same results as SQLRANK()). The earnings-yield SQL is unchanged.analyze.tsuses the shared 13-month freshness check instead of its own 395 days.77cbcffonly formats the three scripts, so the fix commit (71cd460) diffs cleanly.Acceptance criteria
test/eligibility.test.ts:Real data (Nov 5
data/, run on a copy ofcompany_facts.db)Enrichment: 1,577 priced, 86 with no ticker mapping, 5 with no quote.
Definition of Done
bun testpasses; new logic has tests: 139 pass, 0 fail (19 new)bun checkis clean andbun fmt --checkpasses: no type errors; all changed files formattedanalyze→enrich→exporton all 20,547 files, 0 errorsDecided on this PR
Found, not fixed (new issue)
🤖 Generated with Claude Code
Code review
No issues found. Checked for bugs and CLAUDE.md compliance.
If there's no ticker then we can probably exclude them as we can't really act on them anyway.
It sounds like addressing #37 will fix most of these.
🤖 Claude: Done in the latest commit. Companies with no price from this run are now ineligible. That covers no ticker (86) and also the 5 that have a ticker but got no quote from Yahoo, since #5 expects a price from this run for every ranked company. If you'd rather keep those 5, the rule can check for a ticker instead.
Real data: ranked goes from 1,413 to 1,367, and none are left without a price. Sector rule unchanged; #37 is the fix there. Tests: 139 pass;
bun checkandbun fmt --checkclean. PR description updated.