Commit Graph

1 Commits

Author SHA1 Message Date
c4e7b05f09 Fix non-daily rebalancing (never fired), flat-bench beta div-by-zero, nil-token columns
- portfolio._rebalance_dates: Grouper labels groups with period-END
  timestamps (Sundays, month/quarter/year ends) that never exist in a
  trading-day index, so 1W/1ME/QE/YE silently never rebalanced (only
  1D and buy-and-hold worked). Now takes the first trading day of each
  group.
- metrics.beta_alpha: guard var(bench) == 0 (flat benchmark) instead of
  dividing by zero.
- data._read_csv_clean: the downloader has written Go nil tokens
  ('%!f(<nil>)') into price cells (89 symbols, one bad day each), which
  made pandas infer the whole column as string and crash every
  pct_change on any portfolio containing them. Coerce all columns to
  numeric (nil tokens -> NaN); parquet cache rebuilt (0 string cols).
- new tests/test_portfolio.py (18 checks: rebalance dates land on
  trading days and actually fire, flat-benchmark beta, nil-token
  columns), wired into run_tests.sh (now 5 sections).
- full suite: 30 + 22 + 18 + 38 AppTest + 12 browser e2e, all passing
2026-10-24 18:06:38 -04:00