Overnight comprehensive screen: drop the name pre-filter, screen all 2,384 funds

fundlab/RESEARCH.md - running research log: sources that work/die
  (full-index = discovery workhorse; browse-edgar JS-dead;
  investment-company-tickers.json nonexistent; company_tickers.json
  useless for OTC; Yahoo crumb throttled but chart API fine), 13
  hard-won learnings (OTC funds report exchange 'Nasdaq' -> use
  instrumentType; 497 SGML cover uses UNCLOSED line-based tags ->
  parse before tag-stripping; full-index columns drift -> regex the
  line; one quarter != universe -> 4-qtr union; accession paths
  relative to /Archives/ not /Archives/edgar/data/; family CIKs
  repeat -> dedupe by series name; portfolio is 50% MN so MN alpha
  funds are 'correlated', not diversifying).

fundlab/overnight.py - resumable all-stage pipeline (kill/restart safe):
  verify (Yahoo chart per non-local ticker, 4-thread, 429 backoff,
  local tickers measured from CSV row counts) -> select (pure
  select_rows: MUTUALFUND, >=5y, one longest-history class per series
  name, alpha_name as TAG not filter) -> download (goget in 200-sym
  batches) -> screen (streamed, skip-already-done) -> finalize
  (verdict counts + candidates the v1 name-filter would have missed).

Universe: 10,372 class tickers -> 10,260 verified -> 2,384 funds
(407 local, 1,977 external; only 54 match the alpha name pattern -
the v2 point is to screen the other 2,330).

app: alpha table now dedupes by sym with search_all.json winning
(comprehensive superset).
tests: select_rows unit tests (ETF drop, short-history drop, class
collapse, name tagging). 70/70 fundlab.
This commit is contained in:
gmp
2026-08-26 21:33:11 -04:00
parent 592d12958f
commit a94eac6545
5 changed files with 407 additions and 4 deletions
+31
View File
@@ -338,6 +338,36 @@ def test_universe() -> None:
["tickers"] == [], "")
def test_overnight() -> None:
print("overnight select", flush=True)
from fundlab import overnight as ov
tickers = {"AAAAX": "Foo Market Neutral Fund",
"AAAIJ": "Foo Market Neutral Fund", # 2nd class
"BBBAX": "Bar Growth Fund",
"CCCAX": "Baz ETF",
"DDDAX": "Qux Short History"}
meta = {"AAAAX": {"days": 3000, "type": "MUTUALFUND", "name": "x"},
"AAAIJ": {"days": 2500, "type": "MUTUALFUND", "name": "x"},
"BBBAX": {"days": 3000, "type": "MUTUALFUND", "name": "y"},
"CCCAX": {"days": 3000, "type": "ETF", "name": "z"},
"DDDAX": {"days": 500, "type": "MUTUALFUND", "name": "q"},
"EEEAX": {"error": "404"}}
sel = ov.select_rows(tickers, meta, min_days=1250)
check("ETF dropped", [r["sym"] for r in sel].count("cccax") == 0,
str(sel))
check("short history dropped",
[r["sym"] for r in sel].count("dddax") == 0, "")
check("classes collapse to longest",
[r["sym"] for r in sel].count("foo") == 0 and
[r for r in sel if r["name"] == "Foo Market Neutral Fund"]
[0]["sym"] == "aaaax", str(sel))
check("alpha_name tagged", sel[0]["alpha_name"] is True,
str(sel[0]))
check("non-alpha name not tagged (but kept)",
any(r["sym"] == "bbabx" or r["sym"] == "bbbax" and
r["alpha_name"] is False for r in sel), str(sel))
def test_curated() -> None:
print("curated", flush=True)
import fundlab.fundinfo as fi
@@ -361,6 +391,7 @@ def main() -> int:
test_decompose()
test_search()
test_universe()
test_overnight()
test_curated()
test_edgar_live()
print(f"\n{PASS} passed, {FAIL} failed")