Event-history protection: backup dir, empty-download fallback, docs

Yahoo's 2026 event-feed change (capitalGain events dropped for some
funds; no events at all for terminated tickers) can wipe good event
history on re-download. Defense in depth:

- overrides/event-backup/: last-known-good copy of every dividend/
  capitalGain file (8,192 files, 58 MB); refresh with
  scripts/backup_events.py after each dump update
- data.py event_file(): frozen > data-root (while populated) > backup;
  used by panel reads, verify_official, and the double-listing scanner
- README: capital-gain files are mutual-fund-only in this dump; Yahoo
  has no LT/ST split (tax.py taxes capg at lt_rate; the per-fund split
  would come from fund-company annual tax statements or commercial feeds)
- tests: exact Timestamp .loc keys (pandas 3.x string matching returns a
  Series on large DatetimeIndex)
This commit is contained in:
gmp
2026-08-31 21:59:25 -04:00
parent e20b2e30cb
commit bb8e39605e
8198 changed files with 585233 additions and 6 deletions
+2 -2
View File
@@ -77,7 +77,7 @@ def main() -> int:
check("initial full build", list(b.adj.columns) == ["aaa", "bbb", "ccc"]
and b.adj["aaa"].iloc[-1] == 109.0, str(list(b.adj.columns)))
check("names from json", b.names.get("bbb") == "Bee Bee Corp")
check("dividend panel", b.div["aaa"].loc["2024-01-05"] == 0.5)
check("dividend panel", b.div["aaa"].loc[pd.Timestamp("2024-01-05")] == 0.5)
# --- modified file: last price changes
f = write_history(root, "aaa", last_price=200.0)
@@ -107,7 +107,7 @@ def main() -> int:
(root / "aaa-dividend.csv").write_text(
"Date,Dividends\n2024-01-05,0.5\n2024-01-06,1.25\n")
b = reload(d)
check("dividend change picked up", b.div["aaa"].loc["2024-01-06"] == 1.25)
check("dividend change picked up", b.div["aaa"].loc[pd.Timestamp("2024-01-06")] == 1.25)
# --- no-change reload: cheap, no rewrite
before = (cache / "panel_adj.parquet").stat().st_mtime_ns