← ClaudeAtlas

lib-alphalenslisted

alphalens-reloaded scores cross-sectional factors, and its forward return starts at date t's OWN price - it never lags your factor. TRIGGER - alphalens, alphalens-reloaded, "import alphalens as al", get_clean_factor_and_forward_returns, compute_forward_returns, factor_information_coefficient, mean_return_by_quantile, factor_returns, quantile_turnover, factor_rank_autocorrelation, create_full_tear_sheet, MaxLossExceededError, max_loss=0.35, cumulative_returns, information coefficient, IC decay, quantile spread, "pip install alphalens". The original quantopian package is dead at 0.4.0 (2020-04-27) and most snippets you recall target it or its removed pandas internals. SKIP for lib-qlib, which is the skill for the feature pipeline and model. SKIP when the question is WHICH library to choose, or names no library at all - both belong to the domain skill.
howard-lynn-ye/fin-skills · ★ 1 · AI & Automation · score 77
Install: claude install-skill howard-lynn-ye/fin-skills
# alphalens-reloaded The de-facto factor-evaluation tool. **Its forward-return convention is the single most common source of overstated factor results**, and it is a default, not a bug. | | | |---|---| | pip / import | `alphalens-reloaded` — **imported as `alphalens`** | | Version | 0.4.6 (2025-06-02); prior 0.4.5 (2024-09-26); 8 releases total. Repo pushed 2025-12-15 | | Licence | Apache-2.0 | | Status | Alive but low-velocity maintenance, not active development. `main` runs ahead of PyPI. 642★ | **The original is dead.** `quantopian/alphalens` — 4,435★, last push 2024-02-12, last PyPI release **0.4.0 (2020-04-27)**, classifiers capped at Python 3.5. **Do not `pip install alphalens`.** Note also the `pandas<3.0,>=1.5.0` pin: on a pandas 3.x environment this holds you back or conflicts. ## The trap that costs you money **`compute_forward_returns` does `pct_change(period).shift(-period)`.** From `src/alphalens/utils.py`: ```python for period in sorted(periods): if cumulative_returns: returns = prices.pct_change(period) else: returns = prices.pct_change() forward_returns = returns.shift(-period).reindex(factor_dateindex) ``` For a factor observed at date `t` with `period=p`, the forward return is **`P[t+p] / P[t] − 1` — it starts accruing from the price at date `t` itself.** **alphalens does not lag your factor for you.** If your factor at `t` comes from `t`'s close — overwhelmingly the common case for any close-based indicator — the `1D` for