Use the SEC SIC code when Yahoo has no sector (#45) #47
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!47
Loading…
Reference in a new issue
No description provided.
Delete branch "45-sic-sector-fallback"
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 #45
Implements option 2 from the issue, as agreed in Chris's comment.
What changes
src/sic.ts(sectorFromSic): maps an SEC SIC code to a sector. Financial Services is 6000–6499 and 6700–6799. Utilities is 4900–4949 and 4960–4999. Real estate (6500–6599) and waste management (4950–4959) are not excluded. Any other code gets SEC's own description, e.g. "Services-Prepackaged Software".enrich-prices.ts: when Yahoo returns a quote with no sector, it readssicandsicDescriptionfromdata.sec.gov/submissions/CIK##########.json. That happens only for quotes with no sector, so it adds a few requests per run. The log line marks these sectors with(SIC).src/eligibility.ts: a company with no sector from either source is now excluded. The issue's question 3 wasn't answered in the comment, so this uses my suggestion from the investigation. It's a one-line change if you'd rather rank them.Expected on real data: WELPP is excluded as a utility (SIC 4911) and SWKHL as financial (SIC 6159). FISV, LION and NIQ stay ranked, with SEC's description as their sector.
Definition of Done
test/sic.test.tscovers WELPP's and SWKHL's codes, every range boundary, the real-estate and waste carve-outs, and missing or invalid codes.test/eligibility.test.tsnow has "unknown sector is ineligible (#45)".bun testpasses; new logic has tests: 188 pass, 0 failbun checkis clean andbun fmt --checkpasses: no type errors in 19 files; all changed files are formattedbun run enrich && bun run export, then check that WELPP and SWKHL are gone and FISV, LION and NIQ are still ranked. The SEC submissions response shape (sicas a string) wasn't live-checked from this session.🤖 Generated with Claude Code
confirmed WELPP and SWKHL are gone, FISV, LION, NIQ still present.