factor-and-timeseries-researchlisted
Install: claude install-skill howard-lynn-ye/fin-skills
# Factor research and time-series forecasting
The libraries here are mostly healthy. The danger is that **their default cross-validation and
forward-return conventions do not purge anything**, so a leaky result looks like a clean API call.
## 1. Factor evaluation
### 1.1 alphalens-reloaded — and its forward-return convention
`alphalens-reloaded` 0.4.6 (2025-06-02, Apache-2.0, 642★) is alive but low-velocity. The original
`quantopian/alphalens` is dead (0.4.0, 2020) — do not use it.
🚨 **Verified in source:** `compute_forward_returns` does `pct_change(period).shift(-period)`, so
**the forward return for date *t* starts at *t*'s own price.** It never lags your factor. If your
factor is computed from date *t*'s close, alphalens is scoring you as if you traded that same close.
**Fix: lag the factor yourself before passing it in** — `factor.groupby(level=1).shift(1)` — or
build forward returns from the next open. The IC alphalens reports on an unlagged close-based factor
is not achievable.
### 1.2 Qlib Alpha158 / Alpha360
`pyqlib` 0.9.7 (MIT, 48,255★). ✅ **The label is `Ref($close,-2)/Ref($close,-1)-1`** — deliberately
leakage-safe: it trades at T+1's close and measures to T+2, so the signal at T is never scored
against a price it could see.
🚨 **The real trap is normalization:** `ZScoreNorm` is fit over `fit_start_time..fit_end_time`. Pass
the full sample and you leak the test distribution into every feature, silently. Set the fit window
to your training period only.
##