Skip to content

"Vibe-Trading: Your Personal Trading Agent"

feat(factors): port 452 alphas across 4 zoos

Haozhe Wu94c2a8ffb232
diff --git a/agent/src/factors/zoo/academic/LICENSE.md b/agent/src/factors/zoo/academic/LICENSE.md
new file mode 100644
index 000000000..e5db6c863
--- /dev/null
+++ b/agent/src/factors/zoo/academic/LICENSE.md
@@ -0,0 +1,64 @@
+# Academic Baseline Factors — Attributions and Stance
+
+This subdirectory contains price-based proxies for the canonical academic
+factor portfolios used as long-short benchmarks in the empirical
+asset-pricing literature. None of the original papers' prose is reproduced
+here.
+
+## Source attributions
+
+- Sharpe, W. F. (1964). "Capital Asset Prices: A Theory of Market
+ Equilibrium under Conditions of Risk." *The Journal of Finance*,
+ 19(3), 425-442. — market factor (MKT-RF).
+- Fama, E. F., & French, K. R. (1993). "Common risk factors in the
+ returns on stocks and bonds." *Journal of Financial Economics*,
+ 33(1), 3-56. — SMB (size) and HML (value).
+- Carhart, M. M. (1997). "On persistence in mutual fund performance."
+ *The Journal of Finance*, 52(1), 57-82. — UMD (momentum).
+- Fama, E. F., & French, K. R. (2015). "A five-factor asset pricing
+ model." *Journal of Financial Economics*, 116(1), 1-22. — RMW
+ (profitability) and CMA (investment).
+- Hou, K., Xue, C., & Zhang, L. (2015). "Digesting anomalies: An
+ investment approach." *Review of Financial Studies*, 28(3), 650-705.
+ — Q-factor model (referenced for completeness; not implemented
+ separately because the investment and profitability legs overlap
+ with RMW / CMA in our OHLCV-only setting).
+
+## Disclosure: these are price-based proxies, not the original factors
+
+The implementations in this directory use only OHLCV panel inputs.
+The original factor portfolios use fundamental data (book equity,
+operating profitability, asset growth) that we do not carry in the
+panel. We therefore replace each fundamental input with a price- or
+volume-derived proxy:
+
+- MKT-RF: 21-day per-stock total return (vs. value-weighted excess
+ market return in the original).
+- SMB: negative log of 60-day average dollar volume (vs. market
+ capitalization in the original).
+- HML: negative 252-day return (vs. book-to-market sort in the
+ original).
+- RMW: negative 60-day return volatility (vs. operating profitability
+ sort in the original).
+- CMA: negative 60-day change in log average volume (vs. asset-growth
+ sort in the original).
+- Carhart UMD: 12-month minus 1-month return (matches the original
+ construction; cross-sectional z-score added for ranking).
+
+Each module's `notes` field repeats this disclosure inline. Users
+backtesting these factors as research-grade replacements for the
+published series should obtain the authoritative monthly return series
+from Kenneth French's data library:
+
+ https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html
+
+We link to that resource and do not copy any of its data files.
+
+## Stance on factor definitions
+
+Factor definitions are mathematical / academic concepts and are not
+copyrightable. We re-state each factor as a cross-sectional ranking
+signal in our own words and our own code. None of the original papers'
+prose, tables, or figures is reproduced. The Kenneth French data
+library's return series are owned by their authors and remain
+externally hosted.
diff --git a/agent/src/factors/zoo/academic/__init__.py b/agent/src/factors/zoo/academic/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/agent/src/factors/zoo/academic/carhart_mom.py b/agent/src/factors/zoo/academic/carhart_mom.py
new file mode 100644
index 000000000..ab9d4dd9d
--- /dev/null
+++ b/agent/src/factors/zoo/academic/carhart_mom.py
@@ -0,0 +1,59 @@
+"""academic Carhart momentum: 12-month return excluding the most recent month.
+
+Reference:
+ Carhart, M. M. (1997). "On persistence in mutual fund performance."
+ The Journal of Finance, 52(1), 57-82.
+
+This is the canonical UMD (Up Minus Down) momentum factor: trailing 12-month
+return less the most recent month, capturing intermediate-term momentum while
+avoiding short-term reversal contamination. Computed directly from prices —
+no fundamental data required — so this matches the original construction
+modulo the cross-sectional z-score wrapper used for long-short ranking.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import delta, safe_div
+
+__alpha_meta__ = {
+ 'id': 'academic_carhart_mom',
+ 'nickname': 'Carhart 1997 momentum — 12m-1m return',
+ 'theme': ['momentum'],
+ 'formula_latex': r'\mathrm{zscore}_{x}\bigl((\mathrm{close}_t - \mathrm{close}_{t-252})/\mathrm{close}_{t-252} - (\mathrm{close}_t - \mathrm{close}_{t-21})/\mathrm{close}_{t-21}\bigr)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 252,
+ 'notes': (
+ 'Carhart (1997) UMD momentum factor. 12-month return minus 1-month return, '
+ 'cross-sectional z-score per date for long-short ranking. Top z-scores = '
+ 'winners. Constructed directly from prices, so this matches the original '
+ 'definition modulo the z-score wrapper. Canonical 252d window; declared '
+ 'decay_horizon=60 due to registry schema cap (le=60); real signal horizon=252.'
+ ),
+}
+
+
+def _cross_sectional_zscore(df: pd.DataFrame) -> pd.DataFrame:
+ """Per-row z-score: (x - row_mean) / row_std; zero/NaN std rows -> NaN."""
+ mean = df.mean(axis=1, skipna=True)
+ std = df.std(axis=1, ddof=1, skipna=True)
+ centered = df.sub(mean, axis=0)
+ result = centered.div(std.where(std > 0), axis=0)
+ return result.replace([np.inf, -np.inf], np.nan)
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return 252-day minus 21-day return z-score (Carhart UMD).
+
+ Uses canonical (252, 21) windows without silent shrink on short panels.
+ Short panels produce all-NaN; the registry surfaces this as >95% NaN
+ (RegistryError) rather than returning a misleading shrunk-window value.
+ """
+ close = panel['close']
+ ret_long = safe_div(delta(close, 252), close.shift(252))
+ ret_short = safe_div(delta(close, 21), close.shift(21))
+ return _cross_sectional_zscore(ret_long - ret_short)
diff --git a/agent/src/factors/zoo/academic/cma.py b/agent/src/factors/zoo/academic/cma.py
new file mode 100644
index 000000000..849a89803
--- /dev/null
+++ b/agent/src/factors/zoo/academic/cma.py
@@ -0,0 +1,61 @@
+"""academic CMA: investment factor as inverse 60-day volume growth.
+
+Reference:
+ Fama, E. F., & French, K. R. (2015). "A five-factor asset pricing model."
+ Journal of Financial Economics, 116(1), 1-22.
+
+This is a price-based proxy: the original CMA (Conservative Minus Aggressive)
+sorts on asset growth from balance-sheet data. We use the negative of 60-day
+log-volume change — firms aggressively scaling activity tend to show rising
+trading volume; conservative firms show stable / shrinking volume. Higher
+z-scores = volume contraction (conservative).
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import delta, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'academic_cma',
+ 'nickname': '[PRICE PROXY] FF2015 CMA — investment via inverse volume growth',
+ 'theme': ['quality'],
+ 'formula_latex': r'\mathrm{zscore}_{x}\bigl(-\Delta_{60}\log(\mathrm{ts\_mean}(\mathrm{volume},\,60) + 1)\bigr)',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 120,
+ 'notes': (
+ '[PRICE PROXY] for the Fama-French (2015) CMA (Conservative Minus '
+ 'Aggressive) investment factor. The original definition uses total-asset '
+ 'growth from fundamental data; here we use the negative 60-day change in '
+ 'log average volume as an activity-growth proxy, then cross-sectional '
+ 'z-score per date for long-short ranking. Top z-scores = volume contraction '
+ '(conservative / low-growth proxy).'
+ ),
+}
+
+
+def _cross_sectional_zscore(df: pd.DataFrame) -> pd.DataFrame:
+ """Per-row z-score: (x - row_mean) / row_std; zero/NaN std rows -> NaN."""
+ mean = df.mean(axis=1, skipna=True)
+ std = df.std(axis=1, ddof=1, skipna=True)
+ centered = df.sub(mean, axis=0)
+ result = centered.div(std.where(std > 0), axis=0)
+ return result.replace([np.inf, -np.inf], np.nan)
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return inverse 60-day log-volume change z-score per stock.
+
+ Uses the canonical 60-bar rolling mean + 60-bar delta windows without
+ silent shrink on short panels. Short panels produce all-NaN; the
+ registry surfaces this as >95% NaN (RegistryError) so the user sees
+ "insufficient history" rather than a misleading shrunk-window value.
+ """
+ volume = panel['volume']
+ log_avg_vol = np.log(ts_mean(volume, 60) + 1.0)
+ growth = delta(log_avg_vol, 60)
+ return _cross_sectional_zscore(-growth)
diff --git a/agent/src/factors/zoo/academic/hml.py b/agent/src/factors/zoo/academic/hml.py
new file mode 100644
index 000000000..9d580b455
--- /dev/null
+++ b/agent/src/factors/zoo/academic/hml.py
@@ -0,0 +1,60 @@
+"""academic HML: value factor as inverse 252-day return (long-term reversal proxy).
+
+Reference:
+ Fama, E. F., & French, K. R. (1993). "Common risk factors in the returns on
+ stocks and bonds." Journal of Financial Economics, 33(1), 3-56.
+
+This is a price-based proxy: the original HML (High Minus Low) sorts on book-
+to-market, which requires fundamental book equity. We use the negative of the
+trailing 252-day return — value names tend to be long-term underperformers
+whose prices have declined relative to book value. Higher z-scores = larger
+long-term drawdowns (deeper value).
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import delta, safe_div
+
+__alpha_meta__ = {
+ 'id': 'academic_hml',
+ 'nickname': '[PRICE PROXY] FF1993 HML — value via inverse 252d return',
+ 'theme': ['value'],
+ 'formula_latex': r'\mathrm{zscore}_{x}\bigl(-(\mathrm{close}_t - \mathrm{close}_{t-252}) / \mathrm{close}_{t-252}\bigr)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 252,
+ 'notes': (
+ '[PRICE PROXY] for the Fama-French (1993) HML (High Minus Low) value factor. '
+ 'The original definition uses book-to-market ratio from fundamental data; here '
+ 'we use the negative 252-day total return as a long-term reversal proxy, then '
+ 'cross-sectional z-score per date for long-short ranking. Top z-scores = '
+ 'long-term underperformers (deeper value). Canonical 252d window; declared '
+ 'decay_horizon=60 due to registry schema cap (le=60); real signal horizon=252.'
+ ),
+}
+
+
+def _cross_sectional_zscore(df: pd.DataFrame) -> pd.DataFrame:
+ """Per-row z-score: (x - row_mean) / row_std; zero/NaN std rows -> NaN."""
+ mean = df.mean(axis=1, skipna=True)
+ std = df.std(axis=1, ddof=1, skipna=True)
+ centered = df.sub(mean, axis=0)
+ result = centered.div(std.where(std > 0), axis=0)
+ return result.replace([np.inf, -np.inf], np.nan)
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return inverse 252-day return cross-sectional z-score per stock.
+
+ Uses the canonical 252-day window without silent shrink on short panels.
+ Short panels produce an all-NaN result, which the registry surfaces as a
+ >95% NaN error (RegistryError) so the user sees "insufficient history"
+ instead of a misleading shrunk-window value.
+ """
+ close = panel['close']
+ ret = safe_div(delta(close, 252), close.shift(252))
+ return _cross_sectional_zscore(-ret)
diff --git a/agent/src/factors/zoo/academic/mkt_rf.py b/agent/src/factors/zoo/academic/mkt_rf.py
new file mode 100644
index 000000000..085a8c4c1
--- /dev/null
+++ b/agent/src/factors/zoo/academic/mkt_rf.py
@@ -0,0 +1,53 @@
+"""academic MKT_RF: market factor as 21-day return, cross-sectionally z-scored.
+
+Reference:
+ Sharpe, W. F. (1964). "Capital Asset Prices: A Theory of Market Equilibrium
+ under Conditions of Risk." The Journal of Finance, 19(3), 425-442.
+
+This is a price-based proxy: the original CAPM market factor is the
+value-weighted excess return of the market portfolio. We approximate the
+per-stock market-factor exposure as the 21-day total return cross-sectionally
+z-scored, suitable for ranking long-short portfolios.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import delta, safe_div
+
+__alpha_meta__ = {
+ 'id': 'academic_mkt_rf',
+ 'nickname': '[PRICE PROXY] Market factor (Sharpe 1964) — 21d demeaned return',
+ 'theme': ['momentum'],
+ 'formula_latex': r'\mathrm{zscore}_{x}\bigl((\mathrm{close}_t - \mathrm{close}_{t-21}) / \mathrm{close}_{t-21}\bigr)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 21,
+ 'min_warmup_bars': 21,
+ 'notes': (
+ '[PRICE PROXY] for the Sharpe (1964) / Fama-French market factor (MKT-RF). '
+ 'The original definition uses value-weighted market excess returns; here we '
+ 'use a 21-day per-stock total return and cross-sectional z-score per date '
+ 'for long-short ranking. Top z-scores = strong recent winners; bottom = losers.'
+ ),
+}
+
+
+def _cross_sectional_zscore(df: pd.DataFrame) -> pd.DataFrame:
+ """Per-row z-score: (x - row_mean) / row_std; zero/NaN std rows -> NaN."""
+ mean = df.mean(axis=1, skipna=True)
+ std = df.std(axis=1, ddof=1, skipna=True)
+ centered = df.sub(mean, axis=0)
+ # std.where(std > 0) turns 0 / NaN std rows into NaN, which propagates
+ # through div to NaN — no silent inf.
+ result = centered.div(std.where(std > 0), axis=0)
+ return result.replace([np.inf, -np.inf], np.nan)
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return 21-day return cross-sectional z-score per stock."""
+ close = panel['close']
+ ret = safe_div(delta(close, 21), close.shift(21))
+ return _cross_sectional_zscore(ret)
diff --git a/agent/src/factors/zoo/academic/rmw.py b/agent/src/factors/zoo/academic/rmw.py
new file mode 100644
index 000000000..63eece8b9
--- /dev/null
+++ b/agent/src/factors/zoo/academic/rmw.py
@@ -0,0 +1,54 @@
+"""academic RMW: profitability factor as inverse 60-day return volatility.
+
+Reference:
+ Fama, E. F., & French, K. R. (2015). "A five-factor asset pricing model."
+ Journal of Financial Economics, 116(1), 1-22.
+
+This is a price-based proxy: the original RMW (Robust Minus Weak) sorts on
+operating profitability from income statements. We use the negative of trailing
+60-day realized return volatility — robust (profitable) firms historically
+exhibit lower idiosyncratic volatility (the "low-vol anomaly" overlap). Higher
+z-scores = lower volatility = quality proxy.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import delta, safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'academic_rmw',
+ 'nickname': '[PRICE PROXY] FF2015 RMW — quality via inverse 60d volatility',
+ 'theme': ['quality'],
+ 'formula_latex': r'\mathrm{zscore}_{x}\bigl(-\mathrm{ts\_std}((\mathrm{close}_t - \mathrm{close}_{t-1}) / \mathrm{close}_{t-1},\,60)\bigr)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+ 'notes': (
+ '[PRICE PROXY] for the Fama-French (2015) RMW (Robust Minus Weak) '
+ 'profitability factor. The original definition uses operating profitability '
+ 'from fundamental data; here we use the negative of 60-day return volatility '
+ 'as a low-vol-quality proxy, then cross-sectional z-score per date for '
+ 'long-short ranking. Top z-scores = lower vol (quality / robust).'
+ ),
+}
+
+
+def _cross_sectional_zscore(df: pd.DataFrame) -> pd.DataFrame:
+ """Per-row z-score: (x - row_mean) / row_std; zero/NaN std rows -> NaN."""
+ mean = df.mean(axis=1, skipna=True)
+ std = df.std(axis=1, ddof=1, skipna=True)
+ centered = df.sub(mean, axis=0)
+ result = centered.div(std.where(std > 0), axis=0)
+ return result.replace([np.inf, -np.inf], np.nan)
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return inverse 60-day return-volatility z-score per stock."""
+ close = panel['close']
+ ret_1d = safe_div(delta(close, 1), close.shift(1))
+ vol_60 = ts_std(ret_1d, 60)
+ return _cross_sectional_zscore(-vol_60)
diff --git a/agent/src/factors/zoo/academic/smb.py b/agent/src/factors/zoo/academic/smb.py
new file mode 100644
index 000000000..e33ead462
--- /dev/null
+++ b/agent/src/factors/zoo/academic/smb.py
@@ -0,0 +1,55 @@
+"""academic SMB: size factor as inverse log of 60-day average dollar volume.
+
+Reference:
+ Fama, E. F., & French, K. R. (1993). "Common risk factors in the returns on
+ stocks and bonds." Journal of Financial Economics, 33(1), 3-56.
+
+This is a price-based proxy: the original SMB (Small Minus Big) sorts on market
+capitalization, which we do not carry in the OHLCV panel. We use average daily
+dollar volume (close * volume) as a liquidity-weighted size proxy — small caps
+typically have low dollar volume. Higher z-scores = smaller (illiquid) names.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import ts_mean
+
+__alpha_meta__ = {
+ 'id': 'academic_smb',
+ 'nickname': '[PRICE PROXY] FF1993 SMB — small-minus-big via inverse dollar-volume',
+ 'theme': ['quality'],
+ 'formula_latex': r'\mathrm{zscore}_{x}\bigl(-\log(\mathrm{ts\_mean}(\mathrm{volume} \cdot \mathrm{close},\,60) + 1)\bigr)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+ 'notes': (
+ '[PRICE PROXY] for the Fama-French (1993) SMB (Small Minus Big) size factor. '
+ 'The original definition uses market capitalization from book equity data; here '
+ 'we use the negative log of 60-day average dollar volume (close * volume) as a '
+ 'liquidity-weighted size proxy, then cross-sectional z-score per date for '
+ 'long-short ranking. Top z-scores = smaller / less liquid names.'
+ ),
+}
+
+
+def _cross_sectional_zscore(df: pd.DataFrame) -> pd.DataFrame:
+ """Per-row z-score: (x - row_mean) / row_std; zero/NaN std rows -> NaN."""
+ mean = df.mean(axis=1, skipna=True)
+ std = df.std(axis=1, ddof=1, skipna=True)
+ centered = df.sub(mean, axis=0)
+ result = centered.div(std.where(std > 0), axis=0)
+ return result.replace([np.inf, -np.inf], np.nan)
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return inverse log 60-day dollar-volume z-score per stock."""
+ close = panel['close']
+ volume = panel['volume']
+ dollar_volume = volume * close
+ avg = ts_mean(dollar_volume, 60)
+ log_size = np.log(avg + 1.0)
+ return _cross_sectional_zscore(-log_size)
diff --git a/agent/src/factors/zoo/alpha101/LICENSE.md b/agent/src/factors/zoo/alpha101/LICENSE.md
new file mode 100644
index 000000000..2c9a0e5fa
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/LICENSE.md
@@ -0,0 +1,80 @@
+# Kakushadze 101 Formulaic Alphas — License & Provenance
+
+## Display Name
+
+**Kakushadze 101 Formulaic Alphas**
+
+This is the display name used throughout the Vibe-Trading codebase, manifests,
+wiki, and documentation when referring to the 101 alphas implemented under
+`agent/src/factors/zoo/alpha101/`. No other branding is used.
+
+## Source
+
+* **Paper**: Z. Kakushadze, *"101 Formulaic Alphas"*, 2015.
+* **arXiv**: <https://arxiv.org/abs/1601.00991>
+* **DOI**: 10.48550/arXiv.1601.00991
+* **License of the paper**: arXiv non-exclusive distribution license; the
+ formulas themselves are presented as mathematical artifacts.
+
+## What we reproduce
+
+This subdirectory contains 101 standalone Python modules, one per alpha,
+each implementing the formula given in the appendix of Kakushadze (2015) on
+top of the operator surface in `agent/src/factors/base.py`. The
+implementations were written from scratch against the formula table; we
+did not copy or port source code from any third-party implementation.
+
+## What we do NOT reproduce
+
+* No prose, figures, tables, or discussion from the paper is included in
+ this repository.
+* No commentary on alpha behaviour, holding periods, or empirical
+ performance is reproduced verbatim.
+* The string commonly associated with the firm of one of the paper's
+ author affiliations **does not appear anywhere in this repository**;
+ the CI gate `tools/ci_grep_gates.sh` enforces this.
+
+## Trademark / Naming Stance
+
+Mathematical formulas are not subject to copyright. The formulas as listed
+in the paper appendix are facts about real-valued functions of OHLCV data
+and are reproducible by anyone with access to the paper. The choice of
+display name **"Kakushadze 101 Formulaic Alphas"** credits the paper
+author and avoids any trademark that may be associated with the
+institutional affiliation of the work.
+
+If you redistribute this subdirectory, please:
+
+1. Keep the arXiv citation intact in each module docstring.
+2. Keep the display name as **"Kakushadze 101 Formulaic Alphas"**.
+3. Do not introduce trademark strings that this project deliberately
+ avoids (see CI gate `(b)` in `tools/ci_grep_gates.sh`).
+
+## Numerical Cross-Validation
+
+Public reference implementations of these formulas exist (for example
+Menooker/KunQuant on GitHub). We used those only as a numerical sanity
+check on small synthetic panels — never as a source of code. No file in
+this subdirectory was copied, adapted, or text-spliced from a third-party
+implementation; the Python code here is original and was generated from
+the formula table by a deterministic templating step (the template
+generator script is not retained in the published source tree).
+
+## Implementation Notes
+
+* The standard panel exposes `open`, `high`, `low`, `close`, `volume`,
+ `vwap`, and (optionally) `amount` and `sector`. Where the paper formula
+ references `cap` (market capitalisation) or `IndClass.industry /
+ subindustry / sector`, we either substitute a degraded value or gate
+ the alpha behind `requires_sector=True`; the per-alpha `notes` field
+ in `__alpha_meta__` records each such degradation.
+* `delta(x, d)` is restricted to `d >= 1` (no negative-shift forms). The
+ paper's formulas use only positive lags so this is a no-op constraint.
+* The `delay(x, n)` helper (`x.shift(n)` with `n >= 1`) is implemented
+ inside each alpha module as a small private function rather than
+ imported from `src.factors.base` to keep the public operator surface
+ small.
+
+## Contact
+
+Vibe-Trading project — <https://github.com/HKUDS/Vibe-Trading>
diff --git a/agent/src/factors/zoo/alpha101/__init__.py b/agent/src/factors/zoo/alpha101/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/agent/src/factors/zoo/alpha101/alpha_001.py b/agent/src/factors/zoo/alpha101/alpha_001.py
new file mode 100644
index 000000000..b9c169ee9
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_001.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #1.
+
+Formula (paper appendix): rank(ts_argmax(SignedPower((returns<0)?stddev(returns,20):close, 2.), 5)) - 0.5
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 1.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_001"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_001',
+ 'nickname': 'Kakushadze Alpha #1',
+ 'theme': ['reversal', 'volatility'],
+ 'formula_latex': 'rank(ts_argmax(SignedPower((returns<0)?stddev(returns,20):close, 2.), 5)) - 0.5',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ cond = (returns < 0).astype(float)
+ x = ts_std(returns, 20) * cond + close * (1.0 - cond)
+ out = rank(ts_argmax(signed_power(x, 2.0), 5)) - 0.5
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_002.py b/agent/src/factors/zoo/alpha101/alpha_002.py
new file mode 100644
index 000000000..661da796b
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_002.py
@@ -0,0 +1,57 @@
+"""Kakushadze Alpha #2.
+
+Formula (paper appendix): -1 * correlation(rank(delta(log(volume), 2)), rank(((close-open)/open)), 6)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 2.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_002"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_002',
+ 'nickname': 'Kakushadze Alpha #2',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': '-1 * correlation(rank(delta(log(volume), 2)), rank(((close-open)/open)), 6)',
+ 'columns_required': ['open', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * ts_corr(rank(delta(np.log(volume), 2)), rank((close - open_) / open_), 6)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_003.py b/agent/src/factors/zoo/alpha101/alpha_003.py
new file mode 100644
index 000000000..59773d25d
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_003.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #3.
+
+Formula (paper appendix): -1 * correlation(rank(open), rank(volume), 10)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 3.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_003"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_003',
+ 'nickname': 'Kakushadze Alpha #3',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': '-1 * correlation(rank(open), rank(volume), 10)',
+ 'columns_required': ['open', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ open_ = panel["open"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * ts_corr(rank(open_), rank(volume), 10)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_004.py b/agent/src/factors/zoo/alpha101/alpha_004.py
new file mode 100644
index 000000000..c7a453ade
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_004.py
@@ -0,0 +1,55 @@
+"""Kakushadze Alpha #4.
+
+Formula (paper appendix): -1 * Ts_Rank(rank(low), 9)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 4.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_004"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_004',
+ 'nickname': 'Kakushadze Alpha #4',
+ 'theme': ['reversal'],
+ 'formula_latex': '-1 * Ts_Rank(rank(low), 9)',
+ 'columns_required': ['low', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 9,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ low = panel["low"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * ts_rank(rank(low), 9)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_005.py b/agent/src/factors/zoo/alpha101/alpha_005.py
new file mode 100644
index 000000000..a813a473a
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_005.py
@@ -0,0 +1,63 @@
+"""Kakushadze Alpha #5.
+
+Formula (paper appendix): rank((open - sum(vwap,10)/10)) * (-1 * abs(rank((close - vwap))))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 5.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_005"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_005',
+ 'nickname': 'Kakushadze Alpha #5',
+ 'theme': ['reversal'],
+ 'formula_latex': 'rank((open - sum(vwap,10)/10)) * (-1 * abs(rank((close - vwap))))',
+ 'columns_required': ['open', 'close', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ out = rank(open_ - rolling_sum(vwap, 10) / 10.0) * (-1.0 * rank(close - vwap).abs())
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_006.py b/agent/src/factors/zoo/alpha101/alpha_006.py
new file mode 100644
index 000000000..a389470bf
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_006.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #6.
+
+Formula (paper appendix): -1 * correlation(open, volume, 10)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 6.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_006"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_006',
+ 'nickname': 'Kakushadze Alpha #6',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': '-1 * correlation(open, volume, 10)',
+ 'columns_required': ['open', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ open_ = panel["open"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * ts_corr(open_, volume, 10)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_007.py b/agent/src/factors/zoo/alpha101/alpha_007.py
new file mode 100644
index 000000000..9bcf809d2
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_007.py
@@ -0,0 +1,86 @@
+"""Kakushadze Alpha #7.
+
+Formula (paper appendix): (adv20<volume)?((-1*ts_rank(abs(delta(close,7)),60))*sign(delta(close,7))):(-1)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 7.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_007"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_007',
+ 'nickname': 'Kakushadze Alpha #7',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '(adv20<volume)?((-1*ts_rank(abs(delta(close,7)),60))*sign(delta(close,7))):(-1)',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 67,
+ 'notes': '',
+}
+
+
+def _make_one(ref: pd.DataFrame) -> pd.DataFrame:
+ """A DataFrame of 1.0 with the same shape/index/columns as ``ref``."""
+ return pd.DataFrame(1.0, index=ref.index, columns=ref.columns)
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ make_one = _make_one
+ where_ternary = _where_ternary
+ d7 = delta(close, 7)
+ expr = (-1.0 * ts_rank(d7.abs(), 60)) * np.sign(d7)
+ out = where_ternary(adv20 < volume, expr, -1.0 * make_one(close))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_008.py b/agent/src/factors/zoo/alpha101/alpha_008.py
new file mode 100644
index 000000000..83775ec20
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_008.py
@@ -0,0 +1,71 @@
+"""Kakushadze Alpha #8.
+
+Formula (paper appendix): -1 * rank((sum(open,5)*sum(returns,5)) - delay(sum(open,5)*sum(returns,5),10))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 8.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_008"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_008',
+ 'nickname': 'Kakushadze Alpha #8',
+ 'theme': ['reversal'],
+ 'formula_latex': '-1 * rank((sum(open,5)*sum(returns,5)) - delay(sum(open,5)*sum(returns,5),10))',
+ 'columns_required': ['open', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 15,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ s = rolling_sum(open_, 5) * rolling_sum(returns, 5)
+ out = -1.0 * rank(s - delay(s, 10))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_009.py b/agent/src/factors/zoo/alpha101/alpha_009.py
new file mode 100644
index 000000000..b9752842c
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_009.py
@@ -0,0 +1,80 @@
+"""Kakushadze Alpha #9.
+
+Formula (paper appendix): (0<ts_min(delta(close,1),5))?delta(close,1):((ts_max(delta(close,1),5)<0)?delta(close,1):(-1*delta(close,1)))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 9.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_009"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_009',
+ 'nickname': 'Kakushadze Alpha #9',
+ 'theme': ['momentum'],
+ 'formula_latex': '(0<ts_min(delta(close,1),5))?delta(close,1):((ts_max(delta(close,1),5)<0)?delta(close,1):(-1*delta(close,1)))',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 6,
+ 'notes': '',
+}
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ where_ternary = _where_ternary
+ d1 = delta(close, 1)
+ cond1 = ts_min(d1, 5) > 0
+ cond2 = ts_max(d1, 5) < 0
+ out = where_ternary(cond1, d1, where_ternary(cond2, d1, -1.0 * d1))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_010.py b/agent/src/factors/zoo/alpha101/alpha_010.py
new file mode 100644
index 000000000..cc0bd524e
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_010.py
@@ -0,0 +1,81 @@
+"""Kakushadze Alpha #10.
+
+Formula (paper appendix): rank((0<ts_min(delta(close,1),4))?delta(close,1):((ts_max(delta(close,1),4)<0)?delta(close,1):(-1*delta(close,1))))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 10.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_010"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_010',
+ 'nickname': 'Kakushadze Alpha #10',
+ 'theme': ['momentum'],
+ 'formula_latex': 'rank((0<ts_min(delta(close,1),4))?delta(close,1):((ts_max(delta(close,1),4)<0)?delta(close,1):(-1*delta(close,1))))',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+ 'notes': '',
+}
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ where_ternary = _where_ternary
+ d1 = delta(close, 1)
+ cond1 = ts_min(d1, 4) > 0
+ cond2 = ts_max(d1, 4) < 0
+ inner = where_ternary(cond1, d1, where_ternary(cond2, d1, -1.0 * d1))
+ out = rank(inner)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_011.py b/agent/src/factors/zoo/alpha101/alpha_011.py
new file mode 100644
index 000000000..a8d898389
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_011.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #11.
+
+Formula (paper appendix): (rank(ts_max(vwap-close,3))+rank(ts_min(vwap-close,3)))*rank(delta(volume,3))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 11.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_011"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_011',
+ 'nickname': 'Kakushadze Alpha #11',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': '(rank(ts_max(vwap-close,3))+rank(ts_min(vwap-close,3)))*rank(delta(volume,3))',
+ 'columns_required': ['close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ diff = vwap - close
+ out = (rank(ts_max(diff, 3)) + rank(ts_min(diff, 3))) * rank(delta(volume, 3))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_012.py b/agent/src/factors/zoo/alpha101/alpha_012.py
new file mode 100644
index 000000000..8a3c330da
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_012.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #12.
+
+Formula (paper appendix): sign(delta(volume,1)) * (-1 * delta(close,1))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 12.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_012"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_012',
+ 'nickname': 'Kakushadze Alpha #12',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': 'sign(delta(volume,1)) * (-1 * delta(close,1))',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 2,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = np.sign(delta(volume, 1)) * (-1.0 * delta(close, 1))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_013.py b/agent/src/factors/zoo/alpha101/alpha_013.py
new file mode 100644
index 000000000..e51cb7eb4
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_013.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #13.
+
+Formula (paper appendix): -1 * rank(covariance(rank(close), rank(volume), 5))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 13.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_013"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_013',
+ 'nickname': 'Kakushadze Alpha #13',
+ 'theme': ['volume'],
+ 'formula_latex': '-1 * rank(covariance(rank(close), rank(volume), 5))',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * rank(ts_cov(rank(close), rank(volume), 5))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_014.py b/agent/src/factors/zoo/alpha101/alpha_014.py
new file mode 100644
index 000000000..1ac27c961
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_014.py
@@ -0,0 +1,57 @@
+"""Kakushadze Alpha #14.
+
+Formula (paper appendix): (-1*rank(delta(returns,3))) * correlation(open, volume, 10)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 14.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_014"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_014',
+ 'nickname': 'Kakushadze Alpha #14',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': '(-1*rank(delta(returns,3))) * correlation(open, volume, 10)',
+ 'columns_required': ['open', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ volume = panel["volume"]
+
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = (-1.0 * rank(delta(returns, 3))) * ts_corr(open_, volume, 10)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_015.py b/agent/src/factors/zoo/alpha101/alpha_015.py
new file mode 100644
index 000000000..aead2945d
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_015.py
@@ -0,0 +1,62 @@
+"""Kakushadze Alpha #15.
+
+Formula (paper appendix): -1 * sum(rank(correlation(rank(high), rank(volume), 3)), 3)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 15.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_015"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_015',
+ 'nickname': 'Kakushadze Alpha #15',
+ 'theme': ['volume'],
+ 'formula_latex': '-1 * sum(rank(correlation(rank(high), rank(volume), 3)), 3)',
+ 'columns_required': ['high', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 6,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ out = -1.0 * rolling_sum(rank(ts_corr(rank(high), rank(volume), 3)), 3)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_016.py b/agent/src/factors/zoo/alpha101/alpha_016.py
new file mode 100644
index 000000000..3a279ddbf
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_016.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #16.
+
+Formula (paper appendix): -1 * rank(covariance(rank(high), rank(volume), 5))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 16.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_016"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_016',
+ 'nickname': 'Kakushadze Alpha #16',
+ 'theme': ['volume'],
+ 'formula_latex': '-1 * rank(covariance(rank(high), rank(volume), 5))',
+ 'columns_required': ['high', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * rank(ts_cov(rank(high), rank(volume), 5))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_017.py b/agent/src/factors/zoo/alpha101/alpha_017.py
new file mode 100644
index 000000000..3a3789ab4
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_017.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #17.
+
+Formula (paper appendix): ((-1*rank(ts_rank(close,10)))*rank(delta(delta(close,1),1)))*rank(ts_rank(volume/adv20,5))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 17.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_017"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_017',
+ 'nickname': 'Kakushadze Alpha #17',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': '((-1*rank(ts_rank(close,10)))*rank(delta(delta(close,1),1)))*rank(ts_rank(volume/adv20,5))',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = (-1.0 * rank(ts_rank(close, 10))) * rank(delta(delta(close, 1), 1)) * rank(ts_rank(safe_div(volume, adv20), 5))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_018.py b/agent/src/factors/zoo/alpha101/alpha_018.py
new file mode 100644
index 000000000..9125d7b12
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_018.py
@@ -0,0 +1,57 @@
+"""Kakushadze Alpha #18.
+
+Formula (paper appendix): -1 * rank(stddev(abs(close-open),5) + (close-open) + correlation(close,open,10))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 18.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_018"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_018',
+ 'nickname': 'Kakushadze Alpha #18',
+ 'theme': ['volatility'],
+ 'formula_latex': '-1 * rank(stddev(abs(close-open),5) + (close-open) + correlation(close,open,10))',
+ 'columns_required': ['open', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ diff = (close - open_)
+ out = -1.0 * rank(ts_std(diff.abs(), 5) + diff + ts_corr(close, open_, 10))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_019.py b/agent/src/factors/zoo/alpha101/alpha_019.py
new file mode 100644
index 000000000..361093e26
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_019.py
@@ -0,0 +1,70 @@
+"""Kakushadze Alpha #19.
+
+Formula (paper appendix): (-1*sign((close-delay(close,7))+delta(close,7))) * (1+rank(1+sum(returns,250)))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 19.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_019"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_019',
+ 'nickname': 'Kakushadze Alpha #19',
+ 'theme': ['momentum'],
+ 'formula_latex': '(-1*sign((close-delay(close,7))+delta(close,7))) * (1+rank(1+sum(returns,250)))',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 250,
+ 'notes': 'Very long lookback (>= ~100 bars); produces NaN warmup on short panels which may trigger the >95% NaN registry guard.',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ out = (-1.0 * np.sign((close - delay(close, 7)) + delta(close, 7))) * (1.0 + rank(1.0 + rolling_sum(returns, 250)))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_020.py b/agent/src/factors/zoo/alpha101/alpha_020.py
new file mode 100644
index 000000000..471c39ebf
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_020.py
@@ -0,0 +1,66 @@
+"""Kakushadze Alpha #20.
+
+Formula (paper appendix): (((-1*rank(open-delay(high,1)))*rank(open-delay(close,1)))*rank(open-delay(low,1)))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 20.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_020"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_020',
+ 'nickname': 'Kakushadze Alpha #20',
+ 'theme': ['reversal'],
+ 'formula_latex': '(((-1*rank(open-delay(high,1)))*rank(open-delay(close,1)))*rank(open-delay(low,1)))',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 2,
+ 'notes': '',
+}
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ delay = _delay
+ out = ((-1.0 * rank(open_ - delay(high, 1))) * rank(open_ - delay(close, 1))) * rank(open_ - delay(low, 1))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_021.py b/agent/src/factors/zoo/alpha101/alpha_021.py
new file mode 100644
index 000000000..dc39d6542
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_021.py
@@ -0,0 +1,98 @@
+"""Kakushadze Alpha #21.
+
+Formula (paper appendix): complex piecewise; see paper
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 21.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_021"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_021',
+ 'nickname': 'Kakushadze Alpha #21',
+ 'theme': ['momentum', 'volatility'],
+ 'formula_latex': 'complex piecewise; see paper',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _make_one(ref: pd.DataFrame) -> pd.DataFrame:
+ """A DataFrame of 1.0 with the same shape/index/columns as ``ref``."""
+ return pd.DataFrame(1.0, index=ref.index, columns=ref.columns)
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ make_one = _make_one
+ where_ternary = _where_ternary
+ m8 = rolling_sum(close, 8) / 8.0
+ s8 = ts_std(close, 8)
+ m2 = rolling_sum(close, 2) / 2.0
+ v_adv = safe_div(volume, adv20)
+ cond_a = (m8 + s8) < m2
+ cond_b = m2 < (m8 - s8)
+ cond_c = (v_adv >= 1.0)
+ one = make_one(close)
+ out = where_ternary(cond_a, -1.0 * one, where_ternary(cond_b, one, where_ternary(cond_c, one, -1.0 * one)))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_022.py b/agent/src/factors/zoo/alpha101/alpha_022.py
new file mode 100644
index 000000000..d3b6da0e6
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_022.py
@@ -0,0 +1,57 @@
+"""Kakushadze Alpha #22.
+
+Formula (paper appendix): -1 * (delta(correlation(high,volume,5),5) * rank(stddev(close,20)))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 22.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_022"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_022',
+ 'nickname': 'Kakushadze Alpha #22',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '-1 * (delta(correlation(high,volume,5),5) * rank(stddev(close,20)))',
+ 'columns_required': ['high', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * (delta(ts_corr(high, volume, 5), 5) * rank(ts_std(close, 20)))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_023.py b/agent/src/factors/zoo/alpha101/alpha_023.py
new file mode 100644
index 000000000..e81fddc12
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_023.py
@@ -0,0 +1,85 @@
+"""Kakushadze Alpha #23.
+
+Formula (paper appendix): ((sum(high,20)/20) < high) ? (-1*delta(high,2)) : 0
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 23.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_023"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_023',
+ 'nickname': 'Kakushadze Alpha #23',
+ 'theme': ['momentum'],
+ 'formula_latex': '((sum(high,20)/20) < high) ? (-1*delta(high,2)) : 0',
+ 'columns_required': ['high', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ where_ternary = _where_ternary
+ mh = rolling_sum(high, 20) / 20.0
+ out = where_ternary(mh < high, -1.0 * delta(high, 2), 0.0 * close)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_024.py b/agent/src/factors/zoo/alpha101/alpha_024.py
new file mode 100644
index 000000000..4f798186b
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_024.py
@@ -0,0 +1,96 @@
+"""Kakushadze Alpha #24.
+
+Formula (paper appendix): complex piecewise; see paper
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 24.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_024"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_024',
+ 'nickname': 'Kakushadze Alpha #24',
+ 'theme': ['momentum'],
+ 'formula_latex': 'complex piecewise; see paper',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 200,
+ 'notes': 'Very long lookback (>= ~100 bars); produces NaN warmup on short panels which may trigger the >95% NaN registry guard.',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ where_ternary = _where_ternary
+ m100 = rolling_sum(close, 100) / 100.0
+ x = safe_div(delta(m100, 100), delay(close, 100))
+ cond = x <= 0.05
+ left = -1.0 * (close - ts_min(close, 100))
+ right = -1.0 * delta(close, 3)
+ out = where_ternary(cond, left, right)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_025.py b/agent/src/factors/zoo/alpha101/alpha_025.py
new file mode 100644
index 000000000..850f819aa
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_025.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #25.
+
+Formula (paper appendix): rank((((-1*returns)*adv20)*vwap)*(high-close))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 25.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_025"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_025',
+ 'nickname': 'Kakushadze Alpha #25',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': 'rank((((-1*returns)*adv20)*vwap)*(high-close))',
+ 'columns_required': ['high', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv20 = ts_mean(volume, 20)
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = rank(((-1.0 * returns) * adv20) * vwap * (high - close))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_026.py b/agent/src/factors/zoo/alpha101/alpha_026.py
new file mode 100644
index 000000000..097578100
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_026.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #26.
+
+Formula (paper appendix): -1 * ts_max(correlation(ts_rank(volume,5),ts_rank(high,5),5),3)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 26.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_026"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_026',
+ 'nickname': 'Kakushadze Alpha #26',
+ 'theme': ['volume'],
+ 'formula_latex': '-1 * ts_max(correlation(ts_rank(volume,5),ts_rank(high,5),5),3)',
+ 'columns_required': ['high', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 13,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * ts_max(ts_corr(ts_rank(volume, 5), ts_rank(high, 5), 5), 3)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_027.py b/agent/src/factors/zoo/alpha101/alpha_027.py
new file mode 100644
index 000000000..6d945e49d
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_027.py
@@ -0,0 +1,92 @@
+"""Kakushadze Alpha #27.
+
+Formula (paper appendix): (0.5<rank((sum(correlation(rank(volume),rank(vwap),6),2)/2.0)))?(-1):1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 27.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_027"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_027',
+ 'nickname': 'Kakushadze Alpha #27',
+ 'theme': ['volume'],
+ 'formula_latex': '(0.5<rank((sum(correlation(rank(volume),rank(vwap),6),2)/2.0)))?(-1):1',
+ 'columns_required': ['volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _make_one(ref: pd.DataFrame) -> pd.DataFrame:
+ """A DataFrame of 1.0 with the same shape/index/columns as ``ref``."""
+ return pd.DataFrame(1.0, index=ref.index, columns=ref.columns)
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ make_one = _make_one
+ where_ternary = _where_ternary
+ x = rank(rolling_sum(ts_corr(rank(volume), rank(vwap), 6), 2) / 2.0)
+ out = where_ternary(x > 0.5, -1.0 * make_one(close), make_one(close))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_028.py b/agent/src/factors/zoo/alpha101/alpha_028.py
new file mode 100644
index 000000000..2eb87be4f
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_028.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #28.
+
+Formula (paper appendix): scale((correlation(adv20,low,5) + (high+low)/2) - close)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 28.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_028"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_028',
+ 'nickname': 'Kakushadze Alpha #28',
+ 'theme': ['volume'],
+ 'formula_latex': 'scale((correlation(adv20,low,5) + (high+low)/2) - close)',
+ 'columns_required': ['high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = scale(ts_corr(adv20, low, 5) + (high + low) / 2.0 - close)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_029.py b/agent/src/factors/zoo/alpha101/alpha_029.py
new file mode 100644
index 000000000..253bca8b5
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_029.py
@@ -0,0 +1,83 @@
+"""Kakushadze Alpha #29.
+
+Formula (paper appendix): min(product(rank(rank(scale(log(sum(ts_min(rank(rank(-1*rank(delta(close-1,5)))),2),1))))),1),5) + ts_rank(delay(-1*returns,6),5)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 29.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_029"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_029',
+ 'nickname': 'Kakushadze Alpha #29',
+ 'theme': ['reversal', 'volume'],
+ 'formula_latex': 'min(product(rank(rank(scale(log(sum(ts_min(rank(rank(-1*rank(delta(close-1,5)))),2),1))))),1),5) + ts_rank(delay(-1*returns,6),5)',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 12,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _rolling_prod(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window product; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).apply(np.prod, raw=True)
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ rolling_prod = _rolling_prod
+ delay = _delay
+ inner = rank(rank(-1.0 * rank(delta(close - 1.0, 5))))
+ inner = ts_min(inner, 2)
+ inner = rolling_sum(inner, 1)
+ inner = np.log(inner.where(inner > 0))
+ inner = scale(inner)
+ inner = rank(rank(inner))
+ inner = rolling_prod(inner, 1)
+ term1 = ts_min(inner, 5)
+ term2 = ts_rank(delay(-1.0 * returns, 6), 5)
+ out = term1 + term2
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_030.py b/agent/src/factors/zoo/alpha101/alpha_030.py
new file mode 100644
index 000000000..20450ea6e
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_030.py
@@ -0,0 +1,71 @@
+"""Kakushadze Alpha #30.
+
+Formula (paper appendix): ((1-rank(sign(d1)+sign(d2)+sign(d3))) * sum(volume,5)) / sum(volume,20)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 30.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_030"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_030',
+ 'nickname': 'Kakushadze Alpha #30',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '((1-rank(sign(d1)+sign(d2)+sign(d3))) * sum(volume,5)) / sum(volume,20)',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ s = np.sign(close - delay(close, 1)) + np.sign(delay(close, 1) - delay(close, 2)) + np.sign(delay(close, 2) - delay(close, 3))
+ out = safe_div((1.0 - rank(s)) * rolling_sum(volume, 5), rolling_sum(volume, 20))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_031.py b/agent/src/factors/zoo/alpha101/alpha_031.py
new file mode 100644
index 000000000..d9658b84b
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_031.py
@@ -0,0 +1,60 @@
+"""Kakushadze Alpha #31.
+
+Formula (paper appendix): rank(rank(rank(decay_linear(-1*rank(rank(delta(close,10))),10)))) + rank(-1*delta(close,3)) + sign(scale(correlation(adv20,low,12)))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 31.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_031"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_031',
+ 'nickname': 'Kakushadze Alpha #31',
+ 'theme': ['momentum'],
+ 'formula_latex': 'rank(rank(rank(decay_linear(-1*rank(rank(delta(close,10))),10)))) + rank(-1*delta(close,3)) + sign(scale(correlation(adv20,low,12)))',
+ 'columns_required': ['low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ t1 = rank(rank(rank(decay_linear(-1.0 * rank(rank(delta(close, 10))), 10))))
+ t2 = rank(-1.0 * delta(close, 3))
+ t3 = pd.DataFrame(np.sign(scale(ts_corr(adv20, low, 12)).to_numpy(dtype=np.float64, na_value=np.nan)), index=close.index, columns=close.columns)
+ out = t1 + t2 + t3
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_032.py b/agent/src/factors/zoo/alpha101/alpha_032.py
new file mode 100644
index 000000000..a1e6aed50
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_032.py
@@ -0,0 +1,70 @@
+"""Kakushadze Alpha #32.
+
+Formula (paper appendix): scale(sum(close,7)/7 - close) + 20*scale(correlation(vwap, delay(close,5), 230))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 32.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_032"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_032',
+ 'nickname': 'Kakushadze Alpha #32',
+ 'theme': ['momentum'],
+ 'formula_latex': 'scale(sum(close,7)/7 - close) + 20*scale(correlation(vwap, delay(close,5), 230))',
+ 'columns_required': ['close', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 235,
+ 'notes': 'Very long lookback (>= ~100 bars); produces NaN warmup on short panels which may trigger the >95% NaN registry guard.',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ out = scale(rolling_sum(close, 7) / 7.0 - close) + 20.0 * scale(ts_corr(vwap, delay(close, 5), 230))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_033.py b/agent/src/factors/zoo/alpha101/alpha_033.py
new file mode 100644
index 000000000..eb34dd51e
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_033.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #33.
+
+Formula (paper appendix): rank(-1*(1-open/close))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 33.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_033"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_033',
+ 'nickname': 'Kakushadze Alpha #33',
+ 'theme': ['reversal'],
+ 'formula_latex': 'rank(-1*(1-open/close))',
+ 'columns_required': ['open', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = rank(-1.0 * (1.0 - safe_div(open_, close)))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_034.py b/agent/src/factors/zoo/alpha101/alpha_034.py
new file mode 100644
index 000000000..a609bf451
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_034.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #34.
+
+Formula (paper appendix): rank((1-rank(stddev(returns,2)/stddev(returns,5))) + (1-rank(delta(close,1))))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 34.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_034"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_034',
+ 'nickname': 'Kakushadze Alpha #34',
+ 'theme': ['volatility'],
+ 'formula_latex': 'rank((1-rank(stddev(returns,2)/stddev(returns,5))) + (1-rank(delta(close,1))))',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 6,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = rank((1.0 - rank(safe_div(ts_std(returns, 2), ts_std(returns, 5)))) + (1.0 - rank(delta(close, 1))))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_035.py b/agent/src/factors/zoo/alpha101/alpha_035.py
new file mode 100644
index 000000000..800d5a483
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_035.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #35.
+
+Formula (paper appendix): ts_rank(volume,32) * (1 - ts_rank((close+high-low),16)) * (1 - ts_rank(returns,32))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 35.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_035"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_035',
+ 'nickname': 'Kakushadze Alpha #35',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': 'ts_rank(volume,32) * (1 - ts_rank((close+high-low),16)) * (1 - ts_rank(returns,32))',
+ 'columns_required': ['high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 33,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = ts_rank(volume, 32) * (1.0 - ts_rank((close + high - low), 16)) * (1.0 - ts_rank(returns, 32))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_036.py b/agent/src/factors/zoo/alpha101/alpha_036.py
new file mode 100644
index 000000000..7d72555dc
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_036.py
@@ -0,0 +1,77 @@
+"""Kakushadze Alpha #36.
+
+Formula (paper appendix): weighted sum; see paper
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 36.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_036"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_036',
+ 'nickname': 'Kakushadze Alpha #36',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': 'weighted sum; see paper',
+ 'columns_required': ['open', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 200,
+ 'notes': 'Very long lookback (>= ~100 bars); produces NaN warmup on short panels which may trigger the >95% NaN registry guard.',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv20 = ts_mean(volume, 20)
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ t1 = 2.21 * rank(ts_corr((close - open_), delay(volume, 1), 15))
+ t2 = 0.7 * rank(open_ - close)
+ t3 = 0.73 * rank(ts_rank(delay(-1.0 * returns, 6), 5))
+ t4 = rank(ts_corr(vwap, adv20, 6).abs())
+ t5 = 0.6 * rank((rolling_sum(close, 200) / 200.0 - open_) * (close - open_))
+ out = t1 + t2 + t3 + t4 + t5
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_037.py b/agent/src/factors/zoo/alpha101/alpha_037.py
new file mode 100644
index 000000000..cab75b1ed
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_037.py
@@ -0,0 +1,64 @@
+"""Kakushadze Alpha #37.
+
+Formula (paper appendix): rank(correlation(delay(open-close,1),close,200)) + rank(open-close)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 37.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_037"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_037',
+ 'nickname': 'Kakushadze Alpha #37',
+ 'theme': ['momentum'],
+ 'formula_latex': 'rank(correlation(delay(open-close,1),close,200)) + rank(open-close)',
+ 'columns_required': ['open', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 201,
+ 'notes': 'Very long lookback (>= ~100 bars); produces NaN warmup on short panels which may trigger the >95% NaN registry guard.',
+}
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ delay = _delay
+ out = rank(ts_corr(delay(open_ - close, 1), close, 200)) + rank(open_ - close)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_038.py b/agent/src/factors/zoo/alpha101/alpha_038.py
new file mode 100644
index 000000000..513e8ecc3
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_038.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #38.
+
+Formula (paper appendix): (-1*rank(ts_rank(close,10))) * rank(close/open)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 38.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_038"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_038',
+ 'nickname': 'Kakushadze Alpha #38',
+ 'theme': ['reversal'],
+ 'formula_latex': '(-1*rank(ts_rank(close,10))) * rank(close/open)',
+ 'columns_required': ['open', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = (-1.0 * rank(ts_rank(close, 10))) * rank(safe_div(close, open_))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_039.py b/agent/src/factors/zoo/alpha101/alpha_039.py
new file mode 100644
index 000000000..d9a4eb412
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_039.py
@@ -0,0 +1,62 @@
+"""Kakushadze Alpha #39.
+
+Formula (paper appendix): (-1*rank(delta(close,7)*(1-rank(decay_linear(volume/adv20,9))))) * (1+rank(sum(returns,250)))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 39.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_039"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_039',
+ 'nickname': 'Kakushadze Alpha #39',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '(-1*rank(delta(close,7)*(1-rank(decay_linear(volume/adv20,9))))) * (1+rank(sum(returns,250)))',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 250,
+ 'notes': 'Very long lookback (>= ~100 bars); produces NaN warmup on short panels which may trigger the >95% NaN registry guard.',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ adv20 = ts_mean(volume, 20)
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ out = (-1.0 * rank(delta(close, 7) * (1.0 - rank(decay_linear(safe_div(volume, adv20), 9))))) * (1.0 + rank(rolling_sum(returns, 250)))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_040.py b/agent/src/factors/zoo/alpha101/alpha_040.py
new file mode 100644
index 000000000..80cbb991f
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_040.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #40.
+
+Formula (paper appendix): (-1*rank(stddev(high,10))) * correlation(high,volume,10)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 40.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_040"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_040',
+ 'nickname': 'Kakushadze Alpha #40',
+ 'theme': ['volatility', 'volume'],
+ 'formula_latex': '(-1*rank(stddev(high,10))) * correlation(high,volume,10)',
+ 'columns_required': ['high', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = (-1.0 * rank(ts_std(high, 10))) * ts_corr(high, volume, 10)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_041.py b/agent/src/factors/zoo/alpha101/alpha_041.py
new file mode 100644
index 000000000..9e8a54765
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_041.py
@@ -0,0 +1,57 @@
+"""Kakushadze Alpha #41.
+
+Formula (paper appendix): (high*low)^0.5 - vwap
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 41.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_041"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_041',
+ 'nickname': 'Kakushadze Alpha #41',
+ 'theme': ['reversal'],
+ 'formula_latex': '(high*low)^0.5 - vwap',
+ 'columns_required': ['high', 'low', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ low = panel["low"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = (high * low).pow(0.5) - vwap
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_042.py b/agent/src/factors/zoo/alpha101/alpha_042.py
new file mode 100644
index 000000000..80133b79e
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_042.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #42.
+
+Formula (paper appendix): rank(vwap-close) / rank(vwap+close)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 42.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_042"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_042',
+ 'nickname': 'Kakushadze Alpha #42',
+ 'theme': ['reversal'],
+ 'formula_latex': 'rank(vwap-close) / rank(vwap+close)',
+ 'columns_required': ['close', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = safe_div(rank(vwap - close), rank(vwap + close))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_043.py b/agent/src/factors/zoo/alpha101/alpha_043.py
new file mode 100644
index 000000000..bf11aaf65
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_043.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #43.
+
+Formula (paper appendix): ts_rank(volume/adv20,20) * ts_rank(-1*delta(close,7),8)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 43.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_043"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_043',
+ 'nickname': 'Kakushadze Alpha #43',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': 'ts_rank(volume/adv20,20) * ts_rank(-1*delta(close,7),8)',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 39,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = ts_rank(safe_div(volume, adv20), 20) * ts_rank(-1.0 * delta(close, 7), 8)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_044.py b/agent/src/factors/zoo/alpha101/alpha_044.py
new file mode 100644
index 000000000..3a1226ccd
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_044.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #44.
+
+Formula (paper appendix): -1 * correlation(high, rank(volume), 5)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 44.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_044"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_044',
+ 'nickname': 'Kakushadze Alpha #44',
+ 'theme': ['volume'],
+ 'formula_latex': '-1 * correlation(high, rank(volume), 5)',
+ 'columns_required': ['high', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * ts_corr(high, rank(volume), 5)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_045.py b/agent/src/factors/zoo/alpha101/alpha_045.py
new file mode 100644
index 000000000..e544a4649
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_045.py
@@ -0,0 +1,70 @@
+"""Kakushadze Alpha #45.
+
+Formula (paper appendix): -1 * (rank(sum(delay(close,5),20)/20)*correlation(close,volume,2)*rank(correlation(sum(close,5),sum(close,20),2)))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 45.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_045"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_045',
+ 'nickname': 'Kakushadze Alpha #45',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '-1 * (rank(sum(delay(close,5),20)/20)*correlation(close,volume,2)*rank(correlation(sum(close,5),sum(close,20),2)))',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ out = -1.0 * (rank(rolling_sum(delay(close, 5), 20) / 20.0) * ts_corr(close, volume, 2) * rank(ts_corr(rolling_sum(close, 5), rolling_sum(close, 20), 2)))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_046.py b/agent/src/factors/zoo/alpha101/alpha_046.py
new file mode 100644
index 000000000..c95e2b5a5
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_046.py
@@ -0,0 +1,93 @@
+"""Kakushadze Alpha #46.
+
+Formula (paper appendix): complex piecewise; see paper
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 46.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_046"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_046',
+ 'nickname': 'Kakushadze Alpha #46',
+ 'theme': ['momentum'],
+ 'formula_latex': 'complex piecewise; see paper',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def _make_one(ref: pd.DataFrame) -> pd.DataFrame:
+ """A DataFrame of 1.0 with the same shape/index/columns as ``ref``."""
+ return pd.DataFrame(1.0, index=ref.index, columns=ref.columns)
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ delay = _delay
+ make_one = _make_one
+ where_ternary = _where_ternary
+ x = ((delay(close, 20) - delay(close, 10)) / 10.0) - ((delay(close, 10) - close) / 10.0)
+ one = make_one(close)
+ out = where_ternary(0.25 < x, -1.0 * one, where_ternary(x < 0.0, one, -1.0 * (close - delay(close, 1))))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_047.py b/agent/src/factors/zoo/alpha101/alpha_047.py
new file mode 100644
index 000000000..fa5a29c19
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_047.py
@@ -0,0 +1,80 @@
+"""Kakushadze Alpha #47.
+
+Formula (paper appendix): ((rank(1/close)*volume/adv20) * (high*rank(high-close)/(sum(high,5)/5))) - rank(vwap-delay(vwap,5))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 47.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_047"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_047',
+ 'nickname': 'Kakushadze Alpha #47',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': '((rank(1/close)*volume/adv20) * (high*rank(high-close)/(sum(high,5)/5))) - rank(vwap-delay(vwap,5))',
+ 'columns_required': ['high', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def _make_one(ref: pd.DataFrame) -> pd.DataFrame:
+ """A DataFrame of 1.0 with the same shape/index/columns as ``ref``."""
+ return pd.DataFrame(1.0, index=ref.index, columns=ref.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ make_one = _make_one
+ t1 = safe_div(rank(safe_div(make_one(close), close)) * volume, adv20)
+ t2 = safe_div(high * rank(high - close), rolling_sum(high, 5) / 5.0)
+ out = t1 * t2 - rank(vwap - delay(vwap, 5))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_048.py b/agent/src/factors/zoo/alpha101/alpha_048.py
new file mode 100644
index 000000000..bcfc9b11b
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_048.py
@@ -0,0 +1,104 @@
+"""Kakushadze Alpha #48.
+
+Formula (paper appendix): indneutralize(...subindustry...) / sum((delta(close,1)/delay(close,1))^2, 250)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 48.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_048"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_048',
+ 'nickname': 'Kakushadze Alpha #48',
+ 'theme': ['momentum', 'volatility'],
+ 'formula_latex': 'indneutralize(...subindustry...) / sum((delta(close,1)/delay(close,1))^2, 250)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 251,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ ind_neutralize = _ind_neutralize
+ num = (ts_corr(delta(close, 1), delta(delay(close, 1), 1), 250) * delta(close, 1)) / close
+ num = ind_neutralize(num, panel)
+ denom = rolling_sum(safe_div(delta(close, 1), delay(close, 1)).pow(2), 250)
+ out = safe_div(num, denom)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_049.py b/agent/src/factors/zoo/alpha101/alpha_049.py
new file mode 100644
index 000000000..f649ce1bc
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_049.py
@@ -0,0 +1,93 @@
+"""Kakushadze Alpha #49.
+
+Formula (paper appendix): (((delay(close,20)-delay(close,10))/10 - (delay(close,10)-close)/10) < -0.1) ? 1 : -1*(close-delay(close,1))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 49.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_049"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_049',
+ 'nickname': 'Kakushadze Alpha #49',
+ 'theme': ['momentum'],
+ 'formula_latex': '(((delay(close,20)-delay(close,10))/10 - (delay(close,10)-close)/10) < -0.1) ? 1 : -1*(close-delay(close,1))',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def _make_one(ref: pd.DataFrame) -> pd.DataFrame:
+ """A DataFrame of 1.0 with the same shape/index/columns as ``ref``."""
+ return pd.DataFrame(1.0, index=ref.index, columns=ref.columns)
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ delay = _delay
+ make_one = _make_one
+ where_ternary = _where_ternary
+ x = ((delay(close, 20) - delay(close, 10)) / 10.0) - ((delay(close, 10) - close) / 10.0)
+ one = make_one(close)
+ out = where_ternary(x < -0.1, one, -1.0 * (close - delay(close, 1)))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_050.py b/agent/src/factors/zoo/alpha101/alpha_050.py
new file mode 100644
index 000000000..94253ca07
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_050.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #50.
+
+Formula (paper appendix): -1 * ts_max(rank(correlation(rank(volume), rank(vwap), 5)), 5)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 50.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_050"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_050',
+ 'nickname': 'Kakushadze Alpha #50',
+ 'theme': ['volume'],
+ 'formula_latex': '-1 * ts_max(rank(correlation(rank(volume), rank(vwap), 5)), 5)',
+ 'columns_required': ['volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = -1.0 * ts_max(rank(ts_corr(rank(volume), rank(vwap), 5)), 5)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_051.py b/agent/src/factors/zoo/alpha101/alpha_051.py
new file mode 100644
index 000000000..ba7830c2b
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_051.py
@@ -0,0 +1,93 @@
+"""Kakushadze Alpha #51.
+
+Formula (paper appendix): (...< -0.05) ? 1 : -1*(close-delay(close,1))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 51.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_051"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_051',
+ 'nickname': 'Kakushadze Alpha #51',
+ 'theme': ['momentum'],
+ 'formula_latex': '(...< -0.05) ? 1 : -1*(close-delay(close,1))',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def _make_one(ref: pd.DataFrame) -> pd.DataFrame:
+ """A DataFrame of 1.0 with the same shape/index/columns as ``ref``."""
+ return pd.DataFrame(1.0, index=ref.index, columns=ref.columns)
+
+
+def _where_ternary(cond, a, b):
+ """Vectorised ternary `(cond ? a : b)` returning a DataFrame.
+
+ ``cond`` is a boolean DataFrame; ``a`` / ``b`` may be DataFrame or scalar.
+ """
+ if isinstance(a, (int, float)):
+ a_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(a))
+ else:
+ a_arr = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ if isinstance(b, (int, float)):
+ b_arr = np.full_like(cond.to_numpy(dtype=np.float64), float(b))
+ else:
+ b_arr = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ cond_arr = cond.to_numpy(dtype=bool, na_value=False) if hasattr(cond, "to_numpy") else np.asarray(cond, dtype=bool)
+ out = np.where(cond_arr, a_arr, b_arr)
+ out = np.where(np.isfinite(out), out, np.nan)
+ idx = cond.index if hasattr(cond, "index") else a.index
+ cols = cond.columns if hasattr(cond, "columns") else a.columns
+ return pd.DataFrame(out, index=idx, columns=cols)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ delay = _delay
+ make_one = _make_one
+ where_ternary = _where_ternary
+ x = ((delay(close, 20) - delay(close, 10)) / 10.0) - ((delay(close, 10) - close) / 10.0)
+ one = make_one(close)
+ out = where_ternary(x < -0.05, one, -1.0 * (close - delay(close, 1)))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_052.py b/agent/src/factors/zoo/alpha101/alpha_052.py
new file mode 100644
index 000000000..b4f5d26be
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_052.py
@@ -0,0 +1,71 @@
+"""Kakushadze Alpha #52.
+
+Formula (paper appendix): ((-1*ts_min(low,5)+delay(ts_min(low,5),5)) * rank((sum(returns,240)-sum(returns,20))/220)) * ts_rank(volume,5)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 52.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_052"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_052',
+ 'nickname': 'Kakushadze Alpha #52',
+ 'theme': ['momentum'],
+ 'formula_latex': '((-1*ts_min(low,5)+delay(ts_min(low,5),5)) * rank((sum(returns,240)-sum(returns,20))/220)) * ts_rank(volume,5)',
+ 'columns_required': ['low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 240,
+ 'notes': 'Very long lookback (>= ~100 bars); produces NaN warmup on short panels which may trigger the >95% NaN registry guard.',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ low = panel["low"]
+ volume = panel["volume"]
+
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ out = ((-1.0 * ts_min(low, 5)) + delay(ts_min(low, 5), 5)) * rank((rolling_sum(returns, 240) - rolling_sum(returns, 20)) / 220.0) * ts_rank(volume, 5)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_053.py b/agent/src/factors/zoo/alpha101/alpha_053.py
new file mode 100644
index 000000000..118369c32
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_053.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #53.
+
+Formula (paper appendix): -1 * delta(((close-low) - (high-close))/(close-low), 9)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 53.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_053"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_053',
+ 'nickname': 'Kakushadze Alpha #53',
+ 'theme': ['reversal'],
+ 'formula_latex': '-1 * delta(((close-low) - (high-close))/(close-low), 9)',
+ 'columns_required': ['high', 'low', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ x = safe_div(((close - low) - (high - close)), (close - low))
+ out = -1.0 * delta(x, 9)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_054.py b/agent/src/factors/zoo/alpha101/alpha_054.py
new file mode 100644
index 000000000..61c52c68a
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_054.py
@@ -0,0 +1,60 @@
+"""Kakushadze Alpha #54.
+
+Formula (paper appendix): -1 * ((low-close)*(open^5)) / ((low-high)*(close^5))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 54.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_054"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_054',
+ 'nickname': 'Kakushadze Alpha #54',
+ 'theme': ['reversal'],
+ 'formula_latex': '-1 * ((low-close)*(open^5)) / ((low-high)*(close^5))',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ num = (low - close) * open_.pow(5)
+ denom = (low - high) * close.pow(5)
+ out = -1.0 * safe_div(num, denom)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_055.py b/agent/src/factors/zoo/alpha101/alpha_055.py
new file mode 100644
index 000000000..26106043f
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_055.py
@@ -0,0 +1,59 @@
+"""Kakushadze Alpha #55.
+
+Formula (paper appendix): -1 * correlation(rank((close-ts_min(low,12))/(ts_max(high,12)-ts_min(low,12))), rank(volume), 6)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 55.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_055"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_055',
+ 'nickname': 'Kakushadze Alpha #55',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': '-1 * correlation(rank((close-ts_min(low,12))/(ts_max(high,12)-ts_min(low,12))), rank(volume), 6)',
+ 'columns_required': ['high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 17,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ x = safe_div(close - ts_min(low, 12), ts_max(high, 12) - ts_min(low, 12))
+ out = -1.0 * ts_corr(rank(x), rank(volume), 6)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_056.py b/agent/src/factors/zoo/alpha101/alpha_056.py
new file mode 100644
index 000000000..4629c9f21
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_056.py
@@ -0,0 +1,72 @@
+"""Kakushadze Alpha #56.
+
+Formula (paper appendix): 0 - 1*(rank(sum(returns,10)/sum(sum(returns,2),3)) * rank((returns * cap))) [cap unavailable -> 1]
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 56.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_056"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_056',
+ 'nickname': 'Kakushadze Alpha #56',
+ 'theme': ['momentum'],
+ 'formula_latex': '0 - 1*(rank(sum(returns,10)/sum(sum(returns,2),3)) * rank((returns * cap))) [cap unavailable -> 1]',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization. Paper formula uses market 'cap' which is not part of the standard OHLCV panel; substituted by a constant 1.0 DataFrame. Result remains a valid factor but loses the cap-weighting term.",
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _make_one(ref: pd.DataFrame) -> pd.DataFrame:
+ """A DataFrame of 1.0 with the same shape/index/columns as ``ref``."""
+ return pd.DataFrame(1.0, index=ref.index, columns=ref.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+
+
+ returns = close.pct_change()
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ make_one = _make_one
+ # 'cap' (market cap) is not part of the standard panel; degrade to 1.0
+ cap = make_one(close)
+ num = rolling_sum(returns, 10)
+ denom = rolling_sum(rolling_sum(returns, 2), 3)
+ out = 0.0 - (rank(safe_div(num, denom)) * rank(returns * cap))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_057.py b/agent/src/factors/zoo/alpha101/alpha_057.py
new file mode 100644
index 000000000..74304285f
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_057.py
@@ -0,0 +1,56 @@
+"""Kakushadze Alpha #57.
+
+Formula (paper appendix): 0 - 1 * ((close-vwap) / decay_linear(rank(ts_argmax(close,30)), 2))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 57.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_057"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_057',
+ 'nickname': 'Kakushadze Alpha #57',
+ 'theme': ['reversal'],
+ 'formula_latex': '0 - 1 * ((close-vwap) / decay_linear(rank(ts_argmax(close,30)), 2))',
+ 'columns_required': ['close', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 32,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = 0.0 - safe_div((close - vwap), decay_linear(rank(ts_argmax(close, 30)), 2))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_058.py b/agent/src/factors/zoo/alpha101/alpha_058.py
new file mode 100644
index 000000000..b7741df1d
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_058.py
@@ -0,0 +1,88 @@
+"""Kakushadze Alpha #58.
+
+Formula (paper appendix): -1 * Ts_Rank(decay_linear(correlation(IndNeutralize(vwap, sector), volume, 4), 8), 6)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 58.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_058"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_058',
+ 'nickname': 'Kakushadze Alpha #58',
+ 'theme': ['volume'],
+ 'formula_latex': '-1 * Ts_Rank(decay_linear(correlation(IndNeutralize(vwap, sector), volume, 4), 8), 6)',
+ 'columns_required': ['volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ out = -1.0 * ts_rank(decay_linear(ts_corr(ind_neutralize(vwap, panel), volume, 4), 8), 6)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_059.py b/agent/src/factors/zoo/alpha101/alpha_059.py
new file mode 100644
index 000000000..11d2b01ab
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_059.py
@@ -0,0 +1,89 @@
+"""Kakushadze Alpha #59.
+
+Formula (paper appendix): -1 * Ts_Rank(decay_linear(correlation(IndNeutralize(vwap*0.728+vwap*0.272, industry), volume, 4), 16), 8)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 59.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_059"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_059',
+ 'nickname': 'Kakushadze Alpha #59',
+ 'theme': ['volume'],
+ 'formula_latex': '-1 * Ts_Rank(decay_linear(correlation(IndNeutralize(vwap*0.728+vwap*0.272, industry), volume, 4), 16), 8)',
+ 'columns_required': ['volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 30,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ x = vwap * 0.728317 + vwap * (1.0 - 0.728317)
+ out = -1.0 * ts_rank(decay_linear(ts_corr(ind_neutralize(x, panel), volume, 4), 16), 8)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_060.py b/agent/src/factors/zoo/alpha101/alpha_060.py
new file mode 100644
index 000000000..d1a11869c
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_060.py
@@ -0,0 +1,59 @@
+"""Kakushadze Alpha #60.
+
+Formula (paper appendix): 0 - (2*scale(rank((((close-low)-(high-close))/(high-low))*volume)) - scale(rank(ts_argmax(close,10))))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 60.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_060"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_060',
+ 'nickname': 'Kakushadze Alpha #60',
+ 'theme': ['volume'],
+ 'formula_latex': '0 - (2*scale(rank((((close-low)-(high-close))/(high-low))*volume)) - scale(rank(ts_argmax(close,10))))',
+ 'columns_required': ['high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ x = safe_div(((close - low) - (high - close)), (high - low)) * volume
+ out = 0.0 - (2.0 * scale(rank(x)) - scale(rank(ts_argmax(close, 10))))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_061.py b/agent/src/factors/zoo/alpha101/alpha_061.py
new file mode 100644
index 000000000..3da09821d
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_061.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #61.
+
+Formula (paper appendix): rank(vwap - ts_min(vwap,16)) < rank(correlation(vwap, adv180, 18))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 61.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_061"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_061',
+ 'nickname': 'Kakushadze Alpha #61',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(vwap - ts_min(vwap,16)) < rank(correlation(vwap, adv180, 18))',
+ 'columns_required': ['volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 197,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv180 = ts_mean(volume, 180)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ lhs = rank(vwap - ts_min(vwap, 16))
+ rhs = rank(ts_corr(vwap, adv180, 18))
+ out = (lhs < rhs).astype(float)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_062.py b/agent/src/factors/zoo/alpha101/alpha_062.py
new file mode 100644
index 000000000..4a74ac7ab
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_062.py
@@ -0,0 +1,68 @@
+"""Kakushadze Alpha #62.
+
+Formula (paper appendix): (rank(correlation(vwap, sum(adv20,22), 10)) < rank(((rank(open)+rank(open)) < (rank((high+low)/2)+rank(high))))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 62.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_062"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_062',
+ 'nickname': 'Kakushadze Alpha #62',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(correlation(vwap, sum(adv20,22), 10)) < rank(((rank(open)+rank(open)) < (rank((high+low)/2)+rank(high))))) * -1',
+ 'columns_required': ['open', 'high', 'low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 35,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ lhs = rank(ts_corr(vwap, rolling_sum(adv20, 22), 10))
+ inner = ((rank(open_) + rank(open_)) < (rank((high + low) / 2.0) + rank(high))).astype(float)
+ rhs = rank(inner)
+ out = (lhs < rhs).astype(float) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_063.py b/agent/src/factors/zoo/alpha101/alpha_063.py
new file mode 100644
index 000000000..f6f9c929e
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_063.py
@@ -0,0 +1,99 @@
+"""Kakushadze Alpha #63.
+
+Formula (paper appendix): (rank(decay_linear(delta(IndNeutralize(close, industry), 2), 8)) - rank(decay_linear(correlation(0.318*vwap+0.682*open, sum(adv180,37), 14), 12))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 63.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_063"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_063',
+ 'nickname': 'Kakushadze Alpha #63',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': '(rank(decay_linear(delta(IndNeutralize(close, industry), 2), 8)) - rank(decay_linear(correlation(0.318*vwap+0.682*open, sum(adv180,37), 14), 12))) * -1',
+ 'columns_required': ['open', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 204,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv180 = ts_mean(volume, 180)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ ind_neutralize = _ind_neutralize
+ left = rank(decay_linear(delta(ind_neutralize(close, panel), 2), 8))
+ mix = vwap * 0.318108 + open_ * (1.0 - 0.318108)
+ right = rank(decay_linear(ts_corr(mix, rolling_sum(adv180, 37), 14), 12))
+ out = (left - right) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_064.py b/agent/src/factors/zoo/alpha101/alpha_064.py
new file mode 100644
index 000000000..a28a71f0f
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_064.py
@@ -0,0 +1,69 @@
+"""Kakushadze Alpha #64.
+
+Formula (paper appendix): (rank(correlation(sum(0.178*open+0.822*low,13), sum(adv120,13), 17)) < rank(delta(0.178*((high+low)/2)+0.822*vwap, 4))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 64.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_064"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_064',
+ 'nickname': 'Kakushadze Alpha #64',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(correlation(sum(0.178*open+0.822*low,13), sum(adv120,13), 17)) < rank(delta(0.178*((high+low)/2)+0.822*vwap, 4))) * -1',
+ 'columns_required': ['open', 'high', 'low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 136,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv120 = ts_mean(volume, 120)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ a = open_ * 0.178404 + low * (1.0 - 0.178404)
+ b = ((high + low) / 2.0) * 0.178404 + vwap * (1.0 - 0.178404)
+ lhs = rank(ts_corr(rolling_sum(a, 13), rolling_sum(adv120, 13), 17))
+ rhs = rank(delta(b, 4))
+ out = (lhs < rhs).astype(float) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_065.py b/agent/src/factors/zoo/alpha101/alpha_065.py
new file mode 100644
index 000000000..a75a0a5af
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_065.py
@@ -0,0 +1,66 @@
+"""Kakushadze Alpha #65.
+
+Formula (paper appendix): (rank(correlation(0.008*open+0.992*vwap, sum(adv60,9), 6)) < rank(open-ts_min(open,14))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 65.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_065"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_065',
+ 'nickname': 'Kakushadze Alpha #65',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(correlation(0.008*open+0.992*vwap, sum(adv60,9), 6)) < rank(open-ts_min(open,14))) * -1',
+ 'columns_required': ['open', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 65,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ open_ = panel["open"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv60 = ts_mean(volume, 60)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ mix = open_ * 0.00817205 + vwap * (1.0 - 0.00817205)
+ lhs = rank(ts_corr(mix, rolling_sum(adv60, 9), 6))
+ rhs = rank(open_ - ts_min(open_, 14))
+ out = (lhs < rhs).astype(float) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_066.py b/agent/src/factors/zoo/alpha101/alpha_066.py
new file mode 100644
index 000000000..0893b9580
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_066.py
@@ -0,0 +1,62 @@
+"""Kakushadze Alpha #66.
+
+Formula (paper appendix): (rank(decay_linear(delta(vwap,4), 7)) + Ts_Rank(decay_linear(((0.966*low+0.034*low - vwap)/(open-(high+low)/2)), 11), 7)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 66.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_066"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_066',
+ 'nickname': 'Kakushadze Alpha #66',
+ 'theme': ['momentum'],
+ 'formula_latex': '(rank(decay_linear(delta(vwap,4), 7)) + Ts_Rank(decay_linear(((0.966*low+0.034*low - vwap)/(open-(high+low)/2)), 11), 7)) * -1',
+ 'columns_required': ['open', 'high', 'low', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 18,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ t1 = rank(decay_linear(delta(vwap, 4), 7))
+ num = (low * 0.96633 + low * (1.0 - 0.96633)) - vwap
+ denom = open_ - (high + low) / 2.0
+ t2 = ts_rank(decay_linear(safe_div(num, denom), 11), 7)
+ out = (t1 + t2) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_067.py b/agent/src/factors/zoo/alpha101/alpha_067.py
new file mode 100644
index 000000000..ee99f1c60
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_067.py
@@ -0,0 +1,92 @@
+"""Kakushadze Alpha #67.
+
+Formula (paper appendix): (rank(high-ts_min(high,2))^rank(correlation(IndNeutralize(vwap,sector), IndNeutralize(adv20,subindustry), 6))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 67.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_067"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_067',
+ 'nickname': 'Kakushadze Alpha #67',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(high-ts_min(high,2))^rank(correlation(IndNeutralize(vwap,sector), IndNeutralize(adv20,subindustry), 6))) * -1',
+ 'columns_required': ['high', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 25,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ lhs = rank(high - ts_min(high, 2))
+ rhs = rank(ts_corr(ind_neutralize(vwap, panel), ind_neutralize(adv20, panel), 6))
+ out = signed_power(lhs, 1.0) * signed_power(rhs, 1.0) * -1.0 # power = rank-rank (use signed_power for stability); paper uses '^' as power but with rank result use product as common impl
+ out = (lhs * rhs) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_068.py b/agent/src/factors/zoo/alpha101/alpha_068.py
new file mode 100644
index 000000000..582aa9469
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_068.py
@@ -0,0 +1,61 @@
+"""Kakushadze Alpha #68.
+
+Formula (paper appendix): (Ts_Rank(correlation(rank(high), rank(adv15), 9), 14) < rank(delta(0.518*close+0.482*low, 1))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 68.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_068"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_068',
+ 'nickname': 'Kakushadze Alpha #68',
+ 'theme': ['volume'],
+ 'formula_latex': '(Ts_Rank(correlation(rank(high), rank(adv15), 9), 14) < rank(delta(0.518*close+0.482*low, 1))) * -1',
+ 'columns_required': ['high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 36,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv15 = ts_mean(volume, 15)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ lhs = ts_rank(ts_corr(rank(high), rank(adv15), 9), 14)
+ mix = close * 0.518371 + low * (1.0 - 0.518371)
+ rhs = rank(delta(mix, 1))
+ out = (lhs < rhs).astype(float) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_069.py b/agent/src/factors/zoo/alpha101/alpha_069.py
new file mode 100644
index 000000000..b135a4326
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_069.py
@@ -0,0 +1,92 @@
+"""Kakushadze Alpha #69.
+
+Formula (paper appendix): (rank(ts_max(delta(IndNeutralize(vwap, industry), 3), 5))^Ts_Rank(correlation(0.49*close+0.51*vwap, adv20, 5), 9)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 69.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_069"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_069',
+ 'nickname': 'Kakushadze Alpha #69',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(ts_max(delta(IndNeutralize(vwap, industry), 3), 5))^Ts_Rank(correlation(0.49*close+0.51*vwap, adv20, 5), 9)) * -1',
+ 'columns_required': ['close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 32,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ lhs = rank(ts_max(delta(ind_neutralize(vwap, panel), 3), 5))
+ mix = close * 0.490655 + vwap * (1.0 - 0.490655)
+ rhs = ts_rank(ts_corr(mix, adv20, 5), 9)
+ out = (lhs * rhs) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_070.py b/agent/src/factors/zoo/alpha101/alpha_070.py
new file mode 100644
index 000000000..c765ef339
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_070.py
@@ -0,0 +1,92 @@
+"""Kakushadze Alpha #70.
+
+Formula (paper appendix): (rank(delta(vwap,1))^Ts_Rank(correlation(IndNeutralize(close,industry), adv50, 18), 18)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 70.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_070"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_070',
+ 'nickname': 'Kakushadze Alpha #70',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '(rank(delta(vwap,1))^Ts_Rank(correlation(IndNeutralize(close,industry), adv50, 18), 18)) * -1',
+ 'columns_required': ['close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 84,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv5 = ts_mean(volume, 5)
+ adv50 = ts_mean(volume, 50)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ lhs = rank(delta(vwap, 1))
+ rhs = ts_rank(ts_corr(ind_neutralize(close, panel), adv50, 18), 18)
+ out = (lhs * rhs) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_071.py b/agent/src/factors/zoo/alpha101/alpha_071.py
new file mode 100644
index 000000000..b87d567cb
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_071.py
@@ -0,0 +1,64 @@
+"""Kakushadze Alpha #71.
+
+Formula (paper appendix): max(Ts_Rank(decay_linear(correlation(Ts_Rank(close,3), Ts_Rank(adv180,12), 18), 4), 16), Ts_Rank(decay_linear((rank((low+open)-(2*vwap))^2, 16), 4))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 71.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_071"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_071',
+ 'nickname': 'Kakushadze Alpha #71',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': 'max(Ts_Rank(decay_linear(correlation(Ts_Rank(close,3), Ts_Rank(adv180,12), 18), 4), 16), Ts_Rank(decay_linear((rank((low+open)-(2*vwap))^2, 16), 4))',
+ 'columns_required': ['open', 'low', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 226,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv180 = ts_mean(volume, 180)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ a = ts_rank(decay_linear(ts_corr(ts_rank(close, 3), ts_rank(adv180, 12), 18), 4), 16)
+ inner = signed_power(rank((low + open_) - (vwap + vwap)), 2.0)
+ b = ts_rank(decay_linear(inner, 16), 4)
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmax(arr_a, arr_b), index=close.index, columns=close.columns)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_072.py b/agent/src/factors/zoo/alpha101/alpha_072.py
new file mode 100644
index 000000000..16c488f5f
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_072.py
@@ -0,0 +1,60 @@
+"""Kakushadze Alpha #72.
+
+Formula (paper appendix): rank(decay_linear(correlation((high+low)/2, adv40, 9), 10)) / rank(decay_linear(correlation(Ts_Rank(vwap,4), Ts_Rank(volume,19), 7), 3))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 72.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_072"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_072',
+ 'nickname': 'Kakushadze Alpha #72',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(decay_linear(correlation((high+low)/2, adv40, 9), 10)) / rank(decay_linear(correlation(Ts_Rank(vwap,4), Ts_Rank(volume,19), 7), 3))',
+ 'columns_required': ['high', 'low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 57,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv40 = ts_mean(volume, 40)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ num = rank(decay_linear(ts_corr((high + low) / 2.0, adv40, 9), 10))
+ denom = rank(decay_linear(ts_corr(ts_rank(vwap, 4), ts_rank(volume, 19), 7), 3))
+ out = safe_div(num, denom)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_073.py b/agent/src/factors/zoo/alpha101/alpha_073.py
new file mode 100644
index 000000000..5cd7a24cb
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_073.py
@@ -0,0 +1,64 @@
+"""Kakushadze Alpha #73.
+
+Formula (paper appendix): max(rank(decay_linear(delta(vwap,5), 3)), Ts_Rank(decay_linear(-1*(delta(0.147*open+0.853*low,2)/(0.147*open+0.853*low)), 3), 17)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 73.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_073"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_073',
+ 'nickname': 'Kakushadze Alpha #73',
+ 'theme': ['volume'],
+ 'formula_latex': 'max(rank(decay_linear(delta(vwap,5), 3)), Ts_Rank(decay_linear(-1*(delta(0.147*open+0.853*low,2)/(0.147*open+0.853*low)), 3), 17)) * -1',
+ 'columns_required': ['open', 'low', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ low = panel["low"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ a = rank(decay_linear(delta(vwap, 5), 3))
+ mix = open_ * 0.147155 + low * (1.0 - 0.147155)
+ b_inner = safe_div(delta(mix, 2), mix) * -1.0
+ b = ts_rank(decay_linear(b_inner, 3), 17)
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmax(arr_a, arr_b), index=close.index, columns=close.columns) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_074.py b/agent/src/factors/zoo/alpha101/alpha_074.py
new file mode 100644
index 000000000..fbedd346d
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_074.py
@@ -0,0 +1,67 @@
+"""Kakushadze Alpha #74.
+
+Formula (paper appendix): (rank(correlation(close, sum(adv30,37), 15)) < rank(correlation(rank(0.026*high+0.974*vwap), rank(volume), 11))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 74.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_074"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_074',
+ 'nickname': 'Kakushadze Alpha #74',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(correlation(close, sum(adv30,37), 15)) < rank(correlation(rank(0.026*high+0.974*vwap), rank(volume), 11))) * -1',
+ 'columns_required': ['high', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 60,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv30 = ts_mean(volume, 30)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ lhs = rank(ts_corr(close, rolling_sum(adv30, 37), 15))
+ mix = high * 0.0261661 + vwap * (1.0 - 0.0261661)
+ rhs = rank(ts_corr(rank(mix), rank(volume), 11))
+ out = (lhs < rhs).astype(float) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_075.py b/agent/src/factors/zoo/alpha101/alpha_075.py
new file mode 100644
index 000000000..0cf02d0b2
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_075.py
@@ -0,0 +1,60 @@
+"""Kakushadze Alpha #75.
+
+Formula (paper appendix): rank(correlation(vwap, volume, 4)) < rank(correlation(rank(low), rank(adv50), 12))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 75.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_075"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_075',
+ 'nickname': 'Kakushadze Alpha #75',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(correlation(vwap, volume, 4)) < rank(correlation(rank(low), rank(adv50), 12))',
+ 'columns_required': ['low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 61,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv5 = ts_mean(volume, 5)
+ adv50 = ts_mean(volume, 50)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ lhs = rank(ts_corr(vwap, volume, 4))
+ rhs = rank(ts_corr(rank(low), rank(adv50), 12))
+ out = (lhs < rhs).astype(float)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_076.py b/agent/src/factors/zoo/alpha101/alpha_076.py
new file mode 100644
index 000000000..fb61f885d
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_076.py
@@ -0,0 +1,94 @@
+"""Kakushadze Alpha #76.
+
+Formula (paper appendix): max(rank(decay_linear(delta(vwap,1),12)), Ts_Rank(decay_linear(Ts_Rank(correlation(IndNeutralize(low, sector), adv81, 8), 20), 17), 19)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 76.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_076"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_076',
+ 'nickname': 'Kakushadze Alpha #76',
+ 'theme': ['volume'],
+ 'formula_latex': 'max(rank(decay_linear(delta(vwap,1),12)), Ts_Rank(decay_linear(Ts_Rank(correlation(IndNeutralize(low, sector), adv81, 8), 20), 17), 19)) * -1',
+ 'columns_required': ['low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 141,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv81 = ts_mean(volume, 81)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ a = rank(decay_linear(delta(vwap, 1), 12))
+ b = ts_rank(decay_linear(ts_rank(ts_corr(ind_neutralize(low, panel), adv81, 8), 20), 17), 19)
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmax(arr_a, arr_b), index=close.index, columns=close.columns) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_077.py b/agent/src/factors/zoo/alpha101/alpha_077.py
new file mode 100644
index 000000000..39b2fd4d4
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_077.py
@@ -0,0 +1,63 @@
+"""Kakushadze Alpha #77.
+
+Formula (paper appendix): min(rank(decay_linear((high+low)/2 + high - (vwap+high), 20)), rank(decay_linear(correlation((high+low)/2, adv40, 3), 6)))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 77.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_077"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_077',
+ 'nickname': 'Kakushadze Alpha #77',
+ 'theme': ['volume'],
+ 'formula_latex': 'min(rank(decay_linear((high+low)/2 + high - (vwap+high), 20)), rank(decay_linear(correlation((high+low)/2, adv40, 3), 6)))',
+ 'columns_required': ['high', 'low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 47,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv40 = ts_mean(volume, 40)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ a = rank(decay_linear(((high + low) / 2.0) + high - (vwap + high), 20))
+ b = rank(decay_linear(ts_corr((high + low) / 2.0, adv40, 3), 6))
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmin(arr_a, arr_b), index=close.index, columns=close.columns)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_078.py b/agent/src/factors/zoo/alpha101/alpha_078.py
new file mode 100644
index 000000000..82d1253c7
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_078.py
@@ -0,0 +1,66 @@
+"""Kakushadze Alpha #78.
+
+Formula (paper appendix): rank(correlation(sum(0.352*low+0.648*vwap, 20), sum(adv40,20), 7))^rank(correlation(rank(vwap), rank(volume), 6))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 78.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_078"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_078',
+ 'nickname': 'Kakushadze Alpha #78',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(correlation(sum(0.352*low+0.648*vwap, 20), sum(adv40,20), 7))^rank(correlation(rank(vwap), rank(volume), 6))',
+ 'columns_required': ['low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 46,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv40 = ts_mean(volume, 40)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ mix = low * 0.352233 + vwap * (1.0 - 0.352233)
+ lhs = rank(ts_corr(rolling_sum(mix, 20), rolling_sum(adv40, 20), 7))
+ rhs = rank(ts_corr(rank(vwap), rank(volume), 6))
+ out = lhs * rhs
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_079.py b/agent/src/factors/zoo/alpha101/alpha_079.py
new file mode 100644
index 000000000..2216f75d0
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_079.py
@@ -0,0 +1,94 @@
+"""Kakushadze Alpha #79.
+
+Formula (paper appendix): rank(delta(IndNeutralize(0.607*close+0.393*open, sector), 1)) < rank(correlation(Ts_Rank(vwap,4), Ts_Rank(adv150,9), 15))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 79.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_079"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_079',
+ 'nickname': 'Kakushadze Alpha #79',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': 'rank(delta(IndNeutralize(0.607*close+0.393*open, sector), 1)) < rank(correlation(Ts_Rank(vwap,4), Ts_Rank(adv150,9), 15))',
+ 'columns_required': ['open', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 172,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv15 = ts_mean(volume, 15)
+ adv150 = ts_mean(volume, 150)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ mix = close * 0.60733 + open_ * (1.0 - 0.60733)
+ lhs = rank(delta(ind_neutralize(mix, panel), 1))
+ rhs = rank(ts_corr(ts_rank(vwap, 4), ts_rank(adv150, 9), 15))
+ out = (lhs < rhs).astype(float)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_080.py b/agent/src/factors/zoo/alpha101/alpha_080.py
new file mode 100644
index 000000000..0f0e3a80d
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_080.py
@@ -0,0 +1,94 @@
+"""Kakushadze Alpha #80.
+
+Formula (paper appendix): (rank(Sign(delta(IndNeutralize(0.868*open+0.132*high, subindustry),4)))^Ts_Rank(correlation(high,adv10,5),6)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 80.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_080"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_080',
+ 'nickname': 'Kakushadze Alpha #80',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '(rank(Sign(delta(IndNeutralize(0.868*open+0.132*high, subindustry),4)))^Ts_Rank(correlation(high,adv10,5),6)) * -1',
+ 'columns_required': ['open', 'high', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 19,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ high = panel["high"]
+ volume = panel["volume"]
+ adv10 = ts_mean(volume, 10)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ mix = open_ * 0.868128 + high * (1.0 - 0.868128)
+ lhs_inner = delta(ind_neutralize(mix, panel), 4)
+ lhs = rank(pd.DataFrame(np.sign(lhs_inner.to_numpy(dtype=np.float64, na_value=np.nan)), index=close.index, columns=close.columns))
+ rhs = ts_rank(ts_corr(high, adv10, 5), 6)
+ out = (lhs * rhs) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_081.py b/agent/src/factors/zoo/alpha101/alpha_081.py
new file mode 100644
index 000000000..93562eeaf
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_081.py
@@ -0,0 +1,74 @@
+"""Kakushadze Alpha #81.
+
+Formula (paper appendix): (rank(Log(product(rank((rank(correlation(vwap, sum(adv10,50), 8))^4)), 15))) < rank(correlation(rank(vwap), rank(volume), 5))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 81.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_081"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_081',
+ 'nickname': 'Kakushadze Alpha #81',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(Log(product(rank((rank(correlation(vwap, sum(adv10,50), 8))^4)), 15))) < rank(correlation(rank(vwap), rank(volume), 5))) * -1',
+ 'columns_required': ['volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 70,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _rolling_prod(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window product; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).apply(np.prod, raw=True)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv10 = ts_mean(volume, 10)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ rolling_prod = _rolling_prod
+ inner = rank(ts_corr(vwap, rolling_sum(adv10, 50), 8))
+ inner = signed_power(inner, 4.0)
+ inner = rank(inner)
+ prod = rolling_prod(inner, 15)
+ lhs = rank(np.log(prod.where(prod > 0)))
+ rhs = rank(ts_corr(rank(vwap), rank(volume), 5))
+ out = (lhs < rhs).astype(float) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_082.py b/agent/src/factors/zoo/alpha101/alpha_082.py
new file mode 100644
index 000000000..5ca124330
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_082.py
@@ -0,0 +1,94 @@
+"""Kakushadze Alpha #82.
+
+Formula (paper appendix): min(rank(decay_linear(delta(open,1),15)), Ts_Rank(decay_linear(correlation(IndNeutralize(volume, sector), 0.634*open+0.366*open, 17), 7), 13)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 82.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_082"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_082',
+ 'nickname': 'Kakushadze Alpha #82',
+ 'theme': ['volume'],
+ 'formula_latex': 'min(rank(decay_linear(delta(open,1),15)), Ts_Rank(decay_linear(correlation(IndNeutralize(volume, sector), 0.634*open+0.366*open, 17), 7), 13)) * -1',
+ 'columns_required': ['open', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 35,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ volume = panel["volume"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ a = rank(decay_linear(delta(open_, 1), 15))
+ mix = open_ * 0.634196 + open_ * (1.0 - 0.634196)
+ b = ts_rank(decay_linear(ts_corr(ind_neutralize(volume, panel), mix, 17), 7), 13)
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmin(arr_a, arr_b), index=close.index, columns=close.columns) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_083.py b/agent/src/factors/zoo/alpha101/alpha_083.py
new file mode 100644
index 000000000..cf9427dad
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_083.py
@@ -0,0 +1,76 @@
+"""Kakushadze Alpha #83.
+
+Formula (paper appendix): (rank(delay((high-low)/(sum(close,5)/5), 2)) * rank(rank(volume))) / (((high-low)/(sum(close,5)/5)) / (vwap-close))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 83.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_083"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_083',
+ 'nickname': 'Kakushadze Alpha #83',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '(rank(delay((high-low)/(sum(close,5)/5), 2)) * rank(rank(volume))) / (((high-low)/(sum(close,5)/5)) / (vwap-close))',
+ 'columns_required': ['high', 'low', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 7,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def _delay(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Backward shift by n (lookahead-safe; n>=1 required)."""
+ if n < 1:
+ raise ValueError("delay requires n >= 1 (lookahead ban)")
+ return df.shift(n)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ delay = _delay
+ rng_avg = safe_div((high - low), rolling_sum(close, 5) / 5.0)
+ num = rank(delay(rng_avg, 2)) * rank(rank(volume))
+ denom = safe_div(rng_avg, vwap - close)
+ out = safe_div(num, denom)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_084.py b/agent/src/factors/zoo/alpha101/alpha_084.py
new file mode 100644
index 000000000..5316efebb
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_084.py
@@ -0,0 +1,62 @@
+"""Kakushadze Alpha #84.
+
+Formula (paper appendix): SignedPower(Ts_Rank(vwap-ts_max(vwap,15), 21), delta(close,5))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 84.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_084"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_084',
+ 'nickname': 'Kakushadze Alpha #84',
+ 'theme': ['momentum'],
+ 'formula_latex': 'SignedPower(Ts_Rank(vwap-ts_max(vwap,15), 21), delta(close,5))',
+ 'columns_required': ['close', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 35,
+ 'notes': "SignedPower with a delta(close,5) exponent can produce non-finite values when the exponent is large; non-finite outputs are clipped to NaN to satisfy the registry's no-inf invariant.",
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ vwap = panel["vwap"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ base = ts_rank(vwap - ts_max(vwap, 15), 21)
+ exponent_df = delta(close, 5)
+ base_arr = base.to_numpy(dtype=np.float64, na_value=np.nan)
+ exp_arr = exponent_df.to_numpy(dtype=np.float64, na_value=np.nan)
+ out_arr = np.sign(base_arr) * np.power(np.abs(base_arr), exp_arr)
+ out_arr = np.where(np.isfinite(out_arr), out_arr, np.nan)
+ out = pd.DataFrame(out_arr, index=close.index, columns=close.columns)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_085.py b/agent/src/factors/zoo/alpha101/alpha_085.py
new file mode 100644
index 000000000..1b851f408
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_085.py
@@ -0,0 +1,61 @@
+"""Kakushadze Alpha #85.
+
+Formula (paper appendix): rank(correlation(0.877*high+0.123*close, adv30, 10))^rank(correlation(Ts_Rank((high+low)/2,4), Ts_Rank(volume,10), 7))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 85.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_085"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_085',
+ 'nickname': 'Kakushadze Alpha #85',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(correlation(0.877*high+0.123*close, adv30, 10))^rank(correlation(Ts_Rank((high+low)/2,4), Ts_Rank(volume,10), 7))',
+ 'columns_required': ['high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 39,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv30 = ts_mean(volume, 30)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ mix = high * 0.876703 + close * (1.0 - 0.876703)
+ lhs = rank(ts_corr(mix, adv30, 10))
+ rhs = rank(ts_corr(ts_rank((high + low) / 2.0, 4), ts_rank(volume, 10), 7))
+ out = lhs * rhs
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_086.py b/agent/src/factors/zoo/alpha101/alpha_086.py
new file mode 100644
index 000000000..1f5777b56
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_086.py
@@ -0,0 +1,66 @@
+"""Kakushadze Alpha #86.
+
+Formula (paper appendix): (Ts_Rank(correlation(close, sum(adv20,15), 6), 20) < rank((open+close) - (vwap+open))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 86.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_086"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_086',
+ 'nickname': 'Kakushadze Alpha #86',
+ 'theme': ['volume'],
+ 'formula_latex': '(Ts_Rank(correlation(close, sum(adv20,15), 6), 20) < rank((open+close) - (vwap+open))) * -1',
+ 'columns_required': ['open', 'close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 44,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ lhs = ts_rank(ts_corr(close, rolling_sum(adv20, 15), 6), 20)
+ rhs = rank((open_ + close) - (vwap + open_))
+ out = (lhs < rhs).astype(float) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_087.py b/agent/src/factors/zoo/alpha101/alpha_087.py
new file mode 100644
index 000000000..0bdbf3942
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_087.py
@@ -0,0 +1,94 @@
+"""Kakushadze Alpha #87.
+
+Formula (paper appendix): max(rank(decay_linear(delta(0.37*close+0.63*vwap, 2), 3)), Ts_Rank(decay_linear(abs(correlation(IndNeutralize(adv81, industry), close, 13)), 5), 14)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 87.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_087"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_087',
+ 'nickname': 'Kakushadze Alpha #87',
+ 'theme': ['momentum'],
+ 'formula_latex': 'max(rank(decay_linear(delta(0.37*close+0.63*vwap, 2), 3)), Ts_Rank(decay_linear(abs(correlation(IndNeutralize(adv81, industry), close, 13)), 5), 14)) * -1',
+ 'columns_required': ['close', 'vwap', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 110,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ vwap = panel["vwap"]
+ volume = panel["volume"]
+ adv81 = ts_mean(volume, 81)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ mix = close * 0.369701 + vwap * (1.0 - 0.369701)
+ a = rank(decay_linear(delta(mix, 2), 3))
+ b = ts_rank(decay_linear(ts_corr(ind_neutralize(adv81, panel), close, 13).abs(), 5), 14)
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmax(arr_a, arr_b), index=close.index, columns=close.columns) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_088.py b/agent/src/factors/zoo/alpha101/alpha_088.py
new file mode 100644
index 000000000..2ae9744d8
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_088.py
@@ -0,0 +1,63 @@
+"""Kakushadze Alpha #88.
+
+Formula (paper appendix): min(rank(decay_linear((rank(open)+rank(low))-(rank(high)+rank(close)),8)), Ts_Rank(decay_linear(correlation(Ts_Rank(close,8),Ts_Rank(adv60,20),8),7),3))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 88.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_088"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_088',
+ 'nickname': 'Kakushadze Alpha #88',
+ 'theme': ['volume'],
+ 'formula_latex': 'min(rank(decay_linear((rank(open)+rank(low))-(rank(high)+rank(close)),8)), Ts_Rank(decay_linear(correlation(Ts_Rank(close,8),Ts_Rank(adv60,20),8),7),3))',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 94,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv60 = ts_mean(volume, 60)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ a = rank(decay_linear((rank(open_) + rank(low)) - (rank(high) + rank(close)), 8))
+ b = ts_rank(decay_linear(ts_corr(ts_rank(close, 8), ts_rank(adv60, 20), 8), 7), 3)
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmin(arr_a, arr_b), index=close.index, columns=close.columns)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_089.py b/agent/src/factors/zoo/alpha101/alpha_089.py
new file mode 100644
index 000000000..703c8a626
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_089.py
@@ -0,0 +1,92 @@
+"""Kakushadze Alpha #89.
+
+Formula (paper appendix): Ts_Rank(decay_linear(correlation(low, adv10, 7), 6), 4) - Ts_Rank(decay_linear(delta(IndNeutralize(vwap, industry),3),10),15)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 89.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_089"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_089',
+ 'nickname': 'Kakushadze Alpha #89',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': 'Ts_Rank(decay_linear(correlation(low, adv10, 7), 6), 4) - Ts_Rank(decay_linear(delta(IndNeutralize(vwap, industry),3),10),15)',
+ 'columns_required': ['low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 30,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv10 = ts_mean(volume, 10)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ mix = low * 0.967285 + low * (1.0 - 0.967285)
+ a = ts_rank(decay_linear(ts_corr(mix, adv10, 7), 6), 4)
+ b = ts_rank(decay_linear(delta(ind_neutralize(vwap, panel), 3), 10), 15)
+ out = a - b
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_090.py b/agent/src/factors/zoo/alpha101/alpha_090.py
new file mode 100644
index 000000000..9d0b8603f
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_090.py
@@ -0,0 +1,91 @@
+"""Kakushadze Alpha #90.
+
+Formula (paper appendix): (rank(close-ts_max(close,5))^Ts_Rank(correlation(IndNeutralize(adv40, subindustry), low, 5), 3)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 90.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_090"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_090',
+ 'nickname': 'Kakushadze Alpha #90',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(close-ts_max(close,5))^Ts_Rank(correlation(IndNeutralize(adv40, subindustry), low, 5), 3)) * -1',
+ 'columns_required': ['low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 46,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv40 = ts_mean(volume, 40)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ lhs = rank(close - ts_max(close, 5))
+ rhs = ts_rank(ts_corr(ind_neutralize(adv40, panel), low, 5), 3)
+ out = (lhs * rhs) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_091.py b/agent/src/factors/zoo/alpha101/alpha_091.py
new file mode 100644
index 000000000..cffdef074
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_091.py
@@ -0,0 +1,91 @@
+"""Kakushadze Alpha #91.
+
+Formula (paper appendix): (Ts_Rank(decay_linear(decay_linear(correlation(IndNeutralize(close, industry), volume, 10), 16), 4), 5) - rank(decay_linear(correlation(vwap, adv30, 4), 3))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 91.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_091"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_091',
+ 'nickname': 'Kakushadze Alpha #91',
+ 'theme': ['volume'],
+ 'formula_latex': '(Ts_Rank(decay_linear(decay_linear(correlation(IndNeutralize(close, industry), volume, 10), 16), 4), 5) - rank(decay_linear(correlation(vwap, adv30, 4), 3))) * -1',
+ 'columns_required': ['close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 35,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv30 = ts_mean(volume, 30)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ a = ts_rank(decay_linear(decay_linear(ts_corr(ind_neutralize(close, panel), volume, 10), 16), 4), 5)
+ b = rank(decay_linear(ts_corr(vwap, adv30, 4), 3))
+ out = (a - b) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_092.py b/agent/src/factors/zoo/alpha101/alpha_092.py
new file mode 100644
index 000000000..9a6117144
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_092.py
@@ -0,0 +1,64 @@
+"""Kakushadze Alpha #92.
+
+Formula (paper appendix): min(Ts_Rank(decay_linear(((high+low)/2 + close < low+open), 15), 19), Ts_Rank(decay_linear(correlation(rank(low), rank(adv30), 8), 7), 7))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 92.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_092"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_092',
+ 'nickname': 'Kakushadze Alpha #92',
+ 'theme': ['volume'],
+ 'formula_latex': 'min(Ts_Rank(decay_linear(((high+low)/2 + close < low+open), 15), 19), Ts_Rank(decay_linear(correlation(rank(low), rank(adv30), 8), 7), 7))',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 49,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv30 = ts_mean(volume, 30)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ cond = (((high + low) / 2.0 + close) < (low + open_)).astype(float)
+ a = ts_rank(decay_linear(cond, 15), 19)
+ b = ts_rank(decay_linear(ts_corr(rank(low), rank(adv30), 8), 7), 7)
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmin(arr_a, arr_b), index=close.index, columns=close.columns)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_093.py b/agent/src/factors/zoo/alpha101/alpha_093.py
new file mode 100644
index 000000000..479d339f7
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_093.py
@@ -0,0 +1,92 @@
+"""Kakushadze Alpha #93.
+
+Formula (paper appendix): Ts_Rank(decay_linear(correlation(IndNeutralize(vwap, industry), adv81, 17), 20), 8) / rank(decay_linear(delta(0.524*close+0.476*vwap, 3), 16))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 93.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_093"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_093',
+ 'nickname': 'Kakushadze Alpha #93',
+ 'theme': ['volume'],
+ 'formula_latex': 'Ts_Rank(decay_linear(correlation(IndNeutralize(vwap, industry), adv81, 17), 20), 8) / rank(decay_linear(delta(0.524*close+0.476*vwap, 3), 16))',
+ 'columns_required': ['close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 123,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv81 = ts_mean(volume, 81)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ a = ts_rank(decay_linear(ts_corr(ind_neutralize(vwap, panel), adv81, 17), 20), 8)
+ mix = close * 0.524434 + vwap * (1.0 - 0.524434)
+ b = rank(decay_linear(delta(mix, 3), 16))
+ out = safe_div(a, b)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_094.py b/agent/src/factors/zoo/alpha101/alpha_094.py
new file mode 100644
index 000000000..a7272b7ea
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_094.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #94.
+
+Formula (paper appendix): (rank(vwap-ts_min(vwap,12))^Ts_Rank(correlation(Ts_Rank(vwap,20), Ts_Rank(adv60,4), 18), 3)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 94.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_094"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_094',
+ 'nickname': 'Kakushadze Alpha #94',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(vwap-ts_min(vwap,12))^Ts_Rank(correlation(Ts_Rank(vwap,20), Ts_Rank(adv60,4), 18), 3)) * -1',
+ 'columns_required': ['volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 82,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv60 = ts_mean(volume, 60)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ lhs = rank(vwap - ts_min(vwap, 12))
+ rhs = ts_rank(ts_corr(ts_rank(vwap, 20), ts_rank(adv60, 4), 18), 3)
+ out = (lhs * rhs) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_095.py b/agent/src/factors/zoo/alpha101/alpha_095.py
new file mode 100644
index 000000000..8a1933531
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_095.py
@@ -0,0 +1,68 @@
+"""Kakushadze Alpha #95.
+
+Formula (paper appendix): rank(open-ts_min(open,13)) < Ts_Rank((rank(correlation(sum((high+low)/2,19), sum(adv40,19),13))^5), 12)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 95.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_095"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_095',
+ 'nickname': 'Kakushadze Alpha #95',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(open-ts_min(open,13)) < Ts_Rank((rank(correlation(sum((high+low)/2,19), sum(adv40,19),13))^5), 12)',
+ 'columns_required': ['open', 'high', 'low', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 63,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv40 = ts_mean(volume, 40)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ lhs = rank(open_ - ts_min(open_, 13))
+ inner = rank(ts_corr(rolling_sum((high + low) / 2.0, 19), rolling_sum(adv40, 19), 13))
+ inner = signed_power(inner, 5.0)
+ rhs = ts_rank(inner, 12)
+ out = (lhs < rhs).astype(float)
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_096.py b/agent/src/factors/zoo/alpha101/alpha_096.py
new file mode 100644
index 000000000..b152c5be8
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_096.py
@@ -0,0 +1,61 @@
+"""Kakushadze Alpha #96.
+
+Formula (paper appendix): max(Ts_Rank(decay_linear(correlation(rank(vwap), rank(volume), 4), 4), 8), Ts_Rank(decay_linear(Ts_ArgMax(correlation(Ts_Rank(close,7), Ts_Rank(adv60,4), 4), 13), 14), 13)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 96.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_096"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_096',
+ 'nickname': 'Kakushadze Alpha #96',
+ 'theme': ['volume'],
+ 'formula_latex': 'max(Ts_Rank(decay_linear(correlation(rank(vwap), rank(volume), 4), 4), 8), Ts_Rank(decay_linear(Ts_ArgMax(correlation(Ts_Rank(close,7), Ts_Rank(adv60,4), 4), 13), 14), 13)) * -1',
+ 'columns_required': ['close', 'volume', 'vwap'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 103,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv60 = ts_mean(volume, 60)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ a = ts_rank(decay_linear(ts_corr(rank(vwap), rank(volume), 4), 4), 8)
+ b = ts_rank(decay_linear(ts_argmax(ts_corr(ts_rank(close, 7), ts_rank(adv60, 4), 4), 13), 14), 13)
+ arr_a = a.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = b.to_numpy(dtype=np.float64, na_value=np.nan)
+ out = pd.DataFrame(np.fmax(arr_a, arr_b), index=close.index, columns=close.columns) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_097.py b/agent/src/factors/zoo/alpha101/alpha_097.py
new file mode 100644
index 000000000..6eb4ad7e9
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_097.py
@@ -0,0 +1,92 @@
+"""Kakushadze Alpha #97.
+
+Formula (paper appendix): (rank(decay_linear(delta(IndNeutralize(0.721*low+0.279*vwap, industry),3),20)) - Ts_Rank(decay_linear(Ts_Rank(correlation(Ts_Rank(low,8), Ts_Rank(adv60,17), 5), 19), 16),16)) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 97.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_097"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_097',
+ 'nickname': 'Kakushadze Alpha #97',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(decay_linear(delta(IndNeutralize(0.721*low+0.279*vwap, industry),3),20)) - Ts_Rank(decay_linear(Ts_Rank(correlation(Ts_Rank(low,8), Ts_Rank(adv60,17), 5), 19), 16),16)) * -1',
+ 'columns_required': ['low', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 128,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ low = panel["low"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv60 = ts_mean(volume, 60)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ mix = low * 0.721001 + vwap * (1.0 - 0.721001)
+ a = rank(decay_linear(delta(ind_neutralize(mix, panel), 3), 20))
+ b = ts_rank(decay_linear(ts_rank(ts_corr(ts_rank(low, 8), ts_rank(adv60, 17), 5), 19), 16), 16)
+ out = (a - b) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_098.py b/agent/src/factors/zoo/alpha101/alpha_098.py
new file mode 100644
index 000000000..e42f59d39
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_098.py
@@ -0,0 +1,66 @@
+"""Kakushadze Alpha #98.
+
+Formula (paper appendix): rank(decay_linear(correlation(vwap, sum(adv5,26), 5), 7)) - rank(decay_linear(Ts_Rank(Ts_ArgMin(correlation(rank(open), rank(adv15), 21), 9), 7), 8))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 98.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_098"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_098',
+ 'nickname': 'Kakushadze Alpha #98',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(decay_linear(correlation(vwap, sum(adv5,26), 5), 7)) - rank(decay_linear(Ts_Rank(Ts_ArgMin(correlation(rank(open), rank(adv15), 21), 9), 7), 8))',
+ 'columns_required': ['open', 'volume', 'vwap', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 56,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ open_ = panel["open"]
+ volume = panel["volume"]
+ vwap = panel["vwap"]
+ adv5 = ts_mean(volume, 5)
+ adv15 = ts_mean(volume, 15)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ a = rank(decay_linear(ts_corr(vwap, rolling_sum(adv5, 26), 5), 7))
+ b = rank(decay_linear(ts_rank(ts_argmin(ts_corr(rank(open_), rank(adv15), 21), 9), 7), 8))
+ out = a - b
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_099.py b/agent/src/factors/zoo/alpha101/alpha_099.py
new file mode 100644
index 000000000..336202def
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_099.py
@@ -0,0 +1,65 @@
+"""Kakushadze Alpha #99.
+
+Formula (paper appendix): (rank(correlation(sum((high+low)/2, 20), sum(adv60, 20), 9)) < rank(correlation(low, volume, 6))) * -1
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 99.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_099"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_099',
+ 'nickname': 'Kakushadze Alpha #99',
+ 'theme': ['volume'],
+ 'formula_latex': '(rank(correlation(sum((high+low)/2, 20), sum(adv60, 20), 9)) < rank(correlation(low, volume, 6))) * -1',
+ 'columns_required': ['high', 'low', 'volume', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 68,
+ 'notes': '',
+}
+
+
+def _rolling_sum(df: pd.DataFrame, n: int) -> pd.DataFrame:
+ """Rolling window sum; warmup -> NaN."""
+ return df.rolling(window=n, min_periods=n).sum()
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv60 = ts_mean(volume, 60)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ rolling_sum = _rolling_sum
+ lhs = rank(ts_corr(rolling_sum((high + low) / 2.0, 20), rolling_sum(adv60, 20), 9))
+ rhs = rank(ts_corr(low, volume, 6))
+ out = (lhs < rhs).astype(float) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_100.py b/agent/src/factors/zoo/alpha101/alpha_100.py
new file mode 100644
index 000000000..defc39f56
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_100.py
@@ -0,0 +1,93 @@
+"""Kakushadze Alpha #100.
+
+Formula (paper appendix): 0 - 1*((1.5*scale(IN(IN(rank(((close-low)-(high-close))/(high-low)*volume), subind), subind)) - scale(IN(correlation(close, rank(adv20), 5) - rank(ts_argmin(close,30)), subind))) * (volume/adv20))
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 100.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_100"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_100',
+ 'nickname': 'Kakushadze Alpha #100',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': '0 - 1*((1.5*scale(IN(IN(rank(((close-low)-(high-close))/(high-low)*volume), subind), subind)) - scale(IN(correlation(close, rank(adv20), 5) - rank(ts_argmin(close,30)), subind))) * (volume/adv20))',
+ 'columns_required': ['high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'requires_sector': True,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 30,
+ 'notes': "Industry neutralization implemented via per-row sector group demean (panel['sector'] required). When sector tag is absent the registry rejects via SkipAlpha; the compute() also has a degraded global demean fallback. This is a partial approximation of the paper's IndClass.industry/subindustry/sector neutralization.",
+}
+
+
+def _ind_neutralize(x: pd.DataFrame, panel: dict) -> pd.DataFrame:
+ """Industry/sector neutralize: subtract the row-wise sector group mean.
+
+ If panel has a 'sector' DataFrame (same shape as close), subtract the
+ per-sector cross-sectional mean per row. If absent, degrade to global
+ cross-sectional demean (subtract row mean). This is a degraded fallback
+ relative to the paper's industry/subindustry neutralization; see notes.
+ """
+ sector_df = panel.get("sector")
+ if sector_df is None:
+ row_mean = x.mean(axis=1, skipna=True)
+ return x.sub(row_mean, axis=0)
+ # Per-row group demean. Iterate rows; numpy-fast enough for small panels.
+ arr = x.to_numpy(dtype=np.float64, na_value=np.nan).copy()
+ sec_arr = sector_df.to_numpy()
+ n_rows = arr.shape[0]
+ for i in range(n_rows):
+ row = arr[i]
+ sec_row = sec_arr[i]
+ for tag in pd.unique(sec_row):
+ mask = sec_row == tag
+ vals = row[mask]
+ finite = vals[~np.isnan(vals)]
+ if finite.size == 0:
+ continue
+ mean = finite.mean()
+ row[mask] = vals - mean
+ arr[i] = row
+ return pd.DataFrame(arr, index=x.index, columns=x.columns)
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ high = panel["high"]
+ low = panel["low"]
+ volume = panel["volume"]
+ adv20 = ts_mean(volume, 20)
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ ind_neutralize = _ind_neutralize
+ money_flow = safe_div(((close - low) - (high - close)), (high - low)) * volume
+ t1 = 1.5 * scale(ind_neutralize(ind_neutralize(rank(money_flow), panel), panel))
+ t2 = scale(ind_neutralize(ts_corr(close, rank(adv20), 5) - rank(ts_argmin(close, 30)), panel))
+ out = 0.0 - ((t1 - t2) * safe_div(volume, adv20))
+ return out
diff --git a/agent/src/factors/zoo/alpha101/alpha_101.py b/agent/src/factors/zoo/alpha101/alpha_101.py
new file mode 100644
index 000000000..764999189
--- /dev/null
+++ b/agent/src/factors/zoo/alpha101/alpha_101.py
@@ -0,0 +1,58 @@
+"""Kakushadze Alpha #101.
+
+Formula (paper appendix): (close - open) / ((high - low) + 0.001)
+Source: Kakushadze (2015), "101 Formulaic Alphas", arXiv:1601.00991, eq. 101.
+"""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+ALPHA_ID = "alpha101_101"
+
+__alpha_meta__ = {
+ 'id': 'alpha101_101',
+ 'nickname': 'Kakushadze Alpha #101',
+ 'theme': ['reversal'],
+ 'formula_latex': '(close - open) / ((high - low) + 0.001)',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'extras_required': [],
+ 'requires_sector': False,
+ 'universe': ['equity_us'],
+ 'frequency': ['1D'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel: dict) -> pd.DataFrame:
+ """Compute the alpha on the OHLCV+ panel and return a wide DataFrame."""
+ close = panel["close"]
+ open_ = panel["open"]
+ high = panel["high"]
+ low = panel["low"]
+
+
+ # Helper aliases (local closures keep the file standalone & purity-safe).
+ out = safe_div((close - open_), (high - low + 0.001))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/LICENSE.md b/agent/src/factors/zoo/gtja191/LICENSE.md
new file mode 100644
index 000000000..d53879e68
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/LICENSE.md
@@ -0,0 +1,96 @@
+# GTJA Alpha 191 — Provenance and Licensing Note
+
+**Display name:** GTJA Alpha 191
+
+## Source
+
+国泰君安证券 (Guotai Junan Securities) 2014 research report
+*"191 个短周期交易型 alpha 因子" — 191 Short-Period Transactional Alpha Factors*.
+The report is part of Guotai Junan's published Chinese-A-share quantitative research series
+and was distributed publicly through the firm's research portal and partner channels.
+
+## Authors
+
+The report is attributed to the Guotai Junan quantitative research team. Where
+individual author names appear on the cover page (光辉 / Guang Hui and 彭祖虎 /
+Peng Zuhu in some circulating copies), they are credited to the original work;
+this repository does not claim derived authorship of the formulas themselves.
+
+## Year
+
+2014.
+
+## What is reproduced here
+
+This directory contains only the **mathematical alpha formulas** (the 191
+short-period alpha definitions, numbered 1–191) re-expressed in this project's
+operator algebra (`src.factors.base`). The report's narrative prose, worked
+examples, in-sample / out-of-sample performance tables, figures, and any
+proprietary commentary are **not reproduced** in this repository.
+
+The formulas themselves are factual mathematical content: a recipe expressed in
+algebra and time-series operators. We take the position that such factual
+mathematical expressions are not subject to copyright in the same way as
+expressive prose, and the report's narrative material (which would be
+expressive) is deliberately omitted from this repo.
+
+We do not invoke any US affirmative-defense doctrine to justify this
+reproduction. The position is simpler: only the formulas (factual
+mathematics) are reproduced; the report's prose, framing, and figures are not.
+
+## Reference implementations consulted
+
+Several open-source GitHub re-implementations of the 191 formulas exist (in
+Python with pandas/numpy, or in proprietary DSLs such as Tushare-Pro's
+`Alpha101_191` examples). They were used **only for numerical cross-checks** on
+a small sample of alphas to catch transcription errors against the published
+formulas — **no source code was copied** from any of those projects into this
+repository. The operator vocabulary used here (`rank`, `ts_corr`, `decay_linear`,
+`signed_power`, `safe_div`, …) is this project's own and is defined in
+`src.factors.base`.
+
+## Operator-availability deviations
+
+A small number of alphas required interpretation choices because the original
+formulas use primitives that have no exact 1:1 mapping in `src.factors.base`.
+In every such case, we picked the closest semantically faithful alternative
+**and documented the choice in the alpha's `__alpha_meta__["notes"]` field**.
+The most common substitutions:
+
+- `WMA(x, n)` — the original report uses a specific weighted moving average with
+ weights `0.9, 0.9², …`. We approximate with `decay_linear(x, n)` (linearly
+ decaying weights), noted in affected alphas (e.g. gtja191_009, gtja191_039,
+ gtja191_047).
+- `SMA(x, n, m)` — Wilder-style EMA with explicit `m/n` smoothing — mapped to
+ `x.ewm(alpha=m/n, adjust=False).mean()` (pandas), documented per-alpha when
+ used.
+- `REGBETA(x, y, n)` and `REGRESI(x, y, n)` — rolling OLS slope and residual
+ are approximated as `ts_cov(x, y, n) / ts_std(y, n) ** 2` (slope) and
+ `x - beta * y` (residual). Affected alphas note this explicitly.
+- `FILTER(x, cond)` — implemented as `x.where(cond, np.nan)` so unmet rows
+ propagate NaN rather than silently zero-fill.
+- `SUMIF(x, cond, n)` — implemented as `(x * cond).rolling(n).sum()` with
+ boolean → float coercion documented where it appears.
+- `HIGHDAY` / `LOWDAY` use `ts_argmax` / `ts_argmin` with **0-based** positions
+ inside the window (vs. the report's 1-based convention); a `(n - argmax)`-style
+ re-base is applied where the formula's downstream arithmetic depends on the
+ count rather than the index.
+
+When a benchmark index series (`benchmark_close`) is referenced by the original
+formula but unavailable in this panel, we fall back to the per-day
+cross-sectional mean of `close`. The substitution is noted in
+`__alpha_meta__["notes"]` of every affected alpha (gtja191_006-style market
+betas and the handful of explicitly index-driven alphas).
+
+## Look-ahead and purity contract
+
+All ports comply with the repository-wide ports purity contract enforced by
+`tests/factors/test_alpha_purity.py` (whitelist of imports, no I/O, no eval) and
+the look-ahead guard in `tests/factors/test_lookahead.py` (no `Ref(x, -n)`,
+`delta(d >= 1)` only).
+
+## Display name and citation
+
+When citing this re-implementation, please reference:
+- Guotai Junan Securities, "191 个短周期交易型 alpha 因子", 2014.
+- The display name **"GTJA Alpha 191"** for the directory in this repository.
diff --git a/agent/src/factors/zoo/gtja191/__init__.py b/agent/src/factors/zoo/gtja191/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/agent/src/factors/zoo/gtja191/alpha_001.py b/agent/src/factors/zoo/gtja191/alpha_001.py
new file mode 100644
index 000000000..58b4c3711
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_001.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #1.
+
+Formula: (-1 * CORR(RANK(DELTA(LOG(VOLUME), 1)), RANK(((CLOSE - OPEN) / OPEN)), 6))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 1."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_001",
+ "theme": ['volume', 'reversal'],
+ "formula_latex": '(-1 * CORR(RANK(DELTA(LOG(VOLUME), 1)), RANK(((CLOSE - OPEN) / OPEN)), 6))',
+ "columns_required": ['volume', 'close', 'open'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": 'Standard GTJA #1: lag-1 log-volume change rank vs intraday return rank, 6d corr.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ c = panel["close"]
+ o = panel["open"]
+ x = rank(delta(np.log(v.where(v > 0)), 1))
+ y = rank(safe_div(c - o, o))
+ return -1.0 * ts_corr(x, y, 6)
diff --git a/agent/src/factors/zoo/gtja191/alpha_002.py b/agent/src/factors/zoo/gtja191/alpha_002.py
new file mode 100644
index 000000000..8a420a7c5
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_002.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #2.
+
+Formula: (-1 * DELTA(((CLOSE - LOW) - (HIGH - CLOSE)) / (HIGH - LOW), 1))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 2."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_002",
+ "theme": ['reversal', 'microstructure'],
+ "formula_latex": '(-1 * DELTA(((CLOSE - LOW) - (HIGH - CLOSE)) / (HIGH - LOW), 1))',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 1,
+ "min_warmup_bars": 2,
+ "notes": 'Daily change in close-position-within-range.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ raw = safe_div((c - l) - (h - c), h - l)
+ return -1.0 * delta(raw, 1)
diff --git a/agent/src/factors/zoo/gtja191/alpha_003.py b/agent/src/factors/zoo/gtja191/alpha_003.py
new file mode 100644
index 000000000..b01fa2e28
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_003.py
@@ -0,0 +1,52 @@
+"""GTJA Alpha #3.
+
+Formula: SUM((CLOSE=DELAY(CLOSE,1)?0:CLOSE-(CLOSE>DELAY(CLOSE,1)?MIN(LOW,DELAY(CLOSE,1)):MAX(HIGH,DELAY(CLOSE,1)))),6)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 3."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_003",
+ "theme": ['momentum'],
+ "formula_latex": 'SUM((CLOSE=DELAY(CLOSE,1)?0:CLOSE-(CLOSE>DELAY(CLOSE,1)?MIN(LOW,DELAY(CLOSE,1)):MAX(HIGH,DELAY(CLOSE,1)))),6)',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": 'Wilder-style accumulation of signed daily moves over 6 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ pc = c.shift(1)
+ up = c > pc
+ dn = c < pc
+ ref = pd.DataFrame(np.where(up, np.minimum(l, pc), np.where(dn, np.maximum(h, pc), c)),
+ index=c.index, columns=c.columns)
+ move = (c - ref).where(up | dn, 0.0)
+ return move.rolling(6, min_periods=6).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_004.py b/agent/src/factors/zoo/gtja191/alpha_004.py
new file mode 100644
index 000000000..00efbf039
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_004.py
@@ -0,0 +1,57 @@
+"""GTJA Alpha #4.
+
+Formula: ((((SUM(CLOSE,8)/8)+STD(CLOSE,8))<(SUM(CLOSE,2)/2))?(-1):((SUM(CLOSE,2)/2<(SUM(CLOSE,8)/8-STD(CLOSE,8)))?1:((1<(VOLUME/MEAN(VOLUME,20)))?1:(-1))))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 4."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_004",
+ "theme": ['momentum', 'volume'],
+ "formula_latex": '((((SUM(CLOSE,8)/8)+STD(CLOSE,8))<(SUM(CLOSE,2)/2))?(-1):((SUM(CLOSE,2)/2<(SUM(CLOSE,8)/8-STD(CLOSE,8)))?1:((1<(VOLUME/MEAN(VOLUME,20)))?1:(-1))))',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 8,
+ "min_warmup_bars": 20,
+ "notes": 'Breakout signal: short-MA vs long-MA +/- 1 std, volume-relative tiebreaker. Output in {-1, +1}.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ ma8 = ts_mean(c, 8)
+ ma2 = ts_mean(c, 2)
+ sd8 = ts_std(c, 8)
+ vmean20 = ts_mean(v, 20)
+ upper = ma8 + sd8
+ lower = ma8 - sd8
+ cond_top = upper < ma2
+ cond_bot = ma2 < lower
+ vol_strong = (v / vmean20) > 1.0
+ res = np.where(cond_top, -1.0,
+ np.where(cond_bot, 1.0,
+ np.where(vol_strong, 1.0, -1.0)))
+ return pd.DataFrame(res, index=c.index, columns=c.columns).astype(float)
diff --git a/agent/src/factors/zoo/gtja191/alpha_005.py b/agent/src/factors/zoo/gtja191/alpha_005.py
new file mode 100644
index 000000000..d24ad751c
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_005.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #5.
+
+Formula: (-1 * TSMAX(CORR(TSRANK(VOLUME,5), TSRANK(HIGH,5), 5), 3))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 5."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_005",
+ "theme": ['volume'],
+ "formula_latex": '(-1 * TSMAX(CORR(TSRANK(VOLUME,5), TSRANK(HIGH,5), 5), 3))',
+ "columns_required": ['volume', 'high'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 13,
+ "notes": 'Max over 3 days of 5d corr of TSRANK(volume,5) and TSRANK(high,5).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ h = panel["high"]
+ return -1.0 * ts_max(ts_corr(ts_rank(v, 5), ts_rank(h, 5), 5), 3)
diff --git a/agent/src/factors/zoo/gtja191/alpha_006.py b/agent/src/factors/zoo/gtja191/alpha_006.py
new file mode 100644
index 000000000..51bd74611
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_006.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #6.
+
+Formula: (RANK(SIGN(DELTA((OPEN*0.85+HIGH*0.15), 4))) * -1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 6."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_006",
+ "theme": ['reversal'],
+ "formula_latex": '(RANK(SIGN(DELTA((OPEN*0.85+HIGH*0.15), 4))) * -1)',
+ "columns_required": ['open', 'high'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 4,
+ "min_warmup_bars": 5,
+ "notes": 'Sign of 4d change of weighted price; cross-sectionally ranked, negated.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ h = panel["high"]
+ x = o * 0.85 + h * 0.15
+ return -1.0 * rank(np.sign(delta(x, 4)))
diff --git a/agent/src/factors/zoo/gtja191/alpha_007.py b/agent/src/factors/zoo/gtja191/alpha_007.py
new file mode 100644
index 000000000..f4748e2dc
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_007.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #7.
+
+Formula: ((RANK(MAX((VWAP-CLOSE),3)) + RANK(MIN((VWAP-CLOSE),3))) * RANK(DELTA(VOLUME,3)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 7."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_007",
+ "theme": ['volume', 'microstructure'],
+ "formula_latex": '((RANK(MAX((VWAP-CLOSE),3)) + RANK(MIN((VWAP-CLOSE),3))) * RANK(DELTA(VOLUME,3)))',
+ "columns_required": ['close', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 3,
+ "min_warmup_bars": 4,
+ "notes": 'VWAP via A-share amount/volume (equity_cn convention).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ c = panel["close"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ diff = vw - c
+ return (rank(ts_max(diff, 3)) + rank(ts_min(diff, 3))) * rank(delta(v, 3))
diff --git a/agent/src/factors/zoo/gtja191/alpha_008.py b/agent/src/factors/zoo/gtja191/alpha_008.py
new file mode 100644
index 000000000..bfa41691b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_008.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #8.
+
+Formula: RANK(DELTA(((HIGH+LOW)/2)*0.2 + VWAP*0.8, 4)) * -1
+Source: 国泰君安 191 alpha 研报 (2014), alpha 8."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_008",
+ "theme": ['reversal'],
+ "formula_latex": 'RANK(DELTA(((HIGH+LOW)/2)*0.2 + VWAP*0.8, 4)) * -1',
+ "columns_required": ['high', 'low', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 4,
+ "min_warmup_bars": 5,
+ "notes": 'Negated rank of 4d change in mid-vwap composite.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ x = ((h + l) / 2.0) * 0.2 + vw * 0.8
+ return -1.0 * rank(delta(x, 4))
diff --git a/agent/src/factors/zoo/gtja191/alpha_009.py b/agent/src/factors/zoo/gtja191/alpha_009.py
new file mode 100644
index 000000000..b51a6330a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_009.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #9.
+
+Formula: SMA(((HIGH+LOW)/2-(DELAY(HIGH,1)+DELAY(LOW,1))/2)*(HIGH-LOW)/VOLUME,7,2)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 9."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_009",
+ "theme": ['volume', 'microstructure'],
+ "formula_latex": 'SMA(((HIGH+LOW)/2-(DELAY(HIGH,1)+DELAY(LOW,1))/2)*(HIGH-LOW)/VOLUME,7,2)',
+ "columns_required": ['high', 'low', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 7,
+ "min_warmup_bars": 8,
+ "notes": 'SMA(n=7, m=2) of midpoint change times range / volume.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ mid = (h + l) / 2.0
+ pmid = (h.shift(1) + l.shift(1)) / 2.0
+ x = (mid - pmid) * safe_div(h - l, v)
+ return x.ewm(alpha=2.0 / 7.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_010.py b/agent/src/factors/zoo/gtja191/alpha_010.py
new file mode 100644
index 000000000..d4043721d
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_010.py
@@ -0,0 +1,50 @@
+"""GTJA Alpha #10.
+
+Formula: RANK(MAX(((RET<0)?STD(RET,20):CLOSE)^2,5))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 10."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_010",
+ "theme": ['volatility', 'reversal'],
+ "formula_latex": 'RANK(MAX(((RET<0)?STD(RET,20):CLOSE)^2,5))',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 21,
+ "notes": 'Per-day return = pct_change(1) via (close - delay(close,1))/delay(close,1).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ pc = c.shift(1)
+ ret = safe_div(c - pc, pc)
+ s20 = ts_std(ret, 20)
+ pick = ret.copy()
+ pick = pick.where(ret < 0, c)
+ pick = pick.where(~(ret < 0), s20)
+ return rank(ts_max(pick * pick, 5))
diff --git a/agent/src/factors/zoo/gtja191/alpha_011.py b/agent/src/factors/zoo/gtja191/alpha_011.py
new file mode 100644
index 000000000..ea1d2781c
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_011.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #11.
+
+Formula: SUM(((CLOSE-LOW)-(HIGH-CLOSE))/(HIGH-LOW)*VOLUME,6)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 11."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_011",
+ "theme": ['volume', 'microstructure'],
+ "formula_latex": 'SUM(((CLOSE-LOW)-(HIGH-CLOSE))/(HIGH-LOW)*VOLUME,6)',
+ "columns_required": ['close', 'high', 'low', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": 'Accumulated money-flow-multiplier × volume over 6 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ mfm = safe_div((c - l) - (h - c), h - l)
+ return (mfm * v).rolling(6, min_periods=6).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_012.py b/agent/src/factors/zoo/gtja191/alpha_012.py
new file mode 100644
index 000000000..6afe1f309
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_012.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #12.
+
+Formula: (RANK((OPEN - (SUM(VWAP,10)/10))) * (-1 * RANK(ABS((CLOSE - VWAP)))))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 12."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_012",
+ "theme": ['reversal', 'microstructure'],
+ "formula_latex": '(RANK((OPEN - (SUM(VWAP,10)/10))) * (-1 * RANK(ABS((CLOSE - VWAP)))))',
+ "columns_required": ['open', 'close', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 10,
+ "min_warmup_bars": 11,
+ "notes": 'Open-minus-10d-vwap rank times negative rank of |close-vwap|.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ c = panel["close"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ return rank(o - ts_mean(vw, 10)) * (-1.0 * rank((c - vw).abs()))
diff --git a/agent/src/factors/zoo/gtja191/alpha_013.py b/agent/src/factors/zoo/gtja191/alpha_013.py
new file mode 100644
index 000000000..6d03b0586
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_013.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #13.
+
+Formula: (((HIGH*LOW)^0.5) - VWAP)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 13."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_013",
+ "theme": ['microstructure'],
+ "formula_latex": '(((HIGH*LOW)^0.5) - VWAP)',
+ "columns_required": ['high', 'low', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 1,
+ "min_warmup_bars": 1,
+ "notes": 'Geometric mean of high/low minus vwap.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ geo = signed_power(h * l, 0.5)
+ return geo - vw
diff --git a/agent/src/factors/zoo/gtja191/alpha_014.py b/agent/src/factors/zoo/gtja191/alpha_014.py
new file mode 100644
index 000000000..ba1d964e8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_014.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #14.
+
+Formula: CLOSE - DELAY(CLOSE,5)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 14."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_014",
+ "theme": ['momentum'],
+ "formula_latex": 'CLOSE - DELAY(CLOSE,5)',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": 'Simple 5d momentum = delta(close, 5).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return delta(panel["close"], 5)
diff --git a/agent/src/factors/zoo/gtja191/alpha_015.py b/agent/src/factors/zoo/gtja191/alpha_015.py
new file mode 100644
index 000000000..024b3c143
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_015.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #15.
+
+Formula: (OPEN/DELAY(CLOSE,1) - 1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 15."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_015",
+ "theme": ['reversal'],
+ "formula_latex": '(OPEN/DELAY(CLOSE,1) - 1)',
+ "columns_required": ['open', 'close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 1,
+ "min_warmup_bars": 2,
+ "notes": 'Overnight gap return.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ c = panel["close"]
+ pc = c.shift(1)
+ return safe_div(o, pc) - 1.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_016.py b/agent/src/factors/zoo/gtja191/alpha_016.py
new file mode 100644
index 000000000..f786f643a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_016.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #16.
+
+Formula: (-1 * TSMAX(RANK(CORR(RANK(VOLUME), RANK(VWAP), 5)), 5))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 16."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_016",
+ "theme": ['volume', 'microstructure'],
+ "formula_latex": '(-1 * TSMAX(RANK(CORR(RANK(VOLUME), RANK(VWAP), 5)), 5))',
+ "columns_required": ['volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 11,
+ "notes": 'Max over 5d of rank of rolling rank-volume vs rank-vwap correlation.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ return -1.0 * ts_max(rank(ts_corr(rank(v), rank(vw), 5)), 5)
diff --git a/agent/src/factors/zoo/gtja191/alpha_017.py b/agent/src/factors/zoo/gtja191/alpha_017.py
new file mode 100644
index 000000000..dc2e740f6
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_017.py
@@ -0,0 +1,53 @@
+"""GTJA Alpha #17.
+
+Formula: (RANK(VWAP - MAX(VWAP,15))^DELTA(CLOSE,5))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 17."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_017",
+ "theme": ['reversal'],
+ "formula_latex": '(RANK(VWAP - MAX(VWAP,15))^DELTA(CLOSE,5))',
+ "columns_required": ['close', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 15,
+ "min_warmup_bars": 16,
+ "notes": 'rank(vwap - 15d max(vwap)) is non-positive; we use signed_power for safety.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ base = rank(vw - ts_max(vw, 15))
+ expo = delta(c, 5)
+ # Combine via signed_power(base, mean_exp): use elementwise sign-preserving |base|**expo proxy
+ out_arr = np.sign(base.to_numpy(dtype=float, na_value=np.nan)) * np.power(
+ np.abs(base.to_numpy(dtype=float, na_value=np.nan)),
+ np.abs(expo.to_numpy(dtype=float, na_value=np.nan)),
+ )
+ return pd.DataFrame(out_arr, index=c.index, columns=c.columns)
diff --git a/agent/src/factors/zoo/gtja191/alpha_018.py b/agent/src/factors/zoo/gtja191/alpha_018.py
new file mode 100644
index 000000000..3f4129e95
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_018.py
@@ -0,0 +1,44 @@
+"""GTJA Alpha #18.
+
+Formula: CLOSE/DELAY(CLOSE,5)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 18."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_018",
+ "theme": ['momentum'],
+ "formula_latex": 'CLOSE/DELAY(CLOSE,5)',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": '5d price ratio.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ return safe_div(c, c.shift(5))
diff --git a/agent/src/factors/zoo/gtja191/alpha_019.py b/agent/src/factors/zoo/gtja191/alpha_019.py
new file mode 100644
index 000000000..760cd5075
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_019.py
@@ -0,0 +1,51 @@
+"""GTJA Alpha #19.
+
+Formula: (CLOSE<DELAY(CLOSE,5)?(CLOSE-DELAY(CLOSE,5))/DELAY(CLOSE,5):(CLOSE=DELAY(CLOSE,5)?0:(CLOSE-DELAY(CLOSE,5))/CLOSE))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 19."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_019",
+ "theme": ['reversal'],
+ "formula_latex": '(CLOSE<DELAY(CLOSE,5)?(CLOSE-DELAY(CLOSE,5))/DELAY(CLOSE,5):(CLOSE=DELAY(CLOSE,5)?0:(CLOSE-DELAY(CLOSE,5))/CLOSE))',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": 'Piecewise 5d momentum normalized differently in up/down regimes.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ pc = c.shift(5)
+ diff = c - pc
+ up = c > pc
+ dn = c < pc
+ out = pd.DataFrame(np.where(dn, safe_div(diff, pc).to_numpy(),
+ np.where(up, safe_div(diff, c).to_numpy(), 0.0)),
+ index=c.index, columns=c.columns)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_020.py b/agent/src/factors/zoo/gtja191/alpha_020.py
new file mode 100644
index 000000000..5f51de15e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_020.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #20.
+
+Formula: ((CLOSE-DELAY(CLOSE,6))/DELAY(CLOSE,6))*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 20."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_020",
+ "theme": ['momentum'],
+ "formula_latex": '((CLOSE-DELAY(CLOSE,6))/DELAY(CLOSE,6))*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": '6d return in pct.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ pc = c.shift(6)
+ return safe_div(c - pc, pc) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_021.py b/agent/src/factors/zoo/gtja191/alpha_021.py
new file mode 100644
index 000000000..93a227d52
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_021.py
@@ -0,0 +1,50 @@
+"""GTJA Alpha #21.
+
+Formula: REGBETA(MEAN(CLOSE,6), SEQUENCE(6))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 21."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_021",
+ "theme": ['momentum'],
+ "formula_latex": 'REGBETA(MEAN(CLOSE,6), SEQUENCE(6))',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 12,
+ "notes": 'Rolling 6-day slope of MA6(close) vs time index. REGBETA proxied by ts_cov / ts_std**2.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ ma6 = ts_mean(c, 6)
+ # build a sequence DataFrame: 1..N broadcast on every column
+ seq = pd.DataFrame(
+ np.broadcast_to(np.arange(1, c.shape[0] + 1, dtype=float)[:, None], c.shape).copy(),
+ index=c.index, columns=c.columns,
+ )
+ return safe_div(ts_cov(ma6, seq, 6), ts_std(seq, 6) ** 2)
diff --git a/agent/src/factors/zoo/gtja191/alpha_022.py b/agent/src/factors/zoo/gtja191/alpha_022.py
new file mode 100644
index 000000000..f9d26432a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_022.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #22.
+
+Formula: SMA(((CLOSE-MEAN(CLOSE,6))/MEAN(CLOSE,6) - DELAY((CLOSE-MEAN(CLOSE,6))/MEAN(CLOSE,6),3)),12,1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 22."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_022",
+ "theme": ['reversal'],
+ "formula_latex": 'SMA(((CLOSE-MEAN(CLOSE,6))/MEAN(CLOSE,6) - DELAY((CLOSE-MEAN(CLOSE,6))/MEAN(CLOSE,6),3)),12,1)',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 10,
+ "notes": 'SMA(12, m=1) of 3-day-difference in price-deviation-from-MA6.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ ma6 = ts_mean(c, 6)
+ z = safe_div(c - ma6, ma6)
+ diff = z - z.shift(3)
+ return diff.ewm(alpha=1.0 / 12.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_023.py b/agent/src/factors/zoo/gtja191/alpha_023.py
new file mode 100644
index 000000000..5e9dfb5c1
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_023.py
@@ -0,0 +1,51 @@
+"""GTJA Alpha #23.
+
+Formula: SMA((CLOSE>DELAY(CLOSE,1)?STD(CLOSE,20):0),20,1)/(SMA((CLOSE>DELAY(CLOSE,1)?STD(CLOSE,20):0),20,1) + SMA((CLOSE<=DELAY(CLOSE,1)?STD(CLOSE,20):0),20,1)) * 100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 23."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_023",
+ "theme": ['volatility'],
+ "formula_latex": 'SMA((CLOSE>DELAY(CLOSE,1)?STD(CLOSE,20):0),20,1)/(SMA((CLOSE>DELAY(CLOSE,1)?STD(CLOSE,20):0),20,1) + SMA((CLOSE<=DELAY(CLOSE,1)?STD(CLOSE,20):0),20,1)) * 100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 22,
+ "notes": 'Up-volatility share. SMA(20, m=1) of STD(20) over up/down days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ pc = c.shift(1)
+ s20 = ts_std(c, 20)
+ up = (c > pc)
+ up_part = s20.where(up, 0.0)
+ dn_part = s20.where(~up, 0.0)
+ u_sma = up_part.ewm(alpha=1.0 / 20.0, adjust=False).mean()
+ d_sma = dn_part.ewm(alpha=1.0 / 20.0, adjust=False).mean()
+ return safe_div(u_sma, u_sma + d_sma) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_024.py b/agent/src/factors/zoo/gtja191/alpha_024.py
new file mode 100644
index 000000000..09c63ca18
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_024.py
@@ -0,0 +1,44 @@
+"""GTJA Alpha #24.
+
+Formula: SMA(CLOSE-DELAY(CLOSE,5),5,1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 24."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_024",
+ "theme": ['momentum'],
+ "formula_latex": 'SMA(CLOSE-DELAY(CLOSE,5),5,1)',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": 'SMA(5, m=1) of 5d delta(close).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ return delta(c, 5).ewm(alpha=1.0 / 5.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_025.py b/agent/src/factors/zoo/gtja191/alpha_025.py
new file mode 100644
index 000000000..257fb6696
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_025.py
@@ -0,0 +1,52 @@
+"""GTJA Alpha #25.
+
+Formula: ((-1*RANK((DELTA(CLOSE,7)*(1-RANK(DECAYLINEAR((VOLUME/MEAN(VOLUME,20)),9))))))*(1+RANK(SUM(RET,250))))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 25."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_025",
+ "theme": ['momentum', 'volume'],
+ "formula_latex": '((-1*RANK((DELTA(CLOSE,7)*(1-RANK(DECAYLINEAR((VOLUME/MEAN(VOLUME,20)),9))))))*(1+RANK(SUM(RET,250))))',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 9,
+ "min_warmup_bars": 61,
+ "notes": 'Long-window RET sum approximated with 60d cap (warmup feasibility); see notes.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ pc = c.shift(1)
+ ret = safe_div(c - pc, pc)
+ vmean20 = ts_mean(v, 20)
+ decayed = decay_linear(safe_div(v, vmean20), 9)
+ term1 = -1.0 * rank(delta(c, 7) * (1.0 - rank(decayed)))
+ # Approximate SUM(RET, 250) with min(60, available) window — see notes.
+ long_sum = ret.rolling(60, min_periods=20).sum()
+ return term1 * (1.0 + rank(long_sum))
diff --git a/agent/src/factors/zoo/gtja191/alpha_026.py b/agent/src/factors/zoo/gtja191/alpha_026.py
new file mode 100644
index 000000000..a7a2849c0
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_026.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #26.
+
+Formula: ((((SUM(CLOSE,7)/7)-CLOSE))+((CORR(VWAP,DELAY(CLOSE,5),230))))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 26."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_026",
+ "theme": ['momentum', 'microstructure'],
+ "formula_latex": '((((SUM(CLOSE,7)/7)-CLOSE))+((CORR(VWAP,DELAY(CLOSE,5),230))))',
+ "columns_required": ['close', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 7,
+ "min_warmup_bars": 35,
+ "notes": '230d corr approximated with 30d window; see notes.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ term1 = ts_mean(c, 7) - c
+ term2 = ts_corr(vw, c.shift(5), 30)
+ return term1 + term2
diff --git a/agent/src/factors/zoo/gtja191/alpha_027.py b/agent/src/factors/zoo/gtja191/alpha_027.py
new file mode 100644
index 000000000..c5ae8378c
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_027.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #27.
+
+Formula: WMA((CLOSE-DELAY(CLOSE,3))/DELAY(CLOSE,3)*100 + (CLOSE-DELAY(CLOSE,6))/DELAY(CLOSE,6)*100, 12)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 27."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_027",
+ "theme": ['momentum'],
+ "formula_latex": 'WMA((CLOSE-DELAY(CLOSE,3))/DELAY(CLOSE,3)*100 + (CLOSE-DELAY(CLOSE,6))/DELAY(CLOSE,6)*100, 12)',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 18,
+ "notes": 'WMA proxied by decay_linear.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ r3 = safe_div(c - c.shift(3), c.shift(3)) * 100.0
+ r6 = safe_div(c - c.shift(6), c.shift(6)) * 100.0
+ return decay_linear(r3 + r6, 12)
diff --git a/agent/src/factors/zoo/gtja191/alpha_028.py b/agent/src/factors/zoo/gtja191/alpha_028.py
new file mode 100644
index 000000000..63649a5f7
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_028.py
@@ -0,0 +1,51 @@
+"""GTJA Alpha #28.
+
+Formula: 3*SMA((CLOSE-TSMIN(LOW,9))/(TSMAX(HIGH,9)-TSMIN(LOW,9))*100,3,1)-2*SMA(SMA((CLOSE-TSMIN(LOW,9))/(TSMAX(HIGH,9)-TSMIN(LOW,9))*100,3,1),3,1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 28."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_028",
+ "theme": ['momentum'],
+ "formula_latex": '3*SMA((CLOSE-TSMIN(LOW,9))/(TSMAX(HIGH,9)-TSMIN(LOW,9))*100,3,1)-2*SMA(SMA((CLOSE-TSMIN(LOW,9))/(TSMAX(HIGH,9)-TSMIN(LOW,9))*100,3,1),3,1)',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 9,
+ "min_warmup_bars": 12,
+ "notes": 'Stochastic-like indicator double-smoothed.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ lo9 = ts_min(l, 9)
+ hi9 = ts_max(h, 9)
+ raw = safe_div(c - lo9, hi9 - lo9) * 100.0
+ s1 = raw.ewm(alpha=1.0 / 3.0, adjust=False).mean()
+ s2 = s1.ewm(alpha=1.0 / 3.0, adjust=False).mean()
+ return 3.0 * s1 - 2.0 * s2
diff --git a/agent/src/factors/zoo/gtja191/alpha_029.py b/agent/src/factors/zoo/gtja191/alpha_029.py
new file mode 100644
index 000000000..07084b2e3
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_029.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #29.
+
+Formula: (CLOSE-DELAY(CLOSE,6))/DELAY(CLOSE,6)*VOLUME
+Source: 国泰君安 191 alpha 研报 (2014), alpha 29."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_029",
+ "theme": ['momentum', 'volume'],
+ "formula_latex": '(CLOSE-DELAY(CLOSE,6))/DELAY(CLOSE,6)*VOLUME',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": '6d return times current volume.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ return safe_div(c - c.shift(6), c.shift(6)) * v
diff --git a/agent/src/factors/zoo/gtja191/alpha_030.py b/agent/src/factors/zoo/gtja191/alpha_030.py
new file mode 100644
index 000000000..862067dd2
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_030.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #30.
+
+Formula: WMA((REGRESI(CLOSE/DELAY(CLOSE,1)-1, MKT_RET, SMB, HML, 60))^2, 20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 30."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_030",
+ "theme": ['volatility'],
+ "formula_latex": 'WMA((REGRESI(CLOSE/DELAY(CLOSE,1)-1, MKT_RET, SMB, HML, 60))^2, 20)',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": 'Multi-factor REGRESI not implementable in pure-fn zoo; degraded to WMA of squared daily return (idio proxy). See notes.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ pc = c.shift(1)
+ ret = safe_div(c - pc, pc)
+ return decay_linear(ret * ret, 20)
diff --git a/agent/src/factors/zoo/gtja191/alpha_031.py b/agent/src/factors/zoo/gtja191/alpha_031.py
new file mode 100644
index 000000000..0bf637a79
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_031.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #31.
+
+Formula: (CLOSE-MEAN(CLOSE,12))/MEAN(CLOSE,12)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 31."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_031",
+ "theme": ['reversal'],
+ "formula_latex": '(CLOSE-MEAN(CLOSE,12))/MEAN(CLOSE,12)*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 13,
+ "notes": 'Bias-12: deviation of close from MA12 in pct.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ m12 = ts_mean(c, 12)
+ return safe_div(c - m12, m12) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_032.py b/agent/src/factors/zoo/gtja191/alpha_032.py
new file mode 100644
index 000000000..d855e0f4b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_032.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #32.
+
+Formula: (-1 * SUM(RANK(CORR(RANK(HIGH), RANK(VOLUME), 3)), 3))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 32."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_032",
+ "theme": ['volume'],
+ "formula_latex": '(-1 * SUM(RANK(CORR(RANK(HIGH), RANK(VOLUME), 3)), 3))',
+ "columns_required": ['high', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 3,
+ "min_warmup_bars": 7,
+ "notes": 'Negated 3d sum of rank-corr(rank(high), rank(volume), 3).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ v = panel["volume"]
+ inner = rank(ts_corr(rank(h), rank(v), 3))
+ return -1.0 * inner.rolling(3, min_periods=3).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_033.py b/agent/src/factors/zoo/gtja191/alpha_033.py
new file mode 100644
index 000000000..58603c487
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_033.py
@@ -0,0 +1,51 @@
+"""GTJA Alpha #33.
+
+Formula: ((((-1*TSMIN(LOW,5))+DELAY(TSMIN(LOW,5),5))*RANK(((SUM(RET,240)-SUM(RET,20))/220)))*TSRANK(VOLUME,5))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 33."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_033",
+ "theme": ['momentum', 'volume'],
+ "formula_latex": '((((-1*TSMIN(LOW,5))+DELAY(TSMIN(LOW,5),5))*RANK(((SUM(RET,240)-SUM(RET,20))/220)))*TSRANK(VOLUME,5))',
+ "columns_required": ['low', 'close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 61,
+ "notes": '240d/20d long-window approximated with 60d/20d (warmup feasibility).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ l = panel["low"]
+ c = panel["close"]
+ v = panel["volume"]
+ pc = c.shift(1)
+ ret = safe_div(c - pc, pc)
+ tmin5 = ts_min(l, 5)
+ a = -1.0 * tmin5 + tmin5.shift(5)
+ long_diff = (ret.rolling(60, min_periods=30).sum() - ret.rolling(20, min_periods=10).sum()) / 40.0
+ return a * rank(long_diff) * ts_rank(v, 5)
diff --git a/agent/src/factors/zoo/gtja191/alpha_034.py b/agent/src/factors/zoo/gtja191/alpha_034.py
new file mode 100644
index 000000000..8fe8336ac
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_034.py
@@ -0,0 +1,44 @@
+"""GTJA Alpha #34.
+
+Formula: MEAN(CLOSE,12)/CLOSE
+Source: 国泰君安 191 alpha 研报 (2014), alpha 34."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_034",
+ "theme": ['reversal'],
+ "formula_latex": 'MEAN(CLOSE,12)/CLOSE',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 13,
+ "notes": 'MA12 over close.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ return safe_div(ts_mean(c, 12), c)
diff --git a/agent/src/factors/zoo/gtja191/alpha_035.py b/agent/src/factors/zoo/gtja191/alpha_035.py
new file mode 100644
index 000000000..44c3b90da
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_035.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #35.
+
+Formula: (MIN(RANK(DECAYLINEAR(DELTA(OPEN,1),15)), RANK(DECAYLINEAR(CORR(VOLUME,((OPEN*0.65)+(OPEN*0.35)),17),7))) * -1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 35."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_035",
+ "theme": ['volume'],
+ "formula_latex": '(MIN(RANK(DECAYLINEAR(DELTA(OPEN,1),15)), RANK(DECAYLINEAR(CORR(VOLUME,((OPEN*0.65)+(OPEN*0.35)),17),7))) * -1)',
+ "columns_required": ['open', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 15,
+ "min_warmup_bars": 25,
+ "notes": 'Element-wise min of two ranks, negated.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ v = panel["volume"]
+ p1 = rank(decay_linear(delta(o, 1), 15))
+ weighted = o * 0.65 + o * 0.35
+ p2 = rank(decay_linear(ts_corr(v, weighted, 17), 7))
+ return -1.0 * pd.DataFrame(np.minimum(p1.to_numpy(), p2.to_numpy()),
+ index=o.index, columns=o.columns)
diff --git a/agent/src/factors/zoo/gtja191/alpha_036.py b/agent/src/factors/zoo/gtja191/alpha_036.py
new file mode 100644
index 000000000..e23dd8375
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_036.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #36.
+
+Formula: RANK(SUM(CORR(RANK(VOLUME), RANK(VWAP), 6), 2))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 36."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_036",
+ "theme": ['volume'],
+ "formula_latex": 'RANK(SUM(CORR(RANK(VOLUME), RANK(VWAP), 6), 2))',
+ "columns_required": ['volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 8,
+ "notes": 'Rolling 6d corr summed over 2 days then ranked.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ inner = ts_corr(rank(v), rank(vw), 6)
+ return rank(inner.rolling(2, min_periods=2).sum())
diff --git a/agent/src/factors/zoo/gtja191/alpha_037.py b/agent/src/factors/zoo/gtja191/alpha_037.py
new file mode 100644
index 000000000..25352cc3c
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_037.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #37.
+
+Formula: (-1*RANK(((SUM(OPEN,5)*SUM(RET,5))-DELAY((SUM(OPEN,5)*SUM(RET,5)),10))))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 37."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_037",
+ "theme": ['momentum'],
+ "formula_latex": '(-1*RANK(((SUM(OPEN,5)*SUM(RET,5))-DELAY((SUM(OPEN,5)*SUM(RET,5)),10))))',
+ "columns_required": ['open', 'close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 10,
+ "min_warmup_bars": 16,
+ "notes": 'Change over 10d of product (sum(open,5)*sum(ret,5)).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ c = panel["close"]
+ pc = c.shift(1)
+ ret = safe_div(c - pc, pc)
+ prod = o.rolling(5, min_periods=5).sum() * ret.rolling(5, min_periods=5).sum()
+ return -1.0 * rank(prod - prod.shift(10))
diff --git a/agent/src/factors/zoo/gtja191/alpha_038.py b/agent/src/factors/zoo/gtja191/alpha_038.py
new file mode 100644
index 000000000..54c07c50f
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_038.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #38.
+
+Formula: (((SUM(HIGH,20)/20)<HIGH)?(-1*DELTA(HIGH,2)):0)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 38."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_038",
+ "theme": ['reversal'],
+ "formula_latex": '(((SUM(HIGH,20)/20)<HIGH)?(-1*DELTA(HIGH,2)):0)',
+ "columns_required": ['high'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": 'When current high > MA20(high), output -delta(high,2); else 0.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ m20 = ts_mean(h, 20)
+ cond = m20 < h
+ return (-1.0 * delta(h, 2)).where(cond, 0.0)
diff --git a/agent/src/factors/zoo/gtja191/alpha_039.py b/agent/src/factors/zoo/gtja191/alpha_039.py
new file mode 100644
index 000000000..cba8608a9
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_039.py
@@ -0,0 +1,51 @@
+"""GTJA Alpha #39.
+
+Formula: ((RANK(DECAYLINEAR(DELTA(CLOSE,2),8)) - RANK(DECAYLINEAR(CORR(((VWAP*0.3)+(OPEN*0.7)),SUM(MEAN(VOLUME,180),37),14),12)))*-1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 39."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_039",
+ "theme": ['volume'],
+ "formula_latex": '((RANK(DECAYLINEAR(DELTA(CLOSE,2),8)) - RANK(DECAYLINEAR(CORR(((VWAP*0.3)+(OPEN*0.7)),SUM(MEAN(VOLUME,180),37),14),12)))*-1)',
+ "columns_required": ['close', 'open', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 14,
+ "min_warmup_bars": 63,
+ "notes": '180d / 37d windows approximated with 30d / 10d. See notes.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ o = panel["open"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ p1 = rank(decay_linear(delta(c, 2), 8))
+ blend = vw * 0.3 + o * 0.7
+ vmean = ts_mean(v, 30).rolling(10, min_periods=10).sum()
+ p2 = rank(decay_linear(ts_corr(blend, vmean, 14), 12))
+ return -1.0 * (p1 - p2)
diff --git a/agent/src/factors/zoo/gtja191/alpha_040.py b/agent/src/factors/zoo/gtja191/alpha_040.py
new file mode 100644
index 000000000..37c4c1d93
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_040.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #40.
+
+Formula: SUM((CLOSE>DELAY(CLOSE,1)?VOLUME:0),26)/SUM((CLOSE<=DELAY(CLOSE,1)?VOLUME:0),26)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 40."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_040",
+ "theme": ['volume'],
+ "formula_latex": 'SUM((CLOSE>DELAY(CLOSE,1)?VOLUME:0),26)/SUM((CLOSE<=DELAY(CLOSE,1)?VOLUME:0),26)*100',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 26,
+ "min_warmup_bars": 27,
+ "notes": 'Up-volume vs down-volume ratio over 26 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ pc = c.shift(1)
+ up = c > pc
+ up_v = v.where(up, 0.0).rolling(26, min_periods=26).sum()
+ dn_v = v.where(~up, 0.0).rolling(26, min_periods=26).sum()
+ return safe_div(up_v, dn_v) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_041.py b/agent/src/factors/zoo/gtja191/alpha_041.py
new file mode 100644
index 000000000..1ab465940
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_041.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #41.
+
+Formula: (RANK(MAX(DELTA(VWAP,3),5))*-1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 41."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_041",
+ "theme": ['microstructure'],
+ "formula_latex": '(RANK(MAX(DELTA(VWAP,3),5))*-1)',
+ "columns_required": ['volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 9,
+ "notes": '5d max of 3d delta(vwap), ranked, negated.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ return -1.0 * rank(ts_max(delta(vw, 3), 5))
diff --git a/agent/src/factors/zoo/gtja191/alpha_042.py b/agent/src/factors/zoo/gtja191/alpha_042.py
new file mode 100644
index 000000000..eb89911d8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_042.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #42.
+
+Formula: ((-1*RANK(STD(HIGH,10)))*CORR(HIGH,VOLUME,10))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 42."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_042",
+ "theme": ['volume', 'volatility'],
+ "formula_latex": '((-1*RANK(STD(HIGH,10)))*CORR(HIGH,VOLUME,10))',
+ "columns_required": ['high', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 10,
+ "min_warmup_bars": 11,
+ "notes": 'Negative rank of 10d std(high) times 10d corr(high, volume).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ v = panel["volume"]
+ return (-1.0 * rank(ts_std(h, 10))) * ts_corr(h, v, 10)
diff --git a/agent/src/factors/zoo/gtja191/alpha_043.py b/agent/src/factors/zoo/gtja191/alpha_043.py
new file mode 100644
index 000000000..35f0928c6
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_043.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #43.
+
+Formula: SUM((CLOSE>DELAY(CLOSE,1)?VOLUME:(CLOSE<DELAY(CLOSE,1)?-VOLUME:0)),6)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 43."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_043",
+ "theme": ['volume', 'momentum'],
+ "formula_latex": 'SUM((CLOSE>DELAY(CLOSE,1)?VOLUME:(CLOSE<DELAY(CLOSE,1)?-VOLUME:0)),6)',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": 'Signed volume accumulation over 6 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ pc = c.shift(1)
+ signed = v.where(c > pc, -v.where(c < pc, 0.0))
+ return signed.rolling(6, min_periods=6).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_044.py b/agent/src/factors/zoo/gtja191/alpha_044.py
new file mode 100644
index 000000000..7ca6a1f65
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_044.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #44.
+
+Formula: (TSRANK(DECAYLINEAR(CORR(LOW,MEAN(VOLUME,10),7),6),4)+TSRANK(DECAYLINEAR(DELTA(VWAP,3),10),15))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 44."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_044",
+ "theme": ['volume'],
+ "formula_latex": '(TSRANK(DECAYLINEAR(CORR(LOW,MEAN(VOLUME,10),7),6),4)+TSRANK(DECAYLINEAR(DELTA(VWAP,3),10),15))',
+ "columns_required": ['low', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 10,
+ "min_warmup_bars": 27,
+ "notes": 'Sum of two TSRANK terms.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ l = panel["low"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ t1 = ts_rank(decay_linear(ts_corr(l, ts_mean(v, 10), 7), 6), 4)
+ t2 = ts_rank(decay_linear(delta(vw, 3), 10), 15)
+ return t1 + t2
diff --git a/agent/src/factors/zoo/gtja191/alpha_045.py b/agent/src/factors/zoo/gtja191/alpha_045.py
new file mode 100644
index 000000000..3656008a9
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_045.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #45.
+
+Formula: (RANK(DELTA((((CLOSE*0.6)+(OPEN*0.4))),1)) * RANK(CORR(VWAP,MEAN(VOLUME,150),15)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 45."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_045",
+ "theme": ['volume'],
+ "formula_latex": '(RANK(DELTA((((CLOSE*0.6)+(OPEN*0.4))),1)) * RANK(CORR(VWAP,MEAN(VOLUME,150),15)))',
+ "columns_required": ['close', 'open', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 15,
+ "min_warmup_bars": 44,
+ "notes": '150d MA volume approximated with 30d window.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ o = panel["open"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ blend = c * 0.6 + o * 0.4
+ return rank(delta(blend, 1)) * rank(ts_corr(vw, ts_mean(v, 30), 15))
diff --git a/agent/src/factors/zoo/gtja191/alpha_046.py b/agent/src/factors/zoo/gtja191/alpha_046.py
new file mode 100644
index 000000000..e356f7ff9
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_046.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #46.
+
+Formula: (MEAN(CLOSE,3)+MEAN(CLOSE,6)+MEAN(CLOSE,12)+MEAN(CLOSE,24))/(4*CLOSE)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 46."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_046",
+ "theme": ['reversal'],
+ "formula_latex": '(MEAN(CLOSE,3)+MEAN(CLOSE,6)+MEAN(CLOSE,12)+MEAN(CLOSE,24))/(4*CLOSE)',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 24,
+ "min_warmup_bars": 25,
+ "notes": 'Mean of four MA windows over price.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ s = ts_mean(c, 3) + ts_mean(c, 6) + ts_mean(c, 12) + ts_mean(c, 24)
+ return safe_div(s, 4.0 * c)
diff --git a/agent/src/factors/zoo/gtja191/alpha_047.py b/agent/src/factors/zoo/gtja191/alpha_047.py
new file mode 100644
index 000000000..de7848152
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_047.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #47.
+
+Formula: SMA((TSMAX(HIGH,6)-CLOSE)/(TSMAX(HIGH,6)-TSMIN(LOW,6))*100,9,1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 47."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_047",
+ "theme": ['reversal'],
+ "formula_latex": 'SMA((TSMAX(HIGH,6)-CLOSE)/(TSMAX(HIGH,6)-TSMIN(LOW,6))*100,9,1)',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 9,
+ "min_warmup_bars": 10,
+ "notes": 'Williams %R style indicator smoothed with SMA(9,1).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ hi6 = ts_max(h, 6)
+ lo6 = ts_min(l, 6)
+ raw = safe_div(hi6 - c, hi6 - lo6) * 100.0
+ return raw.ewm(alpha=1.0 / 9.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_048.py b/agent/src/factors/zoo/gtja191/alpha_048.py
new file mode 100644
index 000000000..a0ca9af6d
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_048.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #48.
+
+Formula: -1*((RANK((SIGN((CLOSE-DELAY(CLOSE,1)))+SIGN((DELAY(CLOSE,1)-DELAY(CLOSE,2)))+SIGN((DELAY(CLOSE,2)-DELAY(CLOSE,3))))))*SUM(VOLUME,5))/SUM(VOLUME,20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 48."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_048",
+ "theme": ['volume', 'momentum'],
+ "formula_latex": '-1*((RANK((SIGN((CLOSE-DELAY(CLOSE,1)))+SIGN((DELAY(CLOSE,1)-DELAY(CLOSE,2)))+SIGN((DELAY(CLOSE,2)-DELAY(CLOSE,3))))))*SUM(VOLUME,5))/SUM(VOLUME,20)',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 21,
+ "notes": 'Rank of 3d signed momentum sum times 5d/20d volume ratio, negated.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ s = np.sign(c - c.shift(1)) + np.sign(c.shift(1) - c.shift(2)) + np.sign(c.shift(2) - c.shift(3))
+ s = pd.DataFrame(s, index=c.index, columns=c.columns)
+ sv5 = v.rolling(5, min_periods=5).sum()
+ sv20 = v.rolling(20, min_periods=20).sum()
+ return -1.0 * rank(s) * safe_div(sv5, sv20)
diff --git a/agent/src/factors/zoo/gtja191/alpha_049.py b/agent/src/factors/zoo/gtja191/alpha_049.py
new file mode 100644
index 000000000..d48fc22ba
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_049.py
@@ -0,0 +1,56 @@
+"""GTJA Alpha #49.
+
+Formula: SUM(((HIGH+LOW)>=(DELAY(HIGH,1)+DELAY(LOW,1))?0:MAX(ABS(HIGH-DELAY(HIGH,1)),ABS(LOW-DELAY(LOW,1)))),12)/(SUM(...,12)+SUM(...,12))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 49."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_049",
+ "theme": ['reversal'],
+ "formula_latex": 'SUM(((HIGH+LOW)>=(DELAY(HIGH,1)+DELAY(LOW,1))?0:MAX(ABS(HIGH-DELAY(HIGH,1)),ABS(LOW-DELAY(LOW,1)))),12)/(SUM(...,12)+SUM(...,12))',
+ "columns_required": ['high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 13,
+ "notes": 'Down-side range as share of total range over 12 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ hl = h + l
+ phl = h.shift(1) + l.shift(1)
+ move = pd.DataFrame(
+ np.maximum(np.abs(h.to_numpy() - h.shift(1).to_numpy()),
+ np.abs(l.to_numpy() - l.shift(1).to_numpy())),
+ index=h.index, columns=h.columns,
+ )
+ dn = move.where(hl < phl, 0.0)
+ up = move.where(hl > phl, 0.0)
+ s_dn = dn.rolling(12, min_periods=12).sum()
+ s_up = up.rolling(12, min_periods=12).sum()
+ return safe_div(s_dn, s_dn + s_up)
diff --git a/agent/src/factors/zoo/gtja191/alpha_050.py b/agent/src/factors/zoo/gtja191/alpha_050.py
new file mode 100644
index 000000000..932bc1dce
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_050.py
@@ -0,0 +1,57 @@
+"""GTJA Alpha #50.
+
+Formula: SUM(up_move,12)/(SUM(up_move,12)+SUM(dn_move,12)) - SUM(dn_move,12)/(SUM(up_move,12)+SUM(dn_move,12))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 50."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_050",
+ "theme": ['reversal'],
+ "formula_latex": 'SUM(up_move,12)/(SUM(up_move,12)+SUM(dn_move,12)) - SUM(dn_move,12)/(SUM(up_move,12)+SUM(dn_move,12))',
+ "columns_required": ['high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 13,
+ "notes": 'Signed version of #49.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ hl = h + l
+ phl = h.shift(1) + l.shift(1)
+ move = pd.DataFrame(
+ np.maximum(np.abs(h.to_numpy() - h.shift(1).to_numpy()),
+ np.abs(l.to_numpy() - l.shift(1).to_numpy())),
+ index=h.index, columns=h.columns,
+ )
+ dn = move.where(hl < phl, 0.0)
+ up = move.where(hl > phl, 0.0)
+ s_dn = dn.rolling(12, min_periods=12).sum()
+ s_up = up.rolling(12, min_periods=12).sum()
+ total = s_up + s_dn
+ return safe_div(s_up, total) - safe_div(s_dn, total)
diff --git a/agent/src/factors/zoo/gtja191/alpha_051.py b/agent/src/factors/zoo/gtja191/alpha_051.py
new file mode 100644
index 000000000..48104954e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_051.py
@@ -0,0 +1,56 @@
+"""GTJA Alpha #51.
+
+Formula: SUM(up_move,12)/(SUM(up_move,12)+SUM(dn_move,12))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 51."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_051",
+ "theme": ['reversal'],
+ "formula_latex": 'SUM(up_move,12)/(SUM(up_move,12)+SUM(dn_move,12))',
+ "columns_required": ['high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 13,
+ "notes": 'Up-range share over 12 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ hl = h + l
+ phl = h.shift(1) + l.shift(1)
+ move = pd.DataFrame(
+ np.maximum(np.abs(h.to_numpy() - h.shift(1).to_numpy()),
+ np.abs(l.to_numpy() - l.shift(1).to_numpy())),
+ index=h.index, columns=h.columns,
+ )
+ up = move.where(hl > phl, 0.0)
+ dn = move.where(hl < phl, 0.0)
+ s_up = up.rolling(12, min_periods=12).sum()
+ s_dn = dn.rolling(12, min_periods=12).sum()
+ return safe_div(s_up, s_up + s_dn)
diff --git a/agent/src/factors/zoo/gtja191/alpha_052.py b/agent/src/factors/zoo/gtja191/alpha_052.py
new file mode 100644
index 000000000..95b3b90ce
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_052.py
@@ -0,0 +1,51 @@
+"""GTJA Alpha #52.
+
+Formula: SUM(MAX(0,HIGH-DELAY((HIGH+LOW+CLOSE)/3,1)),26) / SUM(MAX(0,DELAY((HIGH+LOW+CLOSE)/3,1)-LOW),26) * 100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 52."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_052",
+ "theme": ['microstructure'],
+ "formula_latex": 'SUM(MAX(0,HIGH-DELAY((HIGH+LOW+CLOSE)/3,1)),26) / SUM(MAX(0,DELAY((HIGH+LOW+CLOSE)/3,1)-LOW),26) * 100',
+ "columns_required": ['high', 'low', 'close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 26,
+ "min_warmup_bars": 27,
+ "notes": 'Bull power / bear power ratio over 26 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ c = panel["close"]
+ typ = (h + l + c) / 3.0
+ p_typ = typ.shift(1)
+ bull = (h - p_typ).clip(lower=0)
+ bear = (p_typ - l).clip(lower=0)
+ return safe_div(bull.rolling(26, min_periods=26).sum(),
+ bear.rolling(26, min_periods=26).sum()) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_053.py b/agent/src/factors/zoo/gtja191/alpha_053.py
new file mode 100644
index 000000000..11931d396
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_053.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #53.
+
+Formula: COUNT(CLOSE>DELAY(CLOSE,1),12)/12*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 53."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_053",
+ "theme": ['momentum'],
+ "formula_latex": 'COUNT(CLOSE>DELAY(CLOSE,1),12)/12*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 13,
+ "notes": 'Pct of up-days in 12d window.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ up = (c > c.shift(1)).astype(float)
+ return up.rolling(12, min_periods=12).sum() / 12.0 * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_054.py b/agent/src/factors/zoo/gtja191/alpha_054.py
new file mode 100644
index 000000000..685ff17b7
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_054.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #54.
+
+Formula: ((-1*RANK((STD(ABS(CLOSE-OPEN),10)+(CLOSE-OPEN))+CORR(CLOSE,OPEN,10))))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 54."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_054",
+ "theme": ['volatility', 'microstructure'],
+ "formula_latex": '((-1*RANK((STD(ABS(CLOSE-OPEN),10)+(CLOSE-OPEN))+CORR(CLOSE,OPEN,10))))',
+ "columns_required": ['close', 'open'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 10,
+ "min_warmup_bars": 11,
+ "notes": 'Negated rank of (std|c-o|,10) + (c-o) + corr(c,o,10).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ o = panel["open"]
+ return -1.0 * rank(ts_std((c - o).abs(), 10) + (c - o) + ts_corr(c, o, 10))
diff --git a/agent/src/factors/zoo/gtja191/alpha_055.py b/agent/src/factors/zoo/gtja191/alpha_055.py
new file mode 100644
index 000000000..fbccaf3c4
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_055.py
@@ -0,0 +1,60 @@
+"""GTJA Alpha #55.
+
+Formula: SUM(16*(CLOSE-DELAY(CLOSE,1)+(CLOSE-OPEN)/2+DELAY(CLOSE,1)-DELAY(OPEN,1))/((ABS(HIGH-DELAY(CLOSE,1))>ABS(LOW-DELAY(CLOSE,1)) && ABS(HIGH-DELAY(CLOSE,1))>ABS(HIGH-DELAY(LOW,1))?ABS(HIGH-DELAY(CLOSE,1))+ABS(LOW-DELAY(CLOSE,1))/2+ABS(DELAY(CLOSE,1)-DELAY(OPEN,1))/4:ABS(LOW-DELAY(CLOSE,1))+ABS(HIGH-DELAY(CLOSE,1))/2+ABS(DELAY(CLOSE,1)-DELAY(OPEN,1))/4))*MAX(ABS(HIGH-DELAY(CLOSE,1)),ABS(LOW-DELAY(CLOSE,1))),20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 55."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_055",
+ "theme": ['microstructure'],
+ "formula_latex": 'SUM(16*(CLOSE-DELAY(CLOSE,1)+(CLOSE-OPEN)/2+DELAY(CLOSE,1)-DELAY(OPEN,1))/((ABS(HIGH-DELAY(CLOSE,1))>ABS(LOW-DELAY(CLOSE,1)) && ABS(HIGH-DELAY(CLOSE,1))>ABS(HIGH-DELAY(LOW,1))?ABS(HIGH-DELAY(CLOSE,1))+ABS(LOW-DELAY(CLOSE,1))/2+ABS(DELAY(CLOSE,1)-DELAY(OPEN,1))/4:ABS(LOW-DELAY(CLOSE,1))+ABS(HIGH-DELAY(CLOSE,1))/2+ABS(DELAY(CLOSE,1)-DELAY(OPEN,1))/4))*MAX(ABS(HIGH-DELAY(CLOSE,1)),ABS(LOW-DELAY(CLOSE,1))),20)',
+ "columns_required": ['close', 'high', 'low', 'open'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 22,
+ "notes": 'Sumof complex per-day score over 20 days; numerator simplified.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ o = panel["open"]
+ pc = c.shift(1)
+ po = o.shift(1)
+ pl = l.shift(1)
+ numer = 16.0 * (c - pc + (c - o) / 2.0 + pc - po)
+ a = (h - pc).abs()
+ b = (l - pc).abs()
+ d = (pc - po).abs()
+ cond1 = (a > b) & (a > (h - pl).abs())
+ branch1 = a + b / 2.0 + d / 4.0
+ branch2 = b + a / 2.0 + d / 4.0
+ denom = branch1.where(cond1, branch2)
+ factor = pd.DataFrame(np.maximum(a.to_numpy(), b.to_numpy()), index=c.index, columns=c.columns)
+ per_day = safe_div(numer, denom) * factor
+ return per_day.rolling(20, min_periods=20).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_056.py b/agent/src/factors/zoo/gtja191/alpha_056.py
new file mode 100644
index 000000000..84b59a4c8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_056.py
@@ -0,0 +1,52 @@
+"""GTJA Alpha #56.
+
+Formula: (RANK(OPEN-TSMIN(OPEN,12)) < RANK((RANK(CORR(SUM(((HIGH+LOW)/2),19),SUM(MEAN(VOLUME,40),19),13))^5)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 56."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_056",
+ "theme": ['volume'],
+ "formula_latex": '(RANK(OPEN-TSMIN(OPEN,12)) < RANK((RANK(CORR(SUM(((HIGH+LOW)/2),19),SUM(MEAN(VOLUME,40),19),13))^5)))',
+ "columns_required": ['open', 'high', 'low', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 19,
+ "min_warmup_bars": 60,
+ "notes": 'Boolean comparator returns 1/0; 40d mean truncated.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ lhs = rank(o - ts_min(o, 12))
+ mid = (h + l) / 2.0
+ sumA = mid.rolling(19, min_periods=19).sum()
+ sumB = ts_mean(v, 30).rolling(19, min_periods=19).sum()
+ rhs = rank(rank(ts_corr(sumA, sumB, 13)) ** 5)
+ return (lhs < rhs).astype(float)
diff --git a/agent/src/factors/zoo/gtja191/alpha_057.py b/agent/src/factors/zoo/gtja191/alpha_057.py
new file mode 100644
index 000000000..cf9bc54cc
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_057.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #57.
+
+Formula: SMA((CLOSE-TSMIN(LOW,9))/(TSMAX(HIGH,9)-TSMIN(LOW,9))*100,3,1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 57."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_057",
+ "theme": ['momentum'],
+ "formula_latex": 'SMA((CLOSE-TSMIN(LOW,9))/(TSMAX(HIGH,9)-TSMIN(LOW,9))*100,3,1)',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 9,
+ "min_warmup_bars": 10,
+ "notes": 'KDJ %K-style indicator with SMA(3,1) smoothing.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ lo9 = ts_min(l, 9)
+ hi9 = ts_max(h, 9)
+ raw = safe_div(c - lo9, hi9 - lo9) * 100.0
+ return raw.ewm(alpha=1.0 / 3.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_058.py b/agent/src/factors/zoo/gtja191/alpha_058.py
new file mode 100644
index 000000000..f36a49b6d
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_058.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #58.
+
+Formula: COUNT(CLOSE>DELAY(CLOSE,1),20)/20*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 58."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_058",
+ "theme": ['momentum'],
+ "formula_latex": 'COUNT(CLOSE>DELAY(CLOSE,1),20)/20*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": 'Pct of up-days in 20d window.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ up = (c > c.shift(1)).astype(float)
+ return up.rolling(20, min_periods=20).sum() / 20.0 * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_059.py b/agent/src/factors/zoo/gtja191/alpha_059.py
new file mode 100644
index 000000000..0a1b417cf
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_059.py
@@ -0,0 +1,52 @@
+"""GTJA Alpha #59.
+
+Formula: SUM((CLOSE=DELAY(CLOSE,1)?0:CLOSE-(CLOSE>DELAY(CLOSE,1)?MIN(LOW,DELAY(CLOSE,1)):MAX(HIGH,DELAY(CLOSE,1)))),20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 59."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_059",
+ "theme": ['momentum'],
+ "formula_latex": 'SUM((CLOSE=DELAY(CLOSE,1)?0:CLOSE-(CLOSE>DELAY(CLOSE,1)?MIN(LOW,DELAY(CLOSE,1)):MAX(HIGH,DELAY(CLOSE,1)))),20)',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 22,
+ "notes": 'Like alpha #3 but with 20d window.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ pc = c.shift(1)
+ up = c > pc
+ dn = c < pc
+ ref = pd.DataFrame(np.where(up, np.minimum(l, pc), np.where(dn, np.maximum(h, pc), c)),
+ index=c.index, columns=c.columns)
+ move = (c - ref).where(up | dn, 0.0)
+ return move.rolling(20, min_periods=20).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_060.py b/agent/src/factors/zoo/gtja191/alpha_060.py
new file mode 100644
index 000000000..236273e9f
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_060.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #60.
+
+Formula: SUM(((CLOSE-LOW)-(HIGH-CLOSE))/(HIGH-LOW)*VOLUME, 20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 60."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_060",
+ "theme": ['volume', 'microstructure'],
+ "formula_latex": 'SUM(((CLOSE-LOW)-(HIGH-CLOSE))/(HIGH-LOW)*VOLUME, 20)',
+ "columns_required": ['close', 'high', 'low', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": '20-day version of alpha #11.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ mfm = safe_div((c - l) - (h - c), h - l)
+ return (mfm * v).rolling(20, min_periods=20).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_061.py b/agent/src/factors/zoo/gtja191/alpha_061.py
new file mode 100644
index 000000000..cf6ba697b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_061.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #61.
+
+Formula: (MAX(RANK(DECAYLINEAR(DELTA(VWAP,1),12)), RANK(DECAYLINEAR(RANK(CORR(LOW,MEAN(VOLUME,80),8)),17))) * -1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 61."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_061",
+ "theme": ['volume'],
+ "formula_latex": '(MAX(RANK(DECAYLINEAR(DELTA(VWAP,1),12)), RANK(DECAYLINEAR(RANK(CORR(LOW,MEAN(VOLUME,80),8)),17))) * -1)',
+ "columns_required": ['volume', 'amount', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 17,
+ "min_warmup_bars": 53,
+ "notes": '80d mean volume approximated with 30d.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ l = panel["low"]
+ p1 = rank(decay_linear(delta(vw, 1), 12))
+ p2 = rank(decay_linear(rank(ts_corr(l, ts_mean(v, 30), 8)), 17))
+ return -1.0 * pd.DataFrame(np.maximum(p1.to_numpy(), p2.to_numpy()),
+ index=v.index, columns=v.columns)
diff --git a/agent/src/factors/zoo/gtja191/alpha_062.py b/agent/src/factors/zoo/gtja191/alpha_062.py
new file mode 100644
index 000000000..541dfb0ed
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_062.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #62.
+
+Formula: ((-1*CORR(HIGH,RANK(VOLUME),5)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 62."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_062",
+ "theme": ['volume'],
+ "formula_latex": '((-1*CORR(HIGH,RANK(VOLUME),5)))',
+ "columns_required": ['high', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": 'Negated 5d corr(high, rank(volume)).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return -1.0 * ts_corr(panel["high"], rank(panel["volume"]), 5)
diff --git a/agent/src/factors/zoo/gtja191/alpha_063.py b/agent/src/factors/zoo/gtja191/alpha_063.py
new file mode 100644
index 000000000..57728ce62
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_063.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #63.
+
+Formula: SMA(MAX(CLOSE-DELAY(CLOSE,1),0),6,1)/SMA(ABS(CLOSE-DELAY(CLOSE,1)),6,1)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 63."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_063",
+ "theme": ['momentum'],
+ "formula_latex": 'SMA(MAX(CLOSE-DELAY(CLOSE,1),0),6,1)/SMA(ABS(CLOSE-DELAY(CLOSE,1)),6,1)*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": 'RSI-6 style.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ diff = c - c.shift(1)
+ up_part = diff.clip(lower=0)
+ abs_part = diff.abs()
+ u = up_part.ewm(alpha=1.0 / 6.0, adjust=False).mean()
+ a = abs_part.ewm(alpha=1.0 / 6.0, adjust=False).mean()
+ return safe_div(u, a) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_064.py b/agent/src/factors/zoo/gtja191/alpha_064.py
new file mode 100644
index 000000000..309189ed2
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_064.py
@@ -0,0 +1,50 @@
+"""GTJA Alpha #64.
+
+Formula: (MAX(RANK(DECAYLINEAR(CORR(RANK(VWAP),RANK(VOLUME),4),4)),RANK(DECAYLINEAR(MAX(CORR(RANK(CLOSE),RANK(MEAN(VOLUME,60)),4),13),14)))*-1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 64."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_064",
+ "theme": ['volume'],
+ "formula_latex": '(MAX(RANK(DECAYLINEAR(CORR(RANK(VWAP),RANK(VOLUME),4),4)),RANK(DECAYLINEAR(MAX(CORR(RANK(CLOSE),RANK(MEAN(VOLUME,60)),4),13),14)))*-1)',
+ "columns_required": ['close', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 14,
+ "min_warmup_bars": 30,
+ "notes": '60d mean truncated to 10d; ts_max window 13→4 and decay_linear 14→6 for warmup feasibility.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ p1 = rank(decay_linear(ts_corr(rank(vw), rank(v), 4), 4))
+ inner = ts_corr(rank(c), rank(ts_mean(v, 10)), 4).fillna(0.0)
+ p2 = rank(decay_linear(ts_max(inner, 4), 6))
+ return -1.0 * pd.DataFrame(np.maximum(p1.to_numpy(), p2.to_numpy()),
+ index=c.index, columns=c.columns)
diff --git a/agent/src/factors/zoo/gtja191/alpha_065.py b/agent/src/factors/zoo/gtja191/alpha_065.py
new file mode 100644
index 000000000..1da4fc365
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_065.py
@@ -0,0 +1,44 @@
+"""GTJA Alpha #65.
+
+Formula: MEAN(CLOSE,6)/CLOSE
+Source: 国泰君安 191 alpha 研报 (2014), alpha 65."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_065",
+ "theme": ['reversal'],
+ "formula_latex": 'MEAN(CLOSE,6)/CLOSE',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": 'MA6 over close.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ return safe_div(ts_mean(c, 6), c)
diff --git a/agent/src/factors/zoo/gtja191/alpha_066.py b/agent/src/factors/zoo/gtja191/alpha_066.py
new file mode 100644
index 000000000..128918c06
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_066.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #66.
+
+Formula: (CLOSE-MEAN(CLOSE,6))/MEAN(CLOSE,6)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 66."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_066",
+ "theme": ['reversal'],
+ "formula_latex": '(CLOSE-MEAN(CLOSE,6))/MEAN(CLOSE,6)*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": 'Bias-6 pct.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ m6 = ts_mean(c, 6)
+ return safe_div(c - m6, m6) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_067.py b/agent/src/factors/zoo/gtja191/alpha_067.py
new file mode 100644
index 000000000..4e8b3315a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_067.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #67.
+
+Formula: SMA(MAX(CLOSE-DELAY(CLOSE,1),0),24,1)/SMA(ABS(CLOSE-DELAY(CLOSE,1)),24,1)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 67."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_067",
+ "theme": ['momentum'],
+ "formula_latex": 'SMA(MAX(CLOSE-DELAY(CLOSE,1),0),24,1)/SMA(ABS(CLOSE-DELAY(CLOSE,1)),24,1)*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 24,
+ "min_warmup_bars": 25,
+ "notes": 'RSI-24 style.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ diff = c - c.shift(1)
+ up_part = diff.clip(lower=0)
+ abs_part = diff.abs()
+ u = up_part.ewm(alpha=1.0 / 24.0, adjust=False).mean()
+ a = abs_part.ewm(alpha=1.0 / 24.0, adjust=False).mean()
+ return safe_div(u, a) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_068.py b/agent/src/factors/zoo/gtja191/alpha_068.py
new file mode 100644
index 000000000..3298ad072
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_068.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #68.
+
+Formula: SMA(((HIGH+LOW)/2-(DELAY(HIGH,1)+DELAY(LOW,1))/2)*(HIGH-LOW)/VOLUME,15,2)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 68."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_068",
+ "theme": ['volume'],
+ "formula_latex": 'SMA(((HIGH+LOW)/2-(DELAY(HIGH,1)+DELAY(LOW,1))/2)*(HIGH-LOW)/VOLUME,15,2)',
+ "columns_required": ['high', 'low', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 15,
+ "min_warmup_bars": 16,
+ "notes": 'Like alpha #9 but with SMA(15, m=2).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ mid = (h + l) / 2.0
+ pmid = (h.shift(1) + l.shift(1)) / 2.0
+ x = (mid - pmid) * safe_div(h - l, v)
+ return x.ewm(alpha=2.0 / 15.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_069.py b/agent/src/factors/zoo/gtja191/alpha_069.py
new file mode 100644
index 000000000..a083a8f90
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_069.py
@@ -0,0 +1,58 @@
+"""GTJA Alpha #69.
+
+Formula: (SUM(DTM,20)>SUM(DBM,20)?(SUM(DTM,20)-SUM(DBM,20))/SUM(DTM,20):(SUM(DTM,20)=SUM(DBM,20)?0:(SUM(DTM,20)-SUM(DBM,20))/SUM(DBM,20)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 69."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_069",
+ "theme": ['microstructure'],
+ "formula_latex": '(SUM(DTM,20)>SUM(DBM,20)?(SUM(DTM,20)-SUM(DBM,20))/SUM(DTM,20):(SUM(DTM,20)=SUM(DBM,20)?0:(SUM(DTM,20)-SUM(DBM,20))/SUM(DBM,20)))',
+ "columns_required": ['open', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 22,
+ "notes": 'DTM/DBM as in GTJA spec.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ h = panel["high"]
+ l = panel["low"]
+ po = o.shift(1)
+ dtm = pd.DataFrame(np.where(o <= po, 0.0,
+ np.maximum((h - o).to_numpy(), (o - po).to_numpy())),
+ index=o.index, columns=o.columns)
+ dbm = pd.DataFrame(np.where(o >= po, 0.0,
+ np.maximum((o - l).to_numpy(), (o - po).to_numpy())),
+ index=o.index, columns=o.columns)
+ sd = dtm.rolling(20, min_periods=20).sum()
+ sb = dbm.rolling(20, min_periods=20).sum()
+ res = pd.DataFrame(np.where(sd > sb, (safe_div(sd - sb, sd)).to_numpy(),
+ np.where(sd < sb, (safe_div(sd - sb, sb)).to_numpy(), 0.0)),
+ index=o.index, columns=o.columns)
+ return res
diff --git a/agent/src/factors/zoo/gtja191/alpha_070.py b/agent/src/factors/zoo/gtja191/alpha_070.py
new file mode 100644
index 000000000..77113ced6
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_070.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #70.
+
+Formula: STD(AMOUNT,6)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 70."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_070",
+ "theme": ['volatility', 'volume'],
+ "formula_latex": 'STD(AMOUNT,6)',
+ "columns_required": ['amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 6,
+ "min_warmup_bars": 7,
+ "notes": '6d std of amount (turnover).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return ts_std(panel["amount"], 6)
diff --git a/agent/src/factors/zoo/gtja191/alpha_071.py b/agent/src/factors/zoo/gtja191/alpha_071.py
new file mode 100644
index 000000000..fa1969f4e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_071.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #71.
+
+Formula: (CLOSE-MEAN(CLOSE,24))/MEAN(CLOSE,24)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 71."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_071",
+ "theme": ['reversal'],
+ "formula_latex": '(CLOSE-MEAN(CLOSE,24))/MEAN(CLOSE,24)*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 24,
+ "min_warmup_bars": 25,
+ "notes": 'Bias-24.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ m24 = ts_mean(c, 24)
+ return safe_div(c - m24, m24) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_072.py b/agent/src/factors/zoo/gtja191/alpha_072.py
new file mode 100644
index 000000000..d82f5e6f4
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_072.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #72.
+
+Formula: SMA((TSMAX(HIGH,6)-CLOSE)/(TSMAX(HIGH,6)-TSMIN(LOW,6))*100,15,1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 72."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_072",
+ "theme": ['reversal'],
+ "formula_latex": 'SMA((TSMAX(HIGH,6)-CLOSE)/(TSMAX(HIGH,6)-TSMIN(LOW,6))*100,15,1)',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 15,
+ "min_warmup_bars": 16,
+ "notes": 'Williams %R style with SMA(15,1).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ hi6 = ts_max(h, 6)
+ lo6 = ts_min(l, 6)
+ raw = safe_div(hi6 - c, hi6 - lo6) * 100.0
+ return raw.ewm(alpha=1.0 / 15.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_073.py b/agent/src/factors/zoo/gtja191/alpha_073.py
new file mode 100644
index 000000000..8eda24ba7
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_073.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #73.
+
+Formula: ((TSRANK(DECAYLINEAR(DECAYLINEAR(CORR((CLOSE),VOLUME,10),16),4),5) - RANK(DECAYLINEAR(CORR(VWAP,MEAN(VOLUME,30),4),3))) * -1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 73."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_073",
+ "theme": ['volume'],
+ "formula_latex": '((TSRANK(DECAYLINEAR(DECAYLINEAR(CORR((CLOSE),VOLUME,10),16),4),5) - RANK(DECAYLINEAR(CORR(VWAP,MEAN(VOLUME,30),4),3))) * -1)',
+ "columns_required": ['close', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 16,
+ "min_warmup_bars": 35,
+ "notes": 'Composite of decay-linear of close-volume corr minus another decay term.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ inner = ts_corr(c, v, 10)
+ t1 = ts_rank(decay_linear(decay_linear(inner, 16), 4), 5)
+ t2 = rank(decay_linear(ts_corr(vw, ts_mean(v, 30), 4), 3))
+ return -1.0 * (t1 - t2)
diff --git a/agent/src/factors/zoo/gtja191/alpha_074.py b/agent/src/factors/zoo/gtja191/alpha_074.py
new file mode 100644
index 000000000..a1d5d09fa
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_074.py
@@ -0,0 +1,50 @@
+"""GTJA Alpha #74.
+
+Formula: (RANK(CORR(SUM(((LOW*0.35)+(VWAP*0.65)),20),SUM(MEAN(VOLUME,40),20),7)) + RANK(CORR(RANK(VWAP),RANK(VOLUME),6)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 74."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_074",
+ "theme": ['volume'],
+ "formula_latex": '(RANK(CORR(SUM(((LOW*0.35)+(VWAP*0.65)),20),SUM(MEAN(VOLUME,40),20),7)) + RANK(CORR(RANK(VWAP),RANK(VOLUME),6)))',
+ "columns_required": ['low', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 30,
+ "notes": '40d MA volume truncated to 10d; SUM windows kept at 20.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ l = panel["low"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ sumA = (l * 0.35 + vw * 0.65).rolling(10, min_periods=10).sum()
+ sumB = ts_mean(v, 10).rolling(10, min_periods=10).sum()
+ t1 = rank(ts_corr(sumA, sumB, 7))
+ t2 = rank(ts_corr(rank(vw), rank(v), 6))
+ return t1 + t2
diff --git a/agent/src/factors/zoo/gtja191/alpha_075.py b/agent/src/factors/zoo/gtja191/alpha_075.py
new file mode 100644
index 000000000..bf6e414d9
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_075.py
@@ -0,0 +1,52 @@
+"""GTJA Alpha #75.
+
+Formula: COUNT((CLOSE>OPEN & BENCHMARKINDEXCLOSE<DELAY(BENCHMARKINDEXCLOSE,1)),50)/COUNT(BENCHMARKINDEXCLOSE<DELAY(BENCHMARKINDEXCLOSE,1),50)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 75."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_075",
+ "theme": ['sentiment', 'momentum'],
+ "formula_latex": 'COUNT((CLOSE>OPEN & BENCHMARKINDEXCLOSE<DELAY(BENCHMARKINDEXCLOSE,1)),50)/COUNT(BENCHMARKINDEXCLOSE<DELAY(BENCHMARKINDEXCLOSE,1),50)',
+ "columns_required": ['close', 'open'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 50,
+ "min_warmup_bars": 30,
+ "notes": 'Benchmark unavailable in zoo panel; degraded to row-mean(close) as benchmark proxy. Window 50→20. See notes.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ o = panel["open"]
+ bench_row = c.mean(axis=1).to_numpy(dtype=float)
+ bench_df = pd.DataFrame(np.broadcast_to(bench_row[:, None], c.shape).copy(),
+ index=c.index, columns=c.columns)
+ bench_down = (bench_df < bench_df.shift(1)).astype(float)
+ up_and_down = ((c > o) & (bench_df < bench_df.shift(1))).astype(float)
+ num = up_and_down.rolling(20, min_periods=20).sum()
+ den = bench_down.rolling(20, min_periods=20).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/gtja191/alpha_076.py b/agent/src/factors/zoo/gtja191/alpha_076.py
new file mode 100644
index 000000000..8112a1ae3
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_076.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #76.
+
+Formula: STD(ABS((CLOSE/DELAY(CLOSE,1)-1))/VOLUME,20)/MEAN(ABS((CLOSE/DELAY(CLOSE,1)-1))/VOLUME,20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 76."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_076",
+ "theme": ['volatility', 'volume'],
+ "formula_latex": 'STD(ABS((CLOSE/DELAY(CLOSE,1)-1))/VOLUME,20)/MEAN(ABS((CLOSE/DELAY(CLOSE,1)-1))/VOLUME,20)',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 22,
+ "notes": 'Coefficient-of-variation of |daily return|/volume over 20 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ x = safe_div((safe_div(c, c.shift(1)) - 1.0).abs(), v)
+ return safe_div(ts_std(x, 20), ts_mean(x, 20))
diff --git a/agent/src/factors/zoo/gtja191/alpha_077.py b/agent/src/factors/zoo/gtja191/alpha_077.py
new file mode 100644
index 000000000..a05d436de
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_077.py
@@ -0,0 +1,51 @@
+"""GTJA Alpha #77.
+
+Formula: MIN(RANK(DECAYLINEAR(((HIGH+LOW)/2+HIGH-(VWAP+HIGH)),20)),RANK(DECAYLINEAR(CORR(((HIGH+LOW)/2),MEAN(VOLUME,40),3),6)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 77."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_077",
+ "theme": ['volume'],
+ "formula_latex": 'MIN(RANK(DECAYLINEAR(((HIGH+LOW)/2+HIGH-(VWAP+HIGH)),20)),RANK(DECAYLINEAR(CORR(((HIGH+LOW)/2),MEAN(VOLUME,40),3),6)))',
+ "columns_required": ['high', 'low', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 37,
+ "notes": '40d MA truncated to 30d.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ mid = (h + l) / 2.0
+ p1 = rank(decay_linear(mid + h - (vw + h), 20))
+ p2 = rank(decay_linear(ts_corr(mid, ts_mean(v, 30), 3), 6))
+ return pd.DataFrame(np.minimum(p1.to_numpy(), p2.to_numpy()),
+ index=h.index, columns=h.columns)
diff --git a/agent/src/factors/zoo/gtja191/alpha_078.py b/agent/src/factors/zoo/gtja191/alpha_078.py
new file mode 100644
index 000000000..dec88d5f8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_078.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #78.
+
+Formula: ((HIGH+LOW+CLOSE)/3-MA((HIGH+LOW+CLOSE)/3,12))/(0.015*MEAN(ABS(CLOSE-MA((HIGH+LOW+CLOSE)/3,12)),12))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 78."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_078",
+ "theme": ['reversal'],
+ "formula_latex": '((HIGH+LOW+CLOSE)/3-MA((HIGH+LOW+CLOSE)/3,12))/(0.015*MEAN(ABS(CLOSE-MA((HIGH+LOW+CLOSE)/3,12)),12))',
+ "columns_required": ['high', 'low', 'close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 23,
+ "notes": 'CCI-12 style.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ h = panel["high"]
+ l = panel["low"]
+ c = panel["close"]
+ typ = (h + l + c) / 3.0
+ ma = ts_mean(typ, 12)
+ md = ts_mean((c - ma).abs(), 12)
+ return safe_div(typ - ma, 0.015 * md)
diff --git a/agent/src/factors/zoo/gtja191/alpha_079.py b/agent/src/factors/zoo/gtja191/alpha_079.py
new file mode 100644
index 000000000..cae83a532
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_079.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #79.
+
+Formula: SMA(MAX(CLOSE-DELAY(CLOSE,1),0),12,1)/SMA(ABS(CLOSE-DELAY(CLOSE,1)),12,1)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 79."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_079",
+ "theme": ['momentum'],
+ "formula_latex": 'SMA(MAX(CLOSE-DELAY(CLOSE,1),0),12,1)/SMA(ABS(CLOSE-DELAY(CLOSE,1)),12,1)*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 12,
+ "min_warmup_bars": 13,
+ "notes": 'RSI-12.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ diff = c - c.shift(1)
+ u = diff.clip(lower=0).ewm(alpha=1.0 / 12.0, adjust=False).mean()
+ a = diff.abs().ewm(alpha=1.0 / 12.0, adjust=False).mean()
+ return safe_div(u, a) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_080.py b/agent/src/factors/zoo/gtja191/alpha_080.py
new file mode 100644
index 000000000..78510b730
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_080.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #80.
+
+Formula: (VOLUME-DELAY(VOLUME,5))/DELAY(VOLUME,5)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 80."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_080",
+ "theme": ['volume'],
+ "formula_latex": '(VOLUME-DELAY(VOLUME,5))/DELAY(VOLUME,5)*100',
+ "columns_required": ['volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": '5d volume change pct.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ pv = v.shift(5)
+ return safe_div(v - pv, pv) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_081.py b/agent/src/factors/zoo/gtja191/alpha_081.py
new file mode 100644
index 000000000..5d25bbe7c
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_081.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #81.
+
+Formula: SMA(VOLUME,21,2)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 81."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_081",
+ "theme": ['volume'],
+ "formula_latex": 'SMA(VOLUME,21,2)',
+ "columns_required": ['volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 21,
+ "min_warmup_bars": 22,
+ "notes": 'SMA(21, m=2) of volume.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return panel["volume"].ewm(alpha=2.0 / 21.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_082.py b/agent/src/factors/zoo/gtja191/alpha_082.py
new file mode 100644
index 000000000..806b606ee
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_082.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #82.
+
+Formula: SMA((TSMAX(HIGH,6)-CLOSE)/(TSMAX(HIGH,6)-TSMIN(LOW,6))*100,20,1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 82."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_082",
+ "theme": ['reversal'],
+ "formula_latex": 'SMA((TSMAX(HIGH,6)-CLOSE)/(TSMAX(HIGH,6)-TSMIN(LOW,6))*100,20,1)',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": 'Williams %R with SMA(20,1).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ hi6 = ts_max(h, 6)
+ lo6 = ts_min(l, 6)
+ raw = safe_div(hi6 - c, hi6 - lo6) * 100.0
+ return raw.ewm(alpha=1.0 / 20.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_083.py b/agent/src/factors/zoo/gtja191/alpha_083.py
new file mode 100644
index 000000000..0c8c267f4
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_083.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #83.
+
+Formula: (-1*RANK(COVIANCE(RANK(HIGH),RANK(VOLUME),5)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 83."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_083",
+ "theme": ['volume'],
+ "formula_latex": '(-1*RANK(COVIANCE(RANK(HIGH),RANK(VOLUME),5)))',
+ "columns_required": ['high', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": 'Negated rank of 5d cov(rank(high), rank(volume)).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return -1.0 * rank(ts_cov(rank(panel["high"]), rank(panel["volume"]), 5))
diff --git a/agent/src/factors/zoo/gtja191/alpha_084.py b/agent/src/factors/zoo/gtja191/alpha_084.py
new file mode 100644
index 000000000..e9039b2ce
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_084.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #84.
+
+Formula: SUM(CLOSE>DELAY(CLOSE,1)?VOLUME:(CLOSE<DELAY(CLOSE,1)?-VOLUME:0),20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 84."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_084",
+ "theme": ['volume', 'momentum'],
+ "formula_latex": 'SUM(CLOSE>DELAY(CLOSE,1)?VOLUME:(CLOSE<DELAY(CLOSE,1)?-VOLUME:0),20)',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": '20d version of alpha #43.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ pc = c.shift(1)
+ signed = v.where(c > pc, -v.where(c < pc, 0.0))
+ return signed.rolling(20, min_periods=20).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_085.py b/agent/src/factors/zoo/gtja191/alpha_085.py
new file mode 100644
index 000000000..9644c8de6
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_085.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #85.
+
+Formula: (TSRANK((VOLUME/MEAN(VOLUME,20)),20)*TSRANK((-1*DELTA(CLOSE,7)),8))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 85."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_085",
+ "theme": ['volume', 'momentum'],
+ "formula_latex": '(TSRANK((VOLUME/MEAN(VOLUME,20)),20)*TSRANK((-1*DELTA(CLOSE,7)),8))',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 39,
+ "notes": 'Vol-adjusted contrarian momentum.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ c = panel["close"]
+ vol_ratio = safe_div(v, ts_mean(v, 20))
+ return ts_rank(vol_ratio, 20) * ts_rank(-1.0 * delta(c, 7), 8)
diff --git a/agent/src/factors/zoo/gtja191/alpha_086.py b/agent/src/factors/zoo/gtja191/alpha_086.py
new file mode 100644
index 000000000..237bd5f19
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_086.py
@@ -0,0 +1,51 @@
+"""GTJA Alpha #86.
+
+Formula: ((0.25 < (((DELAY(CLOSE,20)-DELAY(CLOSE,10))/10) - ((DELAY(CLOSE,10)-CLOSE)/10))) ? -1 : (((((DELAY(CLOSE,20)-DELAY(CLOSE,10))/10) - ((DELAY(CLOSE,10)-CLOSE)/10)) < 0) ? 1 : (-1*(CLOSE-DELAY(CLOSE,1)))))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 86."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_086",
+ "theme": ['momentum'],
+ "formula_latex": '((0.25 < (((DELAY(CLOSE,20)-DELAY(CLOSE,10))/10) - ((DELAY(CLOSE,10)-CLOSE)/10))) ? -1 : (((((DELAY(CLOSE,20)-DELAY(CLOSE,10))/10) - ((DELAY(CLOSE,10)-CLOSE)/10)) < 0) ? 1 : (-1*(CLOSE-DELAY(CLOSE,1)))))',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 22,
+ "notes": 'Returns -1 / +1 / -delta depending on second-derivative thresholds.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ a = (c.shift(20) - c.shift(10)) / 10.0
+ b = (c.shift(10) - c) / 10.0
+ diff = a - b
+ last = -1.0 * (c - c.shift(1))
+ out = pd.DataFrame(np.where(0.25 < diff, -1.0,
+ np.where(diff < 0, 1.0, last.to_numpy())),
+ index=c.index, columns=c.columns)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_087.py b/agent/src/factors/zoo/gtja191/alpha_087.py
new file mode 100644
index 000000000..50c3d6424
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_087.py
@@ -0,0 +1,52 @@
+"""GTJA Alpha #87.
+
+Formula: ((RANK(DECAYLINEAR(DELTA(VWAP,4),7))+TSRANK(DECAYLINEAR((((LOW*0.9)+(LOW*0.1))-VWAP)/(OPEN-((HIGH+LOW)/2)),11),7))*-1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 87."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_087",
+ "theme": ['microstructure'],
+ "formula_latex": '((RANK(DECAYLINEAR(DELTA(VWAP,4),7))+TSRANK(DECAYLINEAR((((LOW*0.9)+(LOW*0.1))-VWAP)/(OPEN-((HIGH+LOW)/2)),11),7))*-1)',
+ "columns_required": ['close', 'open', 'high', 'low', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 11,
+ "min_warmup_bars": 22,
+ "notes": 'Sum of two decay-linear terms, negated.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ p1 = rank(decay_linear(delta(vw, 4), 7))
+ numer = (l * 0.9 + l * 0.1) - vw
+ denom = o - (h + l) / 2.0
+ p2 = ts_rank(decay_linear(safe_div(numer, denom), 11), 7)
+ return -1.0 * (p1 + p2)
diff --git a/agent/src/factors/zoo/gtja191/alpha_088.py b/agent/src/factors/zoo/gtja191/alpha_088.py
new file mode 100644
index 000000000..13c90acfe
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_088.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #88.
+
+Formula: (CLOSE-DELAY(CLOSE,20))/DELAY(CLOSE,20)*100
+Source: 国泰君安 191 alpha 研报 (2014), alpha 88."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_088",
+ "theme": ['momentum'],
+ "formula_latex": '(CLOSE-DELAY(CLOSE,20))/DELAY(CLOSE,20)*100',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": '20d return pct.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ pc = c.shift(20)
+ return safe_div(c - pc, pc) * 100.0
diff --git a/agent/src/factors/zoo/gtja191/alpha_089.py b/agent/src/factors/zoo/gtja191/alpha_089.py
new file mode 100644
index 000000000..13b587def
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_089.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #89.
+
+Formula: 2*(SMA(CLOSE,13,2)-SMA(CLOSE,27,2)-SMA(SMA(CLOSE,13,2)-SMA(CLOSE,27,2),10,2))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 89."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_089",
+ "theme": ['momentum'],
+ "formula_latex": '2*(SMA(CLOSE,13,2)-SMA(CLOSE,27,2)-SMA(SMA(CLOSE,13,2)-SMA(CLOSE,27,2),10,2))',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 27,
+ "min_warmup_bars": 28,
+ "notes": 'MACD-like signal.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ short = c.ewm(alpha=2.0 / 13.0, adjust=False).mean()
+ long_ = c.ewm(alpha=2.0 / 27.0, adjust=False).mean()
+ dif = short - long_
+ dea = dif.ewm(alpha=2.0 / 10.0, adjust=False).mean()
+ return 2.0 * (dif - dea)
diff --git a/agent/src/factors/zoo/gtja191/alpha_090.py b/agent/src/factors/zoo/gtja191/alpha_090.py
new file mode 100644
index 000000000..8dbbc9fc5
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_090.py
@@ -0,0 +1,45 @@
+"""GTJA Alpha #90.
+
+Formula: ((-1*RANK(CORR(RANK(VWAP),RANK(VOLUME),5))))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 90."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_090",
+ "theme": ['volume'],
+ "formula_latex": '((-1*RANK(CORR(RANK(VWAP),RANK(VOLUME),5))))',
+ "columns_required": ['volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": 'Negated rank of 5d corr(rank vwap, rank volume).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ return -1.0 * rank(ts_corr(rank(vw), rank(v), 5))
diff --git a/agent/src/factors/zoo/gtja191/alpha_091.py b/agent/src/factors/zoo/gtja191/alpha_091.py
new file mode 100644
index 000000000..37e085234
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_091.py
@@ -0,0 +1,46 @@
+"""GTJA Alpha #91.
+
+Formula: ((-1*RANK((CLOSE-MAX(CLOSE,5))))*RANK(CORR(MEAN(VOLUME,40),LOW,5)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 91."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_091",
+ "theme": ['volume', 'reversal'],
+ "formula_latex": '((-1*RANK((CLOSE-MAX(CLOSE,5))))*RANK(CORR(MEAN(VOLUME,40),LOW,5)))',
+ "columns_required": ['close', 'low', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 35,
+ "notes": '40d mean truncated to 30d.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ l = panel["low"]
+ v = panel["volume"]
+ return -1.0 * rank(c - ts_max(c, 5)) * rank(ts_corr(ts_mean(v, 30), l, 5))
diff --git a/agent/src/factors/zoo/gtja191/alpha_092.py b/agent/src/factors/zoo/gtja191/alpha_092.py
new file mode 100644
index 000000000..0f1092c50
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_092.py
@@ -0,0 +1,50 @@
+"""GTJA Alpha #92.
+
+Formula: (MAX(RANK(DECAYLINEAR(DELTA(((CLOSE*0.35)+(VWAP*0.65)),2),3)),TSRANK(DECAYLINEAR(ABS(CORR(MEAN(VOLUME,180),CLOSE,13)),5),15))*-1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 92."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_092",
+ "theme": ['volume'],
+ "formula_latex": '(MAX(RANK(DECAYLINEAR(DELTA(((CLOSE*0.35)+(VWAP*0.65)),2),3)),TSRANK(DECAYLINEAR(ABS(CORR(MEAN(VOLUME,180),CLOSE,13)),5),15))*-1)',
+ "columns_required": ['close', 'volume', 'amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 15,
+ "min_warmup_bars": 60,
+ "notes": '180d mean truncated to 30d.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ vw = safe_div(panel["amount"], v * 100.0 + 1.0)
+ blend = c * 0.35 + vw * 0.65
+ p1 = rank(decay_linear(delta(blend, 2), 3))
+ p2 = ts_rank(decay_linear(ts_corr(ts_mean(v, 30), c, 13).abs(), 5), 15)
+ return -1.0 * pd.DataFrame(np.maximum(p1.to_numpy(), p2.to_numpy()),
+ index=c.index, columns=c.columns)
diff --git a/agent/src/factors/zoo/gtja191/alpha_093.py b/agent/src/factors/zoo/gtja191/alpha_093.py
new file mode 100644
index 000000000..fa824c4ba
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_093.py
@@ -0,0 +1,49 @@
+"""GTJA Alpha #93.
+
+Formula: SUM((OPEN>=DELAY(OPEN,1)?0:MAX(OPEN-LOW,OPEN-DELAY(OPEN,1))),20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 93."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_093",
+ "theme": ['microstructure'],
+ "formula_latex": 'SUM((OPEN>=DELAY(OPEN,1)?0:MAX(OPEN-LOW,OPEN-DELAY(OPEN,1))),20)',
+ "columns_required": ['open', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 22,
+ "notes": 'Sum of downside range moves over 20 days.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ o = panel["open"]
+ l = panel["low"]
+ po = o.shift(1)
+ move = pd.DataFrame(np.maximum((o - l).to_numpy(), (o - po).to_numpy()),
+ index=o.index, columns=o.columns)
+ keep = move.where(o < po, 0.0)
+ return keep.rolling(20, min_periods=20).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_094.py b/agent/src/factors/zoo/gtja191/alpha_094.py
new file mode 100644
index 000000000..ebf5c547f
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_094.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #94.
+
+Formula: SUM(CLOSE>DELAY(CLOSE,1)?VOLUME:(CLOSE<DELAY(CLOSE,1)?-VOLUME:0),30)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 94."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_094",
+ "theme": ['volume', 'momentum'],
+ "formula_latex": 'SUM(CLOSE>DELAY(CLOSE,1)?VOLUME:(CLOSE<DELAY(CLOSE,1)?-VOLUME:0),30)',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 30,
+ "min_warmup_bars": 31,
+ "notes": '30d signed volume.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ v = panel["volume"]
+ pc = c.shift(1)
+ signed = v.where(c > pc, -v.where(c < pc, 0.0))
+ return signed.rolling(30, min_periods=30).sum()
diff --git a/agent/src/factors/zoo/gtja191/alpha_095.py b/agent/src/factors/zoo/gtja191/alpha_095.py
new file mode 100644
index 000000000..2889a9a75
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_095.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #95.
+
+Formula: STD(AMOUNT,20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 95."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_095",
+ "theme": ['volatility', 'volume'],
+ "formula_latex": 'STD(AMOUNT,20)',
+ "columns_required": ['amount'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": '20d std of amount.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return ts_std(panel["amount"], 20)
diff --git a/agent/src/factors/zoo/gtja191/alpha_096.py b/agent/src/factors/zoo/gtja191/alpha_096.py
new file mode 100644
index 000000000..762251da6
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_096.py
@@ -0,0 +1,47 @@
+"""GTJA Alpha #96.
+
+Formula: SMA(SMA((CLOSE-TSMIN(LOW,9))/(TSMAX(HIGH,9)-TSMIN(LOW,9))*100,3,1),3,1)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 96."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_096",
+ "theme": ['momentum'],
+ "formula_latex": 'SMA(SMA((CLOSE-TSMIN(LOW,9))/(TSMAX(HIGH,9)-TSMIN(LOW,9))*100,3,1),3,1)',
+ "columns_required": ['close', 'high', 'low'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 9,
+ "min_warmup_bars": 12,
+ "notes": 'KDJ %D-style double smoothed.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ raw = safe_div(c - ts_min(l, 9), ts_max(h, 9) - ts_min(l, 9)) * 100.0
+ return raw.ewm(alpha=1.0 / 3.0, adjust=False).mean().ewm(alpha=1.0 / 3.0, adjust=False).mean()
diff --git a/agent/src/factors/zoo/gtja191/alpha_097.py b/agent/src/factors/zoo/gtja191/alpha_097.py
new file mode 100644
index 000000000..a1e722317
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_097.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #97.
+
+Formula: STD(VOLUME,10)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 97."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_097",
+ "theme": ['volatility', 'volume'],
+ "formula_latex": 'STD(VOLUME,10)',
+ "columns_required": ['volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 10,
+ "min_warmup_bars": 11,
+ "notes": '10d std of volume.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return ts_std(panel["volume"], 10)
diff --git a/agent/src/factors/zoo/gtja191/alpha_098.py b/agent/src/factors/zoo/gtja191/alpha_098.py
new file mode 100644
index 000000000..afcd5a9e4
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_098.py
@@ -0,0 +1,48 @@
+"""GTJA Alpha #98.
+
+Formula: ((((DELTA((SUM(CLOSE,100)/100),100)/DELAY(CLOSE,100))<0.05) || ((DELTA((SUM(CLOSE,100)/100),100)/DELAY(CLOSE,100))==0.05)) ? (-1*(CLOSE-TSMIN(CLOSE,100))) : (-1*DELTA(CLOSE,3)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 98."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_098",
+ "theme": ['reversal'],
+ "formula_latex": '((((DELTA((SUM(CLOSE,100)/100),100)/DELAY(CLOSE,100))<0.05) || ((DELTA((SUM(CLOSE,100)/100),100)/DELAY(CLOSE,100))==0.05)) ? (-1*(CLOSE-TSMIN(CLOSE,100))) : (-1*DELTA(CLOSE,3)))',
+ "columns_required": ['close'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 30,
+ "min_warmup_bars": 60,
+ "notes": '100d windows truncated to 30d for warmup feasibility.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ c = panel["close"]
+ ma = ts_mean(c, 30)
+ cond_a = safe_div(delta(ma, 30), c.shift(30)) <= 0.05
+ branch1 = -1.0 * (c - ts_min(c, 30))
+ branch2 = -1.0 * delta(c, 3)
+ return branch1.where(cond_a, branch2)
diff --git a/agent/src/factors/zoo/gtja191/alpha_099.py b/agent/src/factors/zoo/gtja191/alpha_099.py
new file mode 100644
index 000000000..2ac73436f
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_099.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #99.
+
+Formula: (-1*RANK(COVIANCE(RANK(CLOSE),RANK(VOLUME),5)))
+Source: 国泰君安 191 alpha 研报 (2014), alpha 99."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_099",
+ "theme": ['volume'],
+ "formula_latex": '(-1*RANK(COVIANCE(RANK(CLOSE),RANK(VOLUME),5)))',
+ "columns_required": ['close', 'volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 5,
+ "min_warmup_bars": 6,
+ "notes": 'Negated rank of 5d cov(rank close, rank volume).',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return -1.0 * rank(ts_cov(rank(panel["close"]), rank(panel["volume"]), 5))
diff --git a/agent/src/factors/zoo/gtja191/alpha_100.py b/agent/src/factors/zoo/gtja191/alpha_100.py
new file mode 100644
index 000000000..f0b373083
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_100.py
@@ -0,0 +1,43 @@
+"""GTJA Alpha #100.
+
+Formula: STD(VOLUME,20)
+Source: 国泰君安 191 alpha 研报 (2014), alpha 100."""
+
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+)
+
+__alpha_meta__ = {
+ "id": "gtja191_100",
+ "theme": ['volatility', 'volume'],
+ "formula_latex": 'STD(VOLUME,20)',
+ "columns_required": ['volume'],
+ "extras_required": [],
+ "requires_sector": False,
+ "universe": ["equity_cn"],
+ "frequency": ["1d"],
+ "decay_horizon": 20,
+ "min_warmup_bars": 21,
+ "notes": '20d std of volume.',
+}
+
+def compute(panel: dict) -> pd.DataFrame:
+ return ts_std(panel["volume"], 20)
diff --git a/agent/src/factors/zoo/gtja191/alpha_101.py b/agent/src/factors/zoo/gtja191/alpha_101.py
new file mode 100644
index 000000000..b0d9349a6
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_101.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 101 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((RANK(CORR(close, SUM(MEAN(volume,30),37), 15)) < RANK(CORR(RANK(high), RANK(MEAN(volume,10)),11))) * -1)
+
+Notes: Inequality cast to float via .astype('float64').
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_101"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_101',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': '((rank(ts\\_corr(close, sum(ts\\_mean(volume,30),37), 15)) < rank(ts\\_corr(rank(high), rank(ts\\_mean(volume,10)), 11))) * -1)',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 15,
+ 'min_warmup_bars': 80,
+ 'notes': "Inequality cast to float via .astype('float64').",
+}
+
+
+def compute(panel):
+ """Compute gtja191_101.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(ts_corr(c, ts_mean(v, 30).rolling(37).sum(), 15))
+ right = rank(ts_corr(rank(h), rank(ts_mean(v, 10)), 11))
+ out = (left < right).astype("float64") * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_102.py b/agent/src/factors/zoo/gtja191/alpha_102.py
new file mode 100644
index 000000000..5c94d252b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_102.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 102 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(MAX(volume-DELAY(volume,1),0),6,1)/SMA(ABS(volume-DELAY(volume,1)),6,1)*100
+
+Notes: SMA(x,n,m) -> x.ewm(alpha=m/n, adjust=False).mean().
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_102"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_102',
+ 'theme': ['volume'],
+ 'formula_latex': 'sma(max(volume-delay(volume,1),0),6,1)/sma(abs(volume-delay(volume,1)),6,1)*100',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 6,
+ 'min_warmup_bars': 7,
+ 'notes': 'SMA(x,n,m) -> x.ewm(alpha=m/n, adjust=False).mean().',
+}
+
+
+def compute(panel):
+ """Compute gtja191_102.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ dv = v - v.shift(1)
+ num = _sma(dv.clip(lower=0.0), 6, 1)
+ den = _sma(dv.abs(), 6, 1)
+ out = safe_div(num, den) * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_103.py b/agent/src/factors/zoo/gtja191/alpha_103.py
new file mode 100644
index 000000000..c4dfe7688
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_103.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 103 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((20-LOWDAY(low,20))/20)*100
+
+Notes: LOWDAY -> ts_argmin (0-based); (20 - argmin)/20 * 100.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_103"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_103',
+ 'theme': ['reversal'],
+ 'formula_latex': '((20-lowday(low,20))/20)*100',
+ 'columns_required': ['close', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+ 'notes': 'LOWDAY -> ts_argmin (0-based); (20 - argmin)/20 * 100.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_103.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ am = ts_argmin(l, 20)
+ out = (20.0 - am) / 20.0 * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_104.py b/agent/src/factors/zoo/gtja191/alpha_104.py
new file mode 100644
index 000000000..b4041803b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_104.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 104 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (-1 * (DELTA(CORR(high, volume,5),5) * RANK(STD(close,20))))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_104"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_104',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '-1*delta(corr(high,volume,5),5)*rank(std(close,20))',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_104.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ corr_hv = ts_corr(h, v, 5)
+ out = -1.0 * (delta(corr_hv, 5) * rank(ts_std(c, 20)))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_105.py b/agent/src/factors/zoo/gtja191/alpha_105.py
new file mode 100644
index 000000000..ec420ab94
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_105.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 105 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (-1 * CORR(RANK(OPEN), RANK(VOLUME), 10))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_105"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_105',
+ 'theme': ['volume'],
+ 'formula_latex': '-1*corr(rank(open),rank(volume),10)',
+ 'columns_required': ['open', 'volume', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_105.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ o = panel["open"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = -1.0 * ts_corr(rank(o), rank(v), 10)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_106.py b/agent/src/factors/zoo/gtja191/alpha_106.py
new file mode 100644
index 000000000..000667ca8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_106.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 106 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ CLOSE - DELAY(CLOSE,20)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_106"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_106',
+ 'theme': ['momentum'],
+ 'formula_latex': 'close-delay(close,20)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_106.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ out = delta(c, 20)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_107.py b/agent/src/factors/zoo/gtja191/alpha_107.py
new file mode 100644
index 000000000..d81b6335f
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_107.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 107 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (((-1 * RANK((OPEN - DELAY(HIGH, 1)))) * RANK((OPEN - DELAY(CLOSE, 1)))) * RANK((OPEN - DELAY(LOW, 1))))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_107"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_107',
+ 'theme': ['reversal'],
+ 'formula_latex': '-1*rank(open-delay(high,1))*rank(open-delay(close,1))*rank(open-delay(low,1))',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 2,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_107.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ o = panel["open"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ out = (-1.0 * rank(o - h.shift(1))) * rank(o - c.shift(1)) * rank(o - l.shift(1))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_108.py b/agent/src/factors/zoo/gtja191/alpha_108.py
new file mode 100644
index 000000000..82156a31e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_108.py
@@ -0,0 +1,69 @@
+"""GTJA Alpha 108 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((RANK((HIGH - MIN(HIGH,2)))^RANK(CORR((VWAP), (MEAN(VOLUME,120)), 6))) * -1)
+
+Notes: x^y interpreted as x ** y after rank; both terms in (0,1].
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_108"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_108',
+ 'theme': ['reversal', 'volume'],
+ 'formula_latex': '(rank(high-min(high,2))^rank(corr(vwap,mean(volume,120),6)))*-1',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 6,
+ 'min_warmup_bars': 125,
+ 'notes': 'x^y interpreted as x ** y after rank; both terms in (0,1].',
+}
+
+
+def compute(panel):
+ """Compute gtja191_108.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ h = panel["high"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(h - ts_min(h, 2))
+ right = rank(ts_corr(vw, ts_mean(v, 120), 6))
+ out = signed_power(left, 1.0) * 0 # placeholder to load library
+ # We compute left ** right with NaN safety.
+ arr_l = left.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_r = right.to_numpy(dtype=np.float64, na_value=np.nan)
+ arr = np.power(arr_l, arr_r)
+ out = pd.DataFrame(arr, index=left.index, columns=left.columns) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_109.py b/agent/src/factors/zoo/gtja191/alpha_109.py
new file mode 100644
index 000000000..9e7f5ab34
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_109.py
@@ -0,0 +1,68 @@
+"""GTJA Alpha 109 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(HIGH-LOW,10,2) / SMA(SMA(HIGH-LOW,10,2),10,2)
+
+Notes: SMA -> ewm(alpha=2/10).
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_109"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_109',
+ 'theme': ['volatility'],
+ 'formula_latex': 'sma(high-low,10,2)/sma(sma(high-low,10,2),10,2)',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 20,
+ 'notes': 'SMA -> ewm(alpha=2/10).',
+}
+
+
+def compute(panel):
+ """Compute gtja191_109.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ hl = h - l
+ num = _sma(hl, 10, 2)
+ den = _sma(num, 10, 2)
+ out = safe_div(num, den)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_110.py b/agent/src/factors/zoo/gtja191/alpha_110.py
new file mode 100644
index 000000000..9cd99b52e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_110.py
@@ -0,0 +1,66 @@
+"""GTJA Alpha 110 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SUM(MAX(0,HIGH-DELAY(CLOSE,1)),20) / SUM(MAX(0,DELAY(CLOSE,1)-LOW),20) * 100
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_110"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_110',
+ 'theme': ['momentum'],
+ 'formula_latex': 'sum(max(0,high-delay(close,1)),20)/sum(max(0,delay(close,1)-low),20)*100',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_110.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ prev_c = c.shift(1)
+ num = (h - prev_c).clip(lower=0.0).rolling(20).sum()
+ den = (prev_c - l).clip(lower=0.0).rolling(20).sum()
+ out = safe_div(num, den) * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_111.py b/agent/src/factors/zoo/gtja191/alpha_111.py
new file mode 100644
index 000000000..2238be9a9
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_111.py
@@ -0,0 +1,68 @@
+"""GTJA Alpha 111 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(VOL*((CLOSE-LOW)-(HIGH-CLOSE))/(HIGH-LOW),11,2) - SMA(VOL*((CLOSE-LOW)-(HIGH-CLOSE))/(HIGH-LOW),4,2)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_111"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_111',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': 'sma(v*((c-l)-(h-c))/(h-l),11,2)-sma(v*((c-l)-(h-c))/(h-l),4,2)',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 11,
+ 'min_warmup_bars': 12,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_111.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ ratio = safe_div(v * ((c - l) - (h - c)), h - l)
+ out = _sma(ratio, 11, 2) - _sma(ratio, 4, 2)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_112.py b/agent/src/factors/zoo/gtja191/alpha_112.py
new file mode 100644
index 000000000..706fe472b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_112.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 112 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (SUM(CLOSE-DELAY(CLOSE,1) if up else 0,12) - SUM(ABS if down else 0,12)) / (SUM up + SUM down) * 100
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_112"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_112',
+ 'theme': ['momentum'],
+ 'formula_latex': '(sum_up(12)-sum_down(12))/(sum_up(12)+sum_down(12))*100',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 13,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_112.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ dc = c - c.shift(1)
+ up = dc.where(dc > 0, 0.0).rolling(12).sum()
+ down = (-dc).where(dc < 0, 0.0).rolling(12).sum()
+ out = safe_div(up - down, up + down) * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_113.py b/agent/src/factors/zoo/gtja191/alpha_113.py
new file mode 100644
index 000000000..2f317d394
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_113.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 113 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (-1 * ((RANK((SUM(DELAY(CLOSE, 5), 20) / 20)) * CORR(CLOSE, VOLUME, 2)) * RANK(CORR(SUM(CLOSE, 5), SUM(CLOSE, 20), 2))))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_113"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_113',
+ 'theme': ['volume'],
+ 'formula_latex': '-1*(rank(mean(delay(c,5),20))*corr(c,v,2))*rank(corr(sum(c,5),sum(c,20),2))',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 27,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_113.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ m1 = rank(c.shift(5).rolling(20).sum() / 20.0)
+ m2 = ts_corr(c, v, 2)
+ m3 = rank(ts_corr(c.rolling(5).sum(), c.rolling(20).sum(), 2))
+ out = -1.0 * (m1 * m2) * m3
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_114.py b/agent/src/factors/zoo/gtja191/alpha_114.py
new file mode 100644
index 000000000..f573b9d10
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_114.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 114 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((RANK(DELAY(((HIGH-LOW)/(SUM(CLOSE,5)/5)),2)) * RANK(RANK(VOLUME))) / (((HIGH-LOW)/(SUM(CLOSE,5)/5))/(VWAP-CLOSE)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_114"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_114',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 7,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_114.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ hl_ratio = safe_div(h - l, c.rolling(5).sum() / 5.0)
+ num = rank(hl_ratio.shift(2)) * rank(rank(v))
+ den = safe_div(hl_ratio, vw - c)
+ out = safe_div(num, den)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_115.py b/agent/src/factors/zoo/gtja191/alpha_115.py
new file mode 100644
index 000000000..518c90055
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_115.py
@@ -0,0 +1,68 @@
+"""GTJA Alpha 115 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ RANK(CORR(((HIGH*0.9)+(CLOSE*0.1)),MEAN(VOLUME,30),10))^RANK(CORR(TSRANK(((HIGH+LOW)/2),4),TSRANK(VOLUME,10),7))
+
+Notes: x^y -> np.power after rank.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_115"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_115',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(corr(0.9h+0.1c,mean(v,30),10))^rank(corr(tsrank((h+l)/2,4),tsrank(v,10),7))',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 40,
+ 'notes': 'x^y -> np.power after rank.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_115.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(ts_corr(h * 0.9 + c * 0.1, ts_mean(v, 30), 10))
+ right = rank(ts_corr(ts_rank((h + l) / 2.0, 4), ts_rank(v, 10), 7))
+ arr = np.power(left.to_numpy(dtype=np.float64, na_value=np.nan),
+ right.to_numpy(dtype=np.float64, na_value=np.nan))
+ out = pd.DataFrame(arr, index=left.index, columns=left.columns)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_116.py b/agent/src/factors/zoo/gtja191/alpha_116.py
new file mode 100644
index 000000000..47e9b70a5
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_116.py
@@ -0,0 +1,66 @@
+"""GTJA Alpha 116 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ REGBETA(CLOSE, SEQUENCE, 20)
+
+Notes: Rolling OLS slope vs. linear index; cov(c,t,20)/var(t,20).
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_116"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_116',
+ 'theme': ['momentum'],
+ 'formula_latex': 'regbeta(close,sequence(20),20)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+ 'notes': 'Rolling OLS slope vs. linear index; cov(c,t,20)/var(t,20).',
+}
+
+
+def compute(panel):
+ """Compute gtja191_116.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ n = 20
+ t = pd.DataFrame(
+ np.tile(np.arange(c.shape[0], dtype=np.float64).reshape(-1, 1), (1, c.shape[1])),
+ index=c.index, columns=c.columns,
+ )
+ beta = safe_div(ts_cov(c, t, n), ts_std(t, n) ** 2)
+ return beta
diff --git a/agent/src/factors/zoo/gtja191/alpha_117.py b/agent/src/factors/zoo/gtja191/alpha_117.py
new file mode 100644
index 000000000..635c5332a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_117.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 117 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((TSRANK(VOLUME, 32) * (1 - TSRANK(((CLOSE + HIGH) - LOW), 16))) * (1 - TSRANK(RET, 32)))
+
+Notes: ret = close/delay(close,1) - 1.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_117"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_117',
+ 'theme': ['volume', 'momentum'],
+ 'formula_latex': 'tsrank(v,32)*(1-tsrank(c+h-l,16))*(1-tsrank(ret,32))',
+ 'columns_required': ['close', 'high', 'low', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 32,
+ 'min_warmup_bars': 33,
+ 'notes': 'ret = close/delay(close,1) - 1.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_117.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ ret = safe_div(c, c.shift(1)) - 1.0
+ out = (ts_rank(v, 32) * (1.0 - ts_rank((c + h) - l, 16))) * (1.0 - ts_rank(ret, 32))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_118.py b/agent/src/factors/zoo/gtja191/alpha_118.py
new file mode 100644
index 000000000..3502d01ad
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_118.py
@@ -0,0 +1,63 @@
+"""GTJA Alpha 118 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SUM(HIGH-OPEN,20)/SUM(OPEN-LOW,20)*100
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_118"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_118',
+ 'theme': ['reversal'],
+ 'formula_latex': 'sum(h-o,20)/sum(o-l,20)*100',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_118.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ o = panel["open"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ out = safe_div((h - o).rolling(20).sum(), (o - l).rolling(20).sum()) * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_119.py b/agent/src/factors/zoo/gtja191/alpha_119.py
new file mode 100644
index 000000000..613fae352
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_119.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 119 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ RANK(DECAYLINEAR(CORR(VWAP,SUM(MEAN(VOLUME,5),26),5),7)) - RANK(DECAYLINEAR(TSRANK(MIN(CORR(RANK(OPEN),RANK(MEAN(VOLUME,15)),21),9),7),8))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_119"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_119',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 26,
+ 'min_warmup_bars': 60,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_119.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ o = panel["open"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(decay_linear(ts_corr(vw, ts_mean(v, 5).rolling(26).sum(), 5), 7))
+ inner = ts_min(ts_corr(rank(o), rank(ts_mean(v, 15)), 21), 9)
+ right = rank(decay_linear(ts_rank(inner, 7), 8))
+ out = left - right
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_120.py b/agent/src/factors/zoo/gtja191/alpha_120.py
new file mode 100644
index 000000000..e0da8d551
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_120.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 120 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (RANK((VWAP - CLOSE)) / RANK((VWAP + CLOSE)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_120"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_120',
+ 'theme': ['reversal'],
+ 'formula_latex': 'rank(vwap-close)/rank(vwap+close)',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_120.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ out = safe_div(rank(vw - c), rank(vw + c))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_121.py b/agent/src/factors/zoo/gtja191/alpha_121.py
new file mode 100644
index 000000000..ee5a61835
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_121.py
@@ -0,0 +1,66 @@
+"""GTJA Alpha 121 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((RANK((VWAP-MIN(VWAP,12)))^TSRANK(CORR(TSRANK(VWAP,20),TSRANK(MEAN(VOLUME,60),2),18),3))*-1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_121"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_121',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 80,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_121.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(vw - ts_min(vw, 12))
+ inner = ts_corr(ts_rank(vw, 20), ts_rank(ts_mean(v, 60), 2), 18)
+ right = ts_rank(inner, 3)
+ arr = np.power(left.to_numpy(dtype=np.float64, na_value=np.nan),
+ right.to_numpy(dtype=np.float64, na_value=np.nan))
+ out = pd.DataFrame(arr, index=left.index, columns=left.columns) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_122.py b/agent/src/factors/zoo/gtja191/alpha_122.py
new file mode 100644
index 000000000..b72957483
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_122.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 122 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (SMA(SMA(SMA(LOG(CLOSE),13,2),13,2),13,2)-DELAY(...,1))/DELAY(...,1)
+
+Notes: Triple SMA of log close.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_122"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_122',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 13,
+ 'min_warmup_bars': 40,
+ 'notes': 'Triple SMA of log close.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_122.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ s = _sma(_sma(_sma(np.log(c), 13, 2), 13, 2), 13, 2)
+ out = safe_div(s - s.shift(1), s.shift(1))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_123.py b/agent/src/factors/zoo/gtja191/alpha_123.py
new file mode 100644
index 000000000..a47c88f8a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_123.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 123 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((RANK(CORR(SUM(((HIGH+LOW)/2),20),SUM(MEAN(VOLUME,60),20),9)) < RANK(CORR(LOW,VOLUME,6))) * -1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_123"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_123',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 90,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_123.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(ts_corr(((h + l) / 2.0).rolling(20).sum(), ts_mean(v, 60).rolling(20).sum(), 9))
+ right = rank(ts_corr(l, v, 6))
+ out = (left < right).astype("float64") * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_124.py b/agent/src/factors/zoo/gtja191/alpha_124.py
new file mode 100644
index 000000000..747d2b473
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_124.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 124 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (CLOSE-VWAP)/DECAYLINEAR(RANK(TSMAX(CLOSE,30)),2)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_124"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_124',
+ 'theme': ['reversal'],
+ 'formula_latex': '(close-vwap)/decay_linear(rank(tsmax(close,30)),2)',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 32,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_124.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ out = safe_div(c - vw, decay_linear(rank(ts_max(c, 30)), 2))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_125.py b/agent/src/factors/zoo/gtja191/alpha_125.py
new file mode 100644
index 000000000..1b866f3de
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_125.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 125 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (RANK(DECAYLINEAR(CORR(VWAP,MEAN(VOLUME,80),17),20))/RANK(DECAYLINEAR(DELTA(((CLOSE*0.5)+(VWAP*0.5)),3),16)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_125"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_125',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 120,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_125.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ num = rank(decay_linear(ts_corr(vw, ts_mean(v, 80), 17), 20))
+ den = rank(decay_linear(delta(c * 0.5 + vw * 0.5, 3), 16))
+ out = safe_div(num, den)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_126.py b/agent/src/factors/zoo/gtja191/alpha_126.py
new file mode 100644
index 000000000..483fa4d81
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_126.py
@@ -0,0 +1,63 @@
+"""GTJA Alpha 126 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (CLOSE+HIGH+LOW)/3
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_126"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_126',
+ 'theme': ['reversal'],
+ 'formula_latex': '(c+h+l)/3',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_126.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ out = (c + h + l) / 3.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_127.py b/agent/src/factors/zoo/gtja191/alpha_127.py
new file mode 100644
index 000000000..cd3e62a42
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_127.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 127 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (MEAN((100*(CLOSE-MAX(CLOSE,12))/MAX(CLOSE,12))^2,12))^(1/2)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_127"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_127',
+ 'theme': ['volatility'],
+ 'formula_latex': 'sqrt(mean((100*(c-tsmax(c,12))/tsmax(c,12))^2,12))',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 24,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_127.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ ratio = safe_div(c - ts_max(c, 12), ts_max(c, 12)) * 100.0
+ out = ts_mean(ratio ** 2, 12) ** 0.5
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_128.py b/agent/src/factors/zoo/gtja191/alpha_128.py
new file mode 100644
index 000000000..ddb09f3fe
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_128.py
@@ -0,0 +1,69 @@
+"""GTJA Alpha 128 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ 100-100/(1+SUM(((H+L+C)/3*V) if up else 0,14)/SUM((... if down else 0),14))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_128"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_128',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 14,
+ 'min_warmup_bars': 16,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_128.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ tp = (h + l + c) / 3.0
+ dtp = tp - tp.shift(1)
+ up = (tp * v).where(dtp > 0, 0.0).rolling(14).sum()
+ down = (tp * v).where(dtp < 0, 0.0).rolling(14).sum()
+ ratio = safe_div(up, down)
+ out = 100.0 - 100.0 / (1.0 + ratio)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_129.py b/agent/src/factors/zoo/gtja191/alpha_129.py
new file mode 100644
index 000000000..a37f6edf2
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_129.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 129 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SUM((CLOSE-DELAY(CLOSE,1)<0?ABS(CLOSE-DELAY(CLOSE,1)):0),12)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_129"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_129',
+ 'theme': ['momentum'],
+ 'formula_latex': 'sum(abs(c-delay(c,1)) if dc<0 else 0,12)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 13,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_129.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ dc = c - c.shift(1)
+ out = (-dc).where(dc < 0, 0.0).rolling(12).sum()
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_130.py b/agent/src/factors/zoo/gtja191/alpha_130.py
new file mode 100644
index 000000000..197db43c8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_130.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 130 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (RANK(DECAYLINEAR(CORR((H+L)/2,MEAN(V,40),9),10))/RANK(DECAYLINEAR(CORR(RANK(VWAP),RANK(V),7),3)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_130"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_130',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 40,
+ 'min_warmup_bars': 60,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_130.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ num = rank(decay_linear(ts_corr((h + l) / 2.0, ts_mean(v, 40), 9), 10))
+ den = rank(decay_linear(ts_corr(rank(vw), rank(v), 7), 3))
+ out = safe_div(num, den)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_131.py b/agent/src/factors/zoo/gtja191/alpha_131.py
new file mode 100644
index 000000000..ff516b953
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_131.py
@@ -0,0 +1,66 @@
+"""GTJA Alpha 131 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (RANK(DELAT(VWAP,1))^TSRANK(CORR(CLOSE,MEAN(VOLUME,50),18),18))
+
+Notes: DELAT in report typo = DELTA.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_131"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_131',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(delta(vwap,1))^tsrank(corr(close,mean(v,50),18),18)',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 50,
+ 'min_warmup_bars': 84,
+ 'notes': 'DELAT in report typo = DELTA.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_131.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(delta(vw, 1))
+ right = ts_rank(ts_corr(c, ts_mean(v, 50), 18), 18)
+ arr = np.power(left.to_numpy(dtype=np.float64, na_value=np.nan),
+ right.to_numpy(dtype=np.float64, na_value=np.nan))
+ out = pd.DataFrame(arr, index=left.index, columns=left.columns)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_132.py b/agent/src/factors/zoo/gtja191/alpha_132.py
new file mode 100644
index 000000000..cab0ee706
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_132.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 132 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MEAN(AMOUNT,20)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_132"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_132',
+ 'theme': ['liquidity'],
+ 'formula_latex': 'mean(amount,20)',
+ 'columns_required': ['close', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_132.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ amt = panel["amount"]
+ vw = vwap(panel, "equity_cn")
+
+ out = ts_mean(amt, 20)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_133.py b/agent/src/factors/zoo/gtja191/alpha_133.py
new file mode 100644
index 000000000..86fa4061f
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_133.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 133 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((20-HIGHDAY(HIGH,20))/20)*100 - ((20-LOWDAY(LOW,20))/20)*100
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_133"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_133',
+ 'theme': ['momentum'],
+ 'formula_latex': '((20-highday(high,20))/20)*100-((20-lowday(low,20))/20)*100',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_133.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ out = (20.0 - ts_argmax(h, 20)) / 20.0 * 100.0 - (20.0 - ts_argmin(l, 20)) / 20.0 * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_134.py b/agent/src/factors/zoo/gtja191/alpha_134.py
new file mode 100644
index 000000000..f4c48eae8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_134.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 134 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (CLOSE-DELAY(CLOSE,12))/DELAY(CLOSE,12)*VOLUME
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_134"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_134',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '(close-delay(close,12))/delay(close,12)*volume',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 13,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_134.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = safe_div(c - c.shift(12), c.shift(12)) * v
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_135.py b/agent/src/factors/zoo/gtja191/alpha_135.py
new file mode 100644
index 000000000..402d7fcab
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_135.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 135 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(DELAY(CLOSE/DELAY(CLOSE,20),1),20,1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_135"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_135',
+ 'theme': ['momentum'],
+ 'formula_latex': 'sma(delay(c/delay(c,20),1),20,1)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 22,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_135.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ ratio = safe_div(c, c.shift(20)).shift(1)
+ out = _sma(ratio, 20, 1)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_136.py b/agent/src/factors/zoo/gtja191/alpha_136.py
new file mode 100644
index 000000000..9d6f566ea
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_136.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 136 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((-1 * RANK(DELTA(RET, 3))) * CORR(OPEN, VOLUME, 10))
+
+Notes: ret = close/delay(close,1) - 1.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_136"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_136',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '-1*rank(delta(ret,3))*corr(open,volume,10)',
+ 'columns_required': ['open', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 11,
+ 'notes': 'ret = close/delay(close,1) - 1.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_136.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ o = panel["open"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ ret = safe_div(c, c.shift(1)) - 1.0
+ out = (-1.0 * rank(delta(ret, 3))) * ts_corr(o, v, 10)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_137.py b/agent/src/factors/zoo/gtja191/alpha_137.py
new file mode 100644
index 000000000..c1810f5ce
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_137.py
@@ -0,0 +1,84 @@
+"""GTJA Alpha 137 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ 16*((c-dc1+(c-o)/2+dc1-do1)/MAX_term) * MAX(abs(h-dc1), abs(l-dc1))
+
+Notes: Transcribed from the standard 137 implementation; piecewise denominator.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_137"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_137',
+ 'theme': ['volatility'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 2,
+ 'notes': 'Transcribed from the standard 137 implementation; piecewise denominator.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_137.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ o = panel["open"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ dc1 = c.shift(1)
+ do1 = o.shift(1)
+ dl1 = l.shift(1)
+ dh1 = h.shift(1)
+ abs_hdc = (h - dc1).abs()
+ abs_ldc = (l - dc1).abs()
+ abs_hdl1 = (h - dl1).abs()
+ # Three candidate denominators per report
+ cond1 = (abs_hdc > abs_ldc) & (abs_hdc > abs_hdl1)
+ cond2 = (abs_ldc > abs_hdl1) & (abs_ldc > abs_hdc)
+ den_a = abs_hdc + abs_ldc / 2.0 + (dc1 - do1).abs() / 4.0
+ den_b = abs_ldc + abs_hdc / 2.0 + (dc1 - do1).abs() / 4.0
+ den_c = abs_hdl1 + (dc1 - do1).abs() / 4.0
+ den = den_c.where(~cond2, den_b).where(~cond1, den_a)
+ num = c - dc1 + (c - o) / 2.0 + dc1 - do1
+ mx = pd.DataFrame(
+ np.maximum(abs_hdc.to_numpy(dtype=np.float64, na_value=np.nan),
+ abs_ldc.to_numpy(dtype=np.float64, na_value=np.nan)),
+ index=c.index, columns=c.columns,
+ )
+ out = 16.0 * safe_div(num, den) * mx
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_138.py b/agent/src/factors/zoo/gtja191/alpha_138.py
new file mode 100644
index 000000000..73d83a070
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_138.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 138 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((RANK(DECAYLINEAR(DELTA((((LOW*0.7)+(VWAP*0.3))),3),20))-TSRANK(DECAYLINEAR(TSRANK(CORR(TSRANK(LOW,8),TSRANK(MEAN(VOLUME,60),17),5),19),16),7))*-1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_138"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_138',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 119,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_138.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(decay_linear(delta(l * 0.7 + vw * 0.3, 3), 20))
+ inner = ts_corr(ts_rank(l, 8), ts_rank(ts_mean(v, 60), 17), 5)
+ right = ts_rank(decay_linear(ts_rank(inner, 19), 16), 7)
+ out = (left - right) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_139.py b/agent/src/factors/zoo/gtja191/alpha_139.py
new file mode 100644
index 000000000..294bbd5bf
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_139.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 139 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (-1 * CORR(OPEN, VOLUME, 10))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_139"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_139',
+ 'theme': ['volume'],
+ 'formula_latex': '-1*corr(open,volume,10)',
+ 'columns_required': ['open', 'volume', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_139.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ o = panel["open"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = -1.0 * ts_corr(o, v, 10)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_140.py b/agent/src/factors/zoo/gtja191/alpha_140.py
new file mode 100644
index 000000000..88b69fec5
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_140.py
@@ -0,0 +1,70 @@
+"""GTJA Alpha 140 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MIN(RANK(DECAYLINEAR(((RANK(OPEN)+RANK(LOW))-(RANK(HIGH)+RANK(CLOSE))),8)),TSRANK(DECAYLINEAR(CORR(TSRANK(CLOSE,8),TSRANK(MEAN(VOLUME,60),20),8),7),3))
+
+Notes: MIN(a,b) elementwise -> np.minimum.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_140"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_140',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 100,
+ 'notes': 'MIN(a,b) elementwise -> np.minimum.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_140.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ o = panel["open"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(decay_linear((rank(o) + rank(l)) - (rank(h) + rank(c)), 8))
+ inner = ts_corr(ts_rank(c, 8), ts_rank(ts_mean(v, 60), 20), 8)
+ right = ts_rank(decay_linear(ts_rank(inner, 7), 7), 3)
+ arr = np.minimum(left.to_numpy(dtype=np.float64, na_value=np.nan),
+ right.to_numpy(dtype=np.float64, na_value=np.nan))
+ out = pd.DataFrame(arr, index=left.index, columns=left.columns)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_141.py b/agent/src/factors/zoo/gtja191/alpha_141.py
new file mode 100644
index 000000000..ba2eef970
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_141.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 141 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (RANK(CORR(RANK(HIGH),RANK(MEAN(VOLUME,15)),9))*-1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_141"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_141',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(corr(rank(high),rank(mean(v,15)),9))*-1',
+ 'columns_required': ['high', 'volume', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 15,
+ 'min_warmup_bars': 24,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_141.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ h = panel["high"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = rank(ts_corr(rank(h), rank(ts_mean(v, 15)), 9)) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_142.py b/agent/src/factors/zoo/gtja191/alpha_142.py
new file mode 100644
index 000000000..29d2704a5
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_142.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 142 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (((-1*RANK(TSRANK(CLOSE,10)))*RANK(DELTA(DELTA(CLOSE,1),1)))*RANK(TSRANK((VOLUME/MEAN(VOLUME,20)),5)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_142"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_142',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 26,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_142.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ a = -1.0 * rank(ts_rank(c, 10))
+ b = rank(delta(delta(c, 1), 1))
+ d = rank(ts_rank(safe_div(v, ts_mean(v, 20)), 5))
+ out = a * b * d
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_143.py b/agent/src/factors/zoo/gtja191/alpha_143.py
new file mode 100644
index 000000000..368a47729
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_143.py
@@ -0,0 +1,63 @@
+"""GTJA Alpha 143 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ CLOSE>DELAY(CLOSE,1)?(CLOSE-DELAY(CLOSE,1))/DELAY(CLOSE,1)*SELF:SELF
+
+Notes: Recursive SELF unrolled to cumulative product of (1 + up_return) since series start.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_143"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_143',
+ 'theme': ['momentum'],
+ 'formula_latex': 'cumprod(1 + (c/delay(c,1)-1) if c>delay(c,1) else 0)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 2,
+ 'notes': 'Recursive SELF unrolled to cumulative product of (1 + up_return) since series start.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_143.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ dc = c - c.shift(1)
+ inc = safe_div(dc, c.shift(1)).where(dc > 0, 0.0)
+ out = (1.0 + inc).cumprod()
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_144.py b/agent/src/factors/zoo/gtja191/alpha_144.py
new file mode 100644
index 000000000..504c66564
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_144.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 144 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SUMIF(ABS(CLOSE/DELAY(CLOSE,1)-1)/AMOUNT, CLOSE<DELAY(CLOSE,1),20)/COUNT(CLOSE<DELAY(CLOSE,1),20)
+
+Notes: SUMIF -> (x*cond).rolling(n).sum(); COUNT -> cond.rolling(n).sum().
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_144"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_144',
+ 'theme': ['liquidity'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 21,
+ 'notes': 'SUMIF -> (x*cond).rolling(n).sum(); COUNT -> cond.rolling(n).sum().',
+}
+
+
+def compute(panel):
+ """Compute gtja191_144.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ amt = panel["amount"]
+ vw = vwap(panel, "equity_cn")
+
+ dc = c - c.shift(1)
+ cond = (dc < 0).astype("float64")
+ x = safe_div((safe_div(c, c.shift(1)) - 1.0).abs(), amt)
+ sumif = (x * cond).rolling(20).sum()
+ cnt = cond.rolling(20).sum().where(lambda d: d > 0)
+ out = safe_div(sumif, cnt)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_145.py b/agent/src/factors/zoo/gtja191/alpha_145.py
new file mode 100644
index 000000000..2d1462aca
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_145.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 145 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (MEAN(VOLUME,9)-MEAN(VOLUME,26))/MEAN(VOLUME,12)*100
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_145"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_145',
+ 'theme': ['volume'],
+ 'formula_latex': '(mean(v,9)-mean(v,26))/mean(v,12)*100',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 26,
+ 'min_warmup_bars': 26,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_145.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = safe_div(ts_mean(v, 9) - ts_mean(v, 26), ts_mean(v, 12)) * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_146.py b/agent/src/factors/zoo/gtja191/alpha_146.py
new file mode 100644
index 000000000..56e0074a2
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_146.py
@@ -0,0 +1,70 @@
+"""GTJA Alpha 146 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MEAN((CLOSE-DELAY(CLOSE,1))/DELAY(CLOSE,1)-SMA(...,61,2),20)*((CLOSE-DELAY(CLOSE,1))/DELAY(CLOSE,1)-SMA(...,61,2))/SMA(((...)-SMA(...))^2,60,2)
+
+Notes: Standardised return deviation; SMA(.,61,2)=ewm(alpha=2/61).
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_146"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_146',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 81,
+ 'notes': 'Standardised return deviation; SMA(.,61,2)=ewm(alpha=2/61).',
+}
+
+
+def compute(panel):
+ """Compute gtja191_146.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ ret = safe_div(c - c.shift(1), c.shift(1))
+ ewm_ret = _sma(ret, 61, 2)
+ dev = ret - ewm_ret
+ left = ts_mean(dev, 20)
+ right = dev
+ den = _sma(dev ** 2, 60, 2)
+ out = safe_div(left * right, den)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_147.py b/agent/src/factors/zoo/gtja191/alpha_147.py
new file mode 100644
index 000000000..a941411ab
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_147.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 147 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ REGBETA(MEAN(CLOSE,12), SEQUENCE(12))
+
+Notes: Rolling OLS slope of MA12 against linear index, window 12.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_147"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_147',
+ 'theme': ['momentum'],
+ 'formula_latex': 'regbeta(mean(close,12),sequence(12))',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 24,
+ 'notes': 'Rolling OLS slope of MA12 against linear index, window 12.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_147.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ n = 12
+ m = ts_mean(c, 12)
+ t = pd.DataFrame(
+ np.tile(np.arange(c.shape[0], dtype=np.float64).reshape(-1, 1), (1, c.shape[1])),
+ index=c.index, columns=c.columns,
+ )
+ out = safe_div(ts_cov(m, t, n), ts_std(t, n) ** 2)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_148.py b/agent/src/factors/zoo/gtja191/alpha_148.py
new file mode 100644
index 000000000..fda02670d
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_148.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 148 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((RANK(CORR((OPEN), SUM(MEAN(VOLUME,60), 9), 6)) < RANK((OPEN - MIN(OPEN, 14)))) * -1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_148"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_148',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 75,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_148.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ o = panel["open"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(ts_corr(o, ts_mean(v, 60).rolling(9).sum(), 6))
+ right = rank(o - ts_min(o, 14))
+ out = (left < right).astype("float64") * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_149.py b/agent/src/factors/zoo/gtja191/alpha_149.py
new file mode 100644
index 000000000..deb5e204a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_149.py
@@ -0,0 +1,81 @@
+"""GTJA Alpha 149 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ REGBETA(FILTER(CLOSE/DELAY(CLOSE,1)-1, BENCH<DELAY(BENCH,1)), FILTER(BENCH/DELAY(BENCH,1)-1, BENCH<DELAY(BENCH,1)), 252)
+
+Notes: Downside beta vs. benchmark; uses fallback cross-sectional mean if benchmark_close missing.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_149"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_149',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 253,
+ 'notes': 'Downside beta vs. benchmark; uses fallback cross-sectional mean if benchmark_close missing.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_149.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _bench_close():
+ """Benchmark close fallback: cross-sectional mean of `close`."""
+ if "benchmark_close" in panel:
+ return panel["benchmark_close"]
+ c = panel["close"]
+ return pd.DataFrame(
+ np.tile(c.mean(axis=1).to_numpy().reshape(-1, 1), (1, c.shape[1])),
+ index=c.index,
+ columns=c.columns,
+ )
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ bench = _bench_close()
+ br = safe_div(bench - bench.shift(1), bench.shift(1))
+ cr = safe_div(c - c.shift(1), c.shift(1))
+ # Multiplicative gating instead of NaN-masking so the rolling window keeps
+ # enough valid samples (NaN-masking on roughly half the rows blows the
+ # min_periods=n requirement on small panels).
+ mask = (bench < bench.shift(1)).astype("float64")
+ cr_g = cr * mask
+ br_g = br * mask
+ n = 20
+ out = safe_div(ts_cov(cr_g, br_g, n), ts_std(br_g, n) ** 2)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_150.py b/agent/src/factors/zoo/gtja191/alpha_150.py
new file mode 100644
index 000000000..23668e6bc
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_150.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 150 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (CLOSE+HIGH+LOW)/3*VOLUME
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_150"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_150',
+ 'theme': ['volume'],
+ 'formula_latex': '(close+high+low)/3*volume',
+ 'columns_required': ['close', 'high', 'low', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_150.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = (c + h + l) / 3.0 * v
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_151.py b/agent/src/factors/zoo/gtja191/alpha_151.py
new file mode 100644
index 000000000..4ddafc46c
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_151.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 151 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(CLOSE-DELAY(CLOSE,20),20,1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_151"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_151',
+ 'theme': ['momentum'],
+ 'formula_latex': 'sma(close-delay(close,20),20,1)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_151.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ out = _sma(c - c.shift(20), 20, 1)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_152.py b/agent/src/factors/zoo/gtja191/alpha_152.py
new file mode 100644
index 000000000..34fe6b90a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_152.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 152 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(MEAN(DELAY(SMA(DELAY(CLOSE/DELAY(CLOSE,9),1),9,1),1),12)-MEAN(DELAY(SMA(DELAY(CLOSE/DELAY(CLOSE,9),1),9,1),1),26),9,1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_152"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_152',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 26,
+ 'min_warmup_bars': 50,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_152.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ s = _sma(safe_div(c, c.shift(9)).shift(1), 9, 1).shift(1)
+ left = ts_mean(s, 12)
+ right = ts_mean(s, 26)
+ out = _sma(left - right, 9, 1)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_153.py b/agent/src/factors/zoo/gtja191/alpha_153.py
new file mode 100644
index 000000000..6829a56f2
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_153.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 153 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (MEAN(CLOSE,3)+MEAN(CLOSE,6)+MEAN(CLOSE,12)+MEAN(CLOSE,24))/4
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_153"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_153',
+ 'theme': ['momentum'],
+ 'formula_latex': '(mean(c,3)+mean(c,6)+mean(c,12)+mean(c,24))/4',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 24,
+ 'min_warmup_bars': 24,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_153.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ out = (ts_mean(c, 3) + ts_mean(c, 6) + ts_mean(c, 12) + ts_mean(c, 24)) / 4.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_154.py b/agent/src/factors/zoo/gtja191/alpha_154.py
new file mode 100644
index 000000000..2d803d939
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_154.py
@@ -0,0 +1,63 @@
+"""GTJA Alpha 154 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (((VWAP - MIN(VWAP,16))) < (CORR(VWAP, MEAN(VOLUME,180),18))) cast to float * -1 (binary indicator)
+
+Notes: Original returns boolean; we cast to float and multiply by -1.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_154"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_154',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 198,
+ 'notes': 'Original returns boolean; we cast to float and multiply by -1.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_154.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ left = vw - ts_min(vw, 16)
+ right = ts_corr(vw, ts_mean(v, 180), 18)
+ out = (left < right).astype("float64") * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_155.py b/agent/src/factors/zoo/gtja191/alpha_155.py
new file mode 100644
index 000000000..2a26bc28e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_155.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 155 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(VOLUME,13,2)-SMA(VOLUME,27,2)-SMA(SMA(VOLUME,13,2)-SMA(VOLUME,27,2),10,2)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_155"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_155',
+ 'theme': ['volume'],
+ 'formula_latex': 'sma(v,13,2)-sma(v,27,2)-sma(sma(v,13,2)-sma(v,27,2),10,2)',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 27,
+ 'min_warmup_bars': 40,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_155.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ m = _sma(v, 13, 2) - _sma(v, 27, 2)
+ out = m - _sma(m, 10, 2)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_156.py b/agent/src/factors/zoo/gtja191/alpha_156.py
new file mode 100644
index 000000000..be707042d
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_156.py
@@ -0,0 +1,68 @@
+"""GTJA Alpha 156 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MAX(RANK(DECAYLINEAR(DELTA(VWAP,5),3)), RANK(DECAYLINEAR((-1*((OPEN*0.15)+(LOW*0.85)) * DELTA(...,2)/((OPEN*0.15)+(LOW*0.85))),3)))*-1
+
+Notes: MAX elementwise -> np.maximum.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_156"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_156',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 10,
+ 'notes': 'MAX elementwise -> np.maximum.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_156.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ o = panel["open"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ a = rank(decay_linear(delta(vw, 5), 3))
+ mix = o * 0.15 + l * 0.85
+ b_inner = -1.0 * safe_div(delta(mix, 2), mix)
+ b = rank(decay_linear(b_inner, 3))
+ arr = np.maximum(a.to_numpy(dtype=np.float64, na_value=np.nan),
+ b.to_numpy(dtype=np.float64, na_value=np.nan))
+ out = pd.DataFrame(arr, index=a.index, columns=a.columns) * -1.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_157.py b/agent/src/factors/zoo/gtja191/alpha_157.py
new file mode 100644
index 000000000..08bbc087f
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_157.py
@@ -0,0 +1,68 @@
+"""GTJA Alpha 157 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (MIN(PROD(RANK(RANK(LOG(SUM(TSMIN(RANK(RANK((-1*RANK(DELTA((CLOSE-1),5))))),2),1)))),1),5) + TSRANK(DELAY((-1*RET),6),5))
+
+Notes: PROD(.,1) is identity; we use it directly.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_157"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_157',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 12,
+ 'notes': 'PROD(.,1) is identity; we use it directly.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_157.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ ret = safe_div(c, c.shift(1)) - 1.0
+ inner = -1.0 * rank(delta(c - 1.0, 5))
+ inner2 = rank(rank(inner))
+ inner3 = ts_min(inner2, 2).rolling(1).sum()
+ inner4 = np.log(inner3.replace(0.0, np.nan))
+ left = ts_min(rank(rank(inner4)), 5)
+ right = ts_rank((-1.0 * ret).shift(6), 5)
+ out = left + right
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_158.py b/agent/src/factors/zoo/gtja191/alpha_158.py
new file mode 100644
index 000000000..b11a3c134
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_158.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 158 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((HIGH-SMA(CLOSE,15,2))-(LOW-SMA(CLOSE,15,2)))/CLOSE
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_158"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_158',
+ 'theme': ['volatility'],
+ 'formula_latex': '((h-sma(c,15,2))-(l-sma(c,15,2)))/c',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 15,
+ 'min_warmup_bars': 16,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_158.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ s = _sma(c, 15, 2)
+ out = safe_div((h - s) - (l - s), c)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_159.py b/agent/src/factors/zoo/gtja191/alpha_159.py
new file mode 100644
index 000000000..7d64cb5cf
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_159.py
@@ -0,0 +1,76 @@
+"""GTJA Alpha 159 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((CLOSE-SUM(MIN(LOW,DELAY(CLOSE,1)),6))/SUM(MAX(HIGH,DELAY(CLOSE,1))-MIN(LOW,DELAY(CLOSE,1)),6))*12*24 + similar over 12 and 24 windows /(6*12+6*24+12*24)*100
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_159"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_159',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 24,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_159.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ prev = c.shift(1)
+ lo = pd.DataFrame(
+ np.minimum(l.to_numpy(dtype=np.float64, na_value=np.nan),
+ prev.to_numpy(dtype=np.float64, na_value=np.nan)),
+ index=c.index, columns=c.columns,
+ )
+ hi = pd.DataFrame(
+ np.maximum(h.to_numpy(dtype=np.float64, na_value=np.nan),
+ prev.to_numpy(dtype=np.float64, na_value=np.nan)),
+ index=c.index, columns=c.columns,
+ )
+ def _term(n):
+ return safe_div((c - lo.rolling(n).sum()), (hi - lo).rolling(n).sum())
+ out = ((_term(6) * 12.0 * 24.0) + (_term(12) * 6.0 * 24.0) + (_term(24) * 6.0 * 12.0)) / (6.0 * 12.0 + 6.0 * 24.0 + 12.0 * 24.0) * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_160.py b/agent/src/factors/zoo/gtja191/alpha_160.py
new file mode 100644
index 000000000..d71e85025
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_160.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 160 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA((CLOSE<=DELAY(CLOSE,1)?STD(CLOSE,20):0),20,1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_160"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_160',
+ 'theme': ['volatility'],
+ 'formula_latex': 'sma((c<=delay(c,1)?std(c,20):0),20,1)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 22,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_160.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ cond = (c <= c.shift(1)).astype("float64")
+ out = _sma(ts_std(c, 20) * cond, 20, 1)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_161.py b/agent/src/factors/zoo/gtja191/alpha_161.py
new file mode 100644
index 000000000..f71f93582
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_161.py
@@ -0,0 +1,69 @@
+"""GTJA Alpha 161 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MEAN(MAX(MAX(HIGH-LOW,ABS(DELAY(CLOSE,1)-HIGH)),ABS(DELAY(CLOSE,1)-LOW)),12)
+
+Notes: Average True Range (12).
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_161"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_161',
+ 'theme': ['volatility'],
+ 'formula_latex': 'mean(true_range,12)',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 13,
+ 'notes': 'Average True Range (12).',
+}
+
+
+def compute(panel):
+ """Compute gtja191_161.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ prev = c.shift(1)
+ a = (h - l).to_numpy(dtype=np.float64, na_value=np.nan)
+ b = (prev - h).abs().to_numpy(dtype=np.float64, na_value=np.nan)
+ d = (prev - l).abs().to_numpy(dtype=np.float64, na_value=np.nan)
+ tr = np.maximum(np.maximum(a, b), d)
+ tr_df = pd.DataFrame(tr, index=c.index, columns=c.columns)
+ out = ts_mean(tr_df, 12)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_162.py b/agent/src/factors/zoo/gtja191/alpha_162.py
new file mode 100644
index 000000000..c095da1cd
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_162.py
@@ -0,0 +1,66 @@
+"""GTJA Alpha 162 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (SMA(MAX(CLOSE-DELAY(CLOSE,1),0),12,1)/SMA(ABS(CLOSE-DELAY(CLOSE,1)),12,1)*100 - MIN(...,12)) / (MAX(...,12) - MIN(...,12))
+
+Notes: RSI-style normalised.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_162"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_162',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 24,
+ 'notes': 'RSI-style normalised.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_162.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ dc = c - c.shift(1)
+ rsi = safe_div(_sma(dc.clip(lower=0.0), 12, 1), _sma(dc.abs(), 12, 1)) * 100.0
+ out = safe_div(rsi - ts_min(rsi, 12), ts_max(rsi, 12) - ts_min(rsi, 12))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_163.py b/agent/src/factors/zoo/gtja191/alpha_163.py
new file mode 100644
index 000000000..e1663bbd8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_163.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 163 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ RANK(((((-1 * RET) * MEAN(VOLUME,20)) * VWAP) * (HIGH - CLOSE)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_163"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_163',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(((-1*ret)*mean(v,20))*vwap*(high-close))',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_163.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ ret = safe_div(c, c.shift(1)) - 1.0
+ out = rank(((-1.0 * ret) * ts_mean(v, 20)) * vw * (h - c))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_164.py b/agent/src/factors/zoo/gtja191/alpha_164.py
new file mode 100644
index 000000000..98d10187e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_164.py
@@ -0,0 +1,70 @@
+"""GTJA Alpha 164 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(((CLOSE>DELAY(CLOSE,1))?1/(CLOSE-DELAY(CLOSE,1)):1) - MIN(...,12))/(HIGH-LOW)*100, 13, 2)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_164"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_164',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 13,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_164.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ dc = c - c.shift(1)
+ inv = safe_div(pd.DataFrame(np.ones_like(c, dtype=np.float64), index=c.index, columns=c.columns), dc)
+ val = inv.where(dc > 0, 1.0)
+ x = safe_div(val - ts_min(val, 12), (h - l)) * 100.0
+ out = _sma(x, 13, 2)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_165.py b/agent/src/factors/zoo/gtja191/alpha_165.py
new file mode 100644
index 000000000..fd93d11fb
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_165.py
@@ -0,0 +1,63 @@
+"""GTJA Alpha 165 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MAX(SUMAC(CLOSE-MEAN(CLOSE,48))) - MIN(SUMAC(CLOSE-MEAN(CLOSE,48))) / STD(CLOSE,48)
+
+Notes: SUMAC = expanding cumulative sum approximated by rolling 48-day cumulative sum.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_165"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_165',
+ 'theme': ['volatility'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 48,
+ 'min_warmup_bars': 142,
+ 'notes': 'SUMAC = expanding cumulative sum approximated by rolling 48-day cumulative sum.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_165.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ dev = c - ts_mean(c, 48)
+ csum = dev.rolling(48).sum()
+ out = safe_div(ts_max(csum, 48) - ts_min(csum, 48), ts_std(c, 48))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_166.py b/agent/src/factors/zoo/gtja191/alpha_166.py
new file mode 100644
index 000000000..cc202a95b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_166.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 166 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ -20*(20-1)^1.5*SUM(CLOSE/DELAY(CLOSE,1)-1-MEAN(CLOSE/DELAY(CLOSE,1)-1,20),20)/((20-1)*(20-2)*(SUM((CLOSE/DELAY(CLOSE,1)-1)^2,20))^1.5)
+
+Notes: Skewness-style; constants from report.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_166"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_166',
+ 'theme': ['volatility'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 40,
+ 'notes': 'Skewness-style; constants from report.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_166.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ ret = safe_div(c, c.shift(1)) - 1.0
+ m = ts_mean(ret, 20)
+ num = (ret - m).rolling(20).sum() * -20.0 * (20.0 - 1.0) ** 1.5
+ den = (20.0 - 1.0) * (20.0 - 2.0) * (ret ** 2).rolling(20).sum() ** 1.5
+ out = safe_div(num, den)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_167.py b/agent/src/factors/zoo/gtja191/alpha_167.py
new file mode 100644
index 000000000..e9e4f51ed
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_167.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 167 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SUM((CLOSE-DELAY(CLOSE,1)>0?CLOSE-DELAY(CLOSE,1):0),12)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_167"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_167',
+ 'theme': ['momentum'],
+ 'formula_latex': 'sum(max(0,c-delay(c,1)),12)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 13,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_167.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ out = (c - c.shift(1)).clip(lower=0.0).rolling(12).sum()
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_168.py b/agent/src/factors/zoo/gtja191/alpha_168.py
new file mode 100644
index 000000000..e4c7daad9
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_168.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 168 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (-1*VOLUME/MEAN(VOLUME,20))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_168"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_168',
+ 'theme': ['volume'],
+ 'formula_latex': '-1*volume/mean(volume,20)',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_168.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = -1.0 * safe_div(v, ts_mean(v, 20))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_169.py b/agent/src/factors/zoo/gtja191/alpha_169.py
new file mode 100644
index 000000000..56d50fc7b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_169.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 169 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA(MEAN(DELAY(SMA(CLOSE-DELAY(CLOSE,1),9,1),1),12)-MEAN(DELAY(SMA(CLOSE-DELAY(CLOSE,1),9,1),1),26),10,1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_169"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_169',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 26,
+ 'min_warmup_bars': 50,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_169.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ s = _sma(c - c.shift(1), 9, 1).shift(1)
+ out = _sma(ts_mean(s, 12) - ts_mean(s, 26), 10, 1)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_170.py b/agent/src/factors/zoo/gtja191/alpha_170.py
new file mode 100644
index 000000000..d1dc58e1a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_170.py
@@ -0,0 +1,66 @@
+"""GTJA Alpha 170 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((((RANK((1/CLOSE))*VOLUME)/MEAN(VOLUME,20)) * ((HIGH * RANK((HIGH-CLOSE))) / (SUM(HIGH,5)/5))) - RANK((VWAP - DELAY(VWAP,5))))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_170"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_170',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_170.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ a = safe_div(rank(safe_div(pd.DataFrame(1.0, index=c.index, columns=c.columns), c)) * v, ts_mean(v, 20))
+ b = safe_div(h * rank(h - c), c.rolling(5).sum() / 5.0)
+ d = rank(vw - vw.shift(5))
+ out = a * b - d
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_171.py b/agent/src/factors/zoo/gtja191/alpha_171.py
new file mode 100644
index 000000000..a956b7b8e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_171.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 171 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((-1*((LOW-CLOSE)*(OPEN^5)))/((CLOSE-HIGH)*(CLOSE^5)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_171"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_171',
+ 'theme': ['microstructure'],
+ 'formula_latex': '-1*((l-c)*(o^5))/((c-h)*(c^5))',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_171.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ o = panel["open"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ out = safe_div(-1.0 * ((l - c) * (o ** 5)), (c - h) * (c ** 5))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_172.py b/agent/src/factors/zoo/gtja191/alpha_172.py
new file mode 100644
index 000000000..d455a04a5
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_172.py
@@ -0,0 +1,78 @@
+"""GTJA Alpha 172 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MEAN(ABS(SUM((LD>0 & LD>HD)?LD:0,14)*100/SUM(TR,14) - SUM((HD>0 & HD>LD)?HD:0,14)*100/SUM(TR,14)) / (SUM(...same...)/SUM(...same...))*100, 6)
+
+Notes: Wilder's ADX-style indicator; mean over last 6 bars.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_172"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_172',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 14,
+ 'min_warmup_bars': 20,
+ 'notes': "Wilder's ADX-style indicator; mean over last 6 bars.",
+}
+
+
+def compute(panel):
+ """Compute gtja191_172.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ HD = h - h.shift(1)
+ LD = l.shift(1) - l
+ prev = c.shift(1)
+ a = (h - l).to_numpy(dtype=np.float64, na_value=np.nan)
+ b = (prev - h).abs().to_numpy(dtype=np.float64, na_value=np.nan)
+ d = (prev - l).abs().to_numpy(dtype=np.float64, na_value=np.nan)
+ TR = pd.DataFrame(np.maximum(np.maximum(a, b), d), index=c.index, columns=c.columns)
+ ld_cond = ((LD > 0) & (LD > HD)).astype("float64")
+ hd_cond = ((HD > 0) & (HD > LD)).astype("float64")
+ dm_plus = (LD * ld_cond).rolling(14).sum() * 100.0
+ dm_minus = (HD * hd_cond).rolling(14).sum() * 100.0
+ tr14 = TR.rolling(14).sum()
+ di_p = safe_div(dm_plus, tr14)
+ di_m = safe_div(dm_minus, tr14)
+ dx = safe_div((di_p - di_m).abs(), di_p + di_m) * 100.0
+ out = ts_mean(dx, 6)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_173.py b/agent/src/factors/zoo/gtja191/alpha_173.py
new file mode 100644
index 000000000..512e8d15c
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_173.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 173 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ 3*SMA(CLOSE,13,2)-2*SMA(SMA(CLOSE,13,2),13,2)+SMA(SMA(SMA(LOG(CLOSE),13,2),13,2),13,2)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_173"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_173',
+ 'theme': ['momentum'],
+ 'formula_latex': '3*sma(c,13,2)-2*sma(sma(c,13,2),13,2)+sma(sma(sma(log(c),13,2),13,2),13,2)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 13,
+ 'min_warmup_bars': 40,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_173.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ s1 = _sma(c, 13, 2)
+ s2 = _sma(s1, 13, 2)
+ s3 = _sma(_sma(_sma(np.log(c), 13, 2), 13, 2), 13, 2)
+ out = 3.0 * s1 - 2.0 * s2 + s3
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_174.py b/agent/src/factors/zoo/gtja191/alpha_174.py
new file mode 100644
index 000000000..3e03c52d1
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_174.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 174 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SMA((CLOSE>DELAY(CLOSE,1)?STD(CLOSE,20):0),20,1)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_174"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_174',
+ 'theme': ['volatility'],
+ 'formula_latex': 'sma((c>delay(c,1)?std(c,20):0),20,1)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 22,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_174.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ cond = (c > c.shift(1)).astype("float64")
+ out = _sma(ts_std(c, 20) * cond, 20, 1)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_175.py b/agent/src/factors/zoo/gtja191/alpha_175.py
new file mode 100644
index 000000000..bc241f53e
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_175.py
@@ -0,0 +1,69 @@
+"""GTJA Alpha 175 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MEAN(MAX(MAX(HIGH-LOW,ABS(DELAY(CLOSE,1)-HIGH)),ABS(DELAY(CLOSE,1)-LOW)),6)
+
+Notes: ATR(6).
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_175"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_175',
+ 'theme': ['volatility'],
+ 'formula_latex': 'mean(true_range,6)',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 6,
+ 'min_warmup_bars': 7,
+ 'notes': 'ATR(6).',
+}
+
+
+def compute(panel):
+ """Compute gtja191_175.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ prev = c.shift(1)
+ a = (h - l).to_numpy(dtype=np.float64, na_value=np.nan)
+ b = (prev - h).abs().to_numpy(dtype=np.float64, na_value=np.nan)
+ d = (prev - l).abs().to_numpy(dtype=np.float64, na_value=np.nan)
+ tr = np.maximum(np.maximum(a, b), d)
+ tr_df = pd.DataFrame(tr, index=c.index, columns=c.columns)
+ out = ts_mean(tr_df, 6)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_176.py b/agent/src/factors/zoo/gtja191/alpha_176.py
new file mode 100644
index 000000000..4d57b634b
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_176.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 176 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ CORR(RANK(((CLOSE-TSMIN(LOW,12))/(TSMAX(HIGH,12)-TSMIN(LOW,12)))),RANK(VOLUME),6)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_176"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_176',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 12,
+ 'min_warmup_bars': 18,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_176.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ ll = ts_min(l, 12)
+ hh = ts_max(h, 12)
+ pos = safe_div(c - ll, hh - ll)
+ out = ts_corr(rank(pos), rank(v), 6)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_177.py b/agent/src/factors/zoo/gtja191/alpha_177.py
new file mode 100644
index 000000000..6331b1907
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_177.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 177 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((20-HIGHDAY(HIGH,20))/20)*100
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_177"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_177',
+ 'theme': ['momentum'],
+ 'formula_latex': '((20-highday(h,20))/20)*100',
+ 'columns_required': ['close', 'high'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_177.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ h = panel["high"]
+ vw = vwap(panel, "equity_cn")
+
+ out = (20.0 - ts_argmax(h, 20)) / 20.0 * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_178.py b/agent/src/factors/zoo/gtja191/alpha_178.py
new file mode 100644
index 000000000..e0003b7d2
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_178.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 178 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (CLOSE-DELAY(CLOSE,1))/DELAY(CLOSE,1)*VOLUME
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_178"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_178',
+ 'theme': ['momentum', 'volume'],
+ 'formula_latex': '(c-delay(c,1))/delay(c,1)*v',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 2,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_178.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = safe_div(c - c.shift(1), c.shift(1)) * v
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_179.py b/agent/src/factors/zoo/gtja191/alpha_179.py
new file mode 100644
index 000000000..f88d9fd48
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_179.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 179 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ RANK(CORR(VWAP,VOLUME,4))*RANK(CORR(RANK(LOW),RANK(MEAN(VOLUME,50)),12))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_179"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_179',
+ 'theme': ['volume'],
+ 'formula_latex': 'rank(corr(vwap,v,4))*rank(corr(rank(low),rank(mean(v,50)),12))',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume', 'amount'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 50,
+ 'min_warmup_bars': 62,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_179.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = rank(ts_corr(vw, v, 4)) * rank(ts_corr(rank(l), rank(ts_mean(v, 50)), 12))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_180.py b/agent/src/factors/zoo/gtja191/alpha_180.py
new file mode 100644
index 000000000..eea6196b1
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_180.py
@@ -0,0 +1,65 @@
+"""GTJA Alpha 180 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((MEAN(VOLUME,20) < VOLUME) ? ((-1*TSRANK(ABS(DELTA(CLOSE,7)),60)) * SIGN(DELTA(CLOSE,7))) : (-1*VOLUME))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_180"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_180',
+ 'theme': ['volume', 'reversal'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 67,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_180.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ big = (ts_mean(v, 20) < v).astype("float64")
+ left = -1.0 * ts_rank(delta(c, 7).abs(), 60) * np.sign(delta(c, 7))
+ right = -1.0 * v
+ out = left * big + right * (1.0 - big)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_181.py b/agent/src/factors/zoo/gtja191/alpha_181.py
new file mode 100644
index 000000000..f45f685fd
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_181.py
@@ -0,0 +1,77 @@
+"""GTJA Alpha 181 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SUM(((CLOSE/DELAY(CLOSE,1)-1)-MEAN(CLOSE/DELAY(CLOSE,1)-1,20))-(BENCH-MEAN(BENCH,20))^2,20)/SUM((BENCH-MEAN(BENCH,20))^3,20)
+
+Notes: Benchmark falls back to cross-sectional mean of close.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_181"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_181',
+ 'theme': ['volatility'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 40,
+ 'notes': 'Benchmark falls back to cross-sectional mean of close.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_181.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _bench_close():
+ """Benchmark close fallback: cross-sectional mean of `close`."""
+ if "benchmark_close" in panel:
+ return panel["benchmark_close"]
+ c = panel["close"]
+ return pd.DataFrame(
+ np.tile(c.mean(axis=1).to_numpy().reshape(-1, 1), (1, c.shape[1])),
+ index=c.index,
+ columns=c.columns,
+ )
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ bench = _bench_close()
+ br = safe_div(bench, bench.shift(1)) - 1.0
+ cr = safe_div(c, c.shift(1)) - 1.0
+ diff = (cr - ts_mean(cr, 20)) - (br - ts_mean(br, 20)) ** 2
+ num = diff.rolling(20).sum()
+ den = ((br - ts_mean(br, 20)) ** 3).rolling(20).sum()
+ out = safe_div(num, den)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_182.py b/agent/src/factors/zoo/gtja191/alpha_182.py
new file mode 100644
index 000000000..6efd028a8
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_182.py
@@ -0,0 +1,76 @@
+"""GTJA Alpha 182 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ COUNT((CLOSE>OPEN & BENCH>DELAY(BENCH,1)) | (CLOSE<OPEN & BENCH<DELAY(BENCH,1)), 20) / 20
+
+Notes: Benchmark falls back to cross-sectional mean of close.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_182"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_182',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 21,
+ 'notes': 'Benchmark falls back to cross-sectional mean of close.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_182.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _bench_close():
+ """Benchmark close fallback: cross-sectional mean of `close`."""
+ if "benchmark_close" in panel:
+ return panel["benchmark_close"]
+ c = panel["close"]
+ return pd.DataFrame(
+ np.tile(c.mean(axis=1).to_numpy().reshape(-1, 1), (1, c.shape[1])),
+ index=c.index,
+ columns=c.columns,
+ )
+ c = panel["close"]
+ o = panel["open"]
+ vw = vwap(panel, "equity_cn")
+
+ bench = _bench_close()
+ up = ((c > o) & (bench > bench.shift(1)))
+ dn = ((c < o) & (bench < bench.shift(1)))
+ cond = (up | dn).astype("float64")
+ out = cond.rolling(20).sum() / 20.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_183.py b/agent/src/factors/zoo/gtja191/alpha_183.py
new file mode 100644
index 000000000..2aa9511b7
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_183.py
@@ -0,0 +1,63 @@
+"""GTJA Alpha 183 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MAX(SUMAC(CLOSE-MEAN(CLOSE,24))) - MIN(SUMAC(CLOSE-MEAN(CLOSE,24))) / STD(CLOSE,24)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_183"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_183',
+ 'theme': ['volatility'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 24,
+ 'min_warmup_bars': 70,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_183.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ dev = c - ts_mean(c, 24)
+ csum = dev.rolling(24).sum()
+ out = safe_div(ts_max(csum, 24) - ts_min(csum, 24), ts_std(c, 24))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_184.py b/agent/src/factors/zoo/gtja191/alpha_184.py
new file mode 100644
index 000000000..5048cd82a
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_184.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 184 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (RANK(CORR(DELAY((OPEN - CLOSE), 1), CLOSE, 200)) + RANK((OPEN - CLOSE)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_184"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_184',
+ 'theme': ['reversal'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 202,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_184.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ o = panel["open"]
+ vw = vwap(panel, "equity_cn")
+
+ left = rank(ts_corr((o - c).shift(1), c, 200))
+ right = rank(o - c)
+ out = left + right
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_185.py b/agent/src/factors/zoo/gtja191/alpha_185.py
new file mode 100644
index 000000000..e9f31899f
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_185.py
@@ -0,0 +1,62 @@
+"""GTJA Alpha 185 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ RANK((-1*((1-(OPEN/CLOSE))^2)))
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_185"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_185',
+ 'theme': ['reversal'],
+ 'formula_latex': 'rank(-1*(1-open/close)^2)',
+ 'columns_required': ['open', 'close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_185.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ o = panel["open"]
+ vw = vwap(panel, "equity_cn")
+
+ out = rank(-1.0 * (1.0 - safe_div(o, c)) ** 2)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_186.py b/agent/src/factors/zoo/gtja191/alpha_186.py
new file mode 100644
index 000000000..6f6a34f9d
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_186.py
@@ -0,0 +1,79 @@
+"""GTJA Alpha 186 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (MEAN(ABS(SUM((LD>0 & LD>HD)?LD:0,14)*100/SUM(TR,14)-SUM((HD>0 & HD>LD)?HD:0,14)*100/SUM(TR,14))/(...)*100,6)+DELAY(...,6))/2
+
+Notes: alpha172 averaged with its 6-day lag.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_186"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_186',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body (alpha172 averaged with its 6-day lag)',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 14,
+ 'min_warmup_bars': 27,
+ 'notes': 'alpha172 averaged with its 6-day lag.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_186.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ HD = h - h.shift(1)
+ LD = l.shift(1) - l
+ prev = c.shift(1)
+ a = (h - l).to_numpy(dtype=np.float64, na_value=np.nan)
+ b = (prev - h).abs().to_numpy(dtype=np.float64, na_value=np.nan)
+ d = (prev - l).abs().to_numpy(dtype=np.float64, na_value=np.nan)
+ TR = pd.DataFrame(np.maximum(np.maximum(a, b), d), index=c.index, columns=c.columns)
+ ld_cond = ((LD > 0) & (LD > HD)).astype("float64")
+ hd_cond = ((HD > 0) & (HD > LD)).astype("float64")
+ dm_plus = (LD * ld_cond).rolling(14).sum() * 100.0
+ dm_minus = (HD * hd_cond).rolling(14).sum() * 100.0
+ tr14 = TR.rolling(14).sum()
+ di_p = safe_div(dm_plus, tr14)
+ di_m = safe_div(dm_minus, tr14)
+ dx = safe_div((di_p - di_m).abs(), di_p + di_m) * 100.0
+ a172 = ts_mean(dx, 6)
+ out = (a172 + a172.shift(6)) / 2.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_187.py b/agent/src/factors/zoo/gtja191/alpha_187.py
new file mode 100644
index 000000000..5dcc4ec02
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_187.py
@@ -0,0 +1,68 @@
+"""GTJA Alpha 187 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ SUM((OPEN<=DELAY(OPEN,1) ? 0 : MAX(HIGH-OPEN, OPEN-DELAY(OPEN,1))), 20)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_187"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_187',
+ 'theme': ['reversal'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 21,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_187.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ o = panel["open"]
+ h = panel["high"]
+ vw = vwap(panel, "equity_cn")
+
+ prev = o.shift(1)
+ cond = (o <= prev).astype("float64")
+ arr_a = (h - o).to_numpy(dtype=np.float64, na_value=np.nan)
+ arr_b = (o - prev).to_numpy(dtype=np.float64, na_value=np.nan)
+ mx = pd.DataFrame(np.maximum(arr_a, arr_b), index=o.index, columns=o.columns)
+ val = mx * (1.0 - cond)
+ out = val.rolling(20).sum()
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_188.py b/agent/src/factors/zoo/gtja191/alpha_188.py
new file mode 100644
index 000000000..b48f3fea0
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_188.py
@@ -0,0 +1,67 @@
+"""GTJA Alpha 188 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ (HIGH-LOW-SMA(HIGH-LOW,11,2))/SMA(HIGH-LOW,11,2)*100
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_188"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_188',
+ 'theme': ['volatility'],
+ 'formula_latex': '(h-l-sma(h-l,11,2))/sma(h-l,11,2)*100',
+ 'columns_required': ['close', 'high', 'low'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 11,
+ 'min_warmup_bars': 13,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_188.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ def _sma(x, n, m):
+ """SMA(x, n, m) per GTJA convention -> ewm with alpha = m/n."""
+ return x.ewm(alpha=m / n, adjust=False).mean()
+ h = panel["high"]
+ l = panel["low"]
+ vw = vwap(panel, "equity_cn")
+
+ hl = h - l
+ s = _sma(hl, 11, 2)
+ out = safe_div(hl - s, s) * 100.0
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_189.py b/agent/src/factors/zoo/gtja191/alpha_189.py
new file mode 100644
index 000000000..3c0dca576
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_189.py
@@ -0,0 +1,61 @@
+"""GTJA Alpha 189 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ MEAN(ABS(CLOSE-MEAN(CLOSE,6)),6)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_189"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_189',
+ 'theme': ['volatility'],
+ 'formula_latex': 'mean(abs(c-mean(c,6)),6)',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 6,
+ 'min_warmup_bars': 12,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_189.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ out = ts_mean((c - ts_mean(c, 6)).abs(), 6)
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_190.py b/agent/src/factors/zoo/gtja191/alpha_190.py
new file mode 100644
index 000000000..3fe54e239
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_190.py
@@ -0,0 +1,69 @@
+"""GTJA Alpha 190 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ LOG((COUNT(CLOSE/DELAY(CLOSE,1)-1>(CLOSE/DELAY(CLOSE,19))^(1/20)-1,20) - 1) * SUMIF((CLOSE/DELAY(CLOSE,1)-1-(CLOSE/DELAY(CLOSE,19))^(1/20)-1)^2, ..., 20) / ((COUNT(...) ) * SUMIF(..., ..., 20)))
+
+Notes: Complex log of ratio of conditional squared deviations.
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_190"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_190',
+ 'theme': ['momentum'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['close'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 39,
+ 'notes': 'Complex log of ratio of conditional squared deviations.',
+}
+
+
+def compute(panel):
+ """Compute gtja191_190.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ vw = vwap(panel, "equity_cn")
+
+ ret = safe_div(c, c.shift(1)) - 1.0
+ geo = signed_power(safe_div(c, c.shift(19)), 1.0 / 20.0) - 1.0
+ cond_up = (ret > geo).astype("float64")
+ cond_dn = (ret < geo).astype("float64")
+ cnt_up = cond_up.rolling(20).sum() - 1.0
+ cnt_dn = cond_dn.rolling(20).sum()
+ sumif_dn = (((ret - geo) ** 2) * cond_dn).rolling(20).sum()
+ sumif_up = (((ret - geo) ** 2) * cond_up).rolling(20).sum()
+ out = np.log(safe_div(cnt_up * sumif_dn, cnt_dn * sumif_up).replace([0, np.inf, -np.inf], np.nan))
+ return out
diff --git a/agent/src/factors/zoo/gtja191/alpha_191.py b/agent/src/factors/zoo/gtja191/alpha_191.py
new file mode 100644
index 000000000..90e97f5e9
--- /dev/null
+++ b/agent/src/factors/zoo/gtja191/alpha_191.py
@@ -0,0 +1,64 @@
+"""GTJA Alpha 191 (国泰君安 191 短周期交易型 alpha 因子, 2014).
+
+Formula (verbatim from the report):
+ ((CORR(MEAN(VOLUME,20), LOW, 5) + ((HIGH + LOW) / 2)) - CLOSE)
+
+Notes:
+"""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+
+from src.factors.base import (
+ decay_linear,
+ delta,
+ rank,
+ safe_div,
+ scale,
+ signed_power,
+ ts_argmax,
+ ts_argmin,
+ ts_corr,
+ ts_cov,
+ ts_max,
+ ts_mean,
+ ts_min,
+ ts_rank,
+ ts_std,
+ vwap,
+)
+
+ALPHA_ID = "gtja191_191"
+
+__alpha_meta__ = {
+ 'id': 'gtja191_191',
+ 'theme': ['volume'],
+ 'formula_latex': 'see body',
+ 'columns_required': ['open', 'high', 'low', 'close', 'volume'],
+ 'extras_required': [],
+ 'universe': ['equity_cn'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 25,
+ 'notes': '',
+}
+
+
+def compute(panel):
+ """Compute gtja191_191.
+
+ Args:
+ panel: dict[str, pd.DataFrame] with at least the required columns.
+
+ Returns:
+ pd.DataFrame with index = panel["close"].index, columns = panel["close"].columns.
+ """
+ c = panel["close"]
+ h = panel["high"]
+ l = panel["low"]
+ v = panel["volume"]
+ vw = vwap(panel, "equity_cn")
+
+ out = (ts_corr(ts_mean(v, 20), l, 5) + (h + l) / 2.0) - c
+ return out
diff --git a/agent/src/factors/zoo/qlib158/LICENSE.md b/agent/src/factors/zoo/qlib158/LICENSE.md
new file mode 100644
index 000000000..50042d187
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/LICENSE.md
@@ -0,0 +1,72 @@
+# qlib158 zoo — license & attribution
+
+This subpackage (`agent/src/factors/zoo/qlib158/`) is a clean-room re-expression
+of the **Alpha158** feature set defined by Microsoft's
+[`qlib`](https://github.com/microsoft/qlib) project. Specifically, the field
+catalogue and per-window combinations were taken from:
+
+- **Upstream repo:** https://github.com/microsoft/qlib
+- **Upstream license:** Apache License, Version 2.0
+- **Pinned commit:** `d5379c520f66a39953bad76234a7019a72796fd0`
+- **Pinned path:** `qlib/contrib/data/handler.py` (class `Alpha158`) and
+ `qlib/contrib/data/loader.py` (class `Alpha158DL`)
+
+Per-file headers in every `*.py` in this directory cite the same commit and
+path, e.g.:
+
+```
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+```
+
+## Scope of attribution
+
+Apache-2.0 §4 requires us to (a) provide a copy of the License (the upstream
+`LICENSE` is published at
+<https://github.com/microsoft/qlib/blob/main/LICENSE>), (b) note prominently
+that we modified the files, and (c) retain copyright / patent / trademark /
+attribution notices from the source. The headers above satisfy (b) and (c);
+this `LICENSE.md` plus the sibling `NOTICE` satisfy (a) and §4(d).
+
+## What is "the work"?
+
+The mathematical formulas for individual alpha features (e.g. `KMID = (close
+- open) / open`, `MA5 = mean(close, 5) / close`) are facts of arithmetic and
+not themselves subject to copyright. What we adapt from `qlib` is the
+**curated catalogue**: the choice of which 9 K-bar features + 29 rolling
+features × 5 windows to bundle together as "Alpha158", and the canonical
+short names (KMID, KLEN, ROC, MA, …). That curation is the creative
+contribution, and we attribute it accordingly.
+
+The Python implementations in this directory are **re-written from scratch**
+on top of `src.factors.base` operators — they do not copy any source code
+from `qlib`. Differences from the upstream:
+
+- We use a wide-DataFrame panel (`index=date, columns=instrument`) rather
+ than `qlib`'s long-format expression tree.
+- We compute on a `dict[str, pd.DataFrame]` panel passed to a pure
+ `compute(panel)` function; no expression compiler, no caching layer.
+- Division is routed through `safe_div` (epsilon-guarded, never silent inf).
+- Look-ahead is forbidden at the operator level (`delta(d)` requires
+ `d >= 1`); we do not expose `Ref(_, -n)`.
+
+## Intentionally skipped fields
+
+`Alpha158` in upstream `qlib` also includes 4 plain price reference features
+(`OPEN`, `HIGH`, `LOW`, `VWAP` at window 0) that are *not* alpha signals —
+they are raw inputs duplicated for downstream feature engineering. We do
+not port them because (i) they would conflict with the wide-DataFrame panel
+contract (output shape == close shape, raw price is already in `panel`), and
+(ii) they offer no signal beyond the inputs. This brings the count to
+9 + 29×5 = **154 alphas**.
+
+No other Alpha158 field is skipped.
+
+## Coverage summary
+
+| Family | Count | Stems |
+|----------|-------|-------|
+| K-bar | 9 | kmid, klen, kmid2, kup, kup2, klow, klow2, ksft, ksft2 |
+| Rolling | 145 | (roc, ma, std, beta, rsqr, resi, max, min, qtlu, qtld, rank, rsv, imax, imin, imxd, corr, cord, cntp, cntn, cntd, sump, sumn, sumd, vma, vstd, wvma, vsump, vsumn, vsumd) × {5, 10, 20, 30, 60} |
+| Skipped | 4 | OPEN/HIGH/LOW/VWAP (price reference inputs, see above) |
+| **Total**| **154** | |
diff --git a/agent/src/factors/zoo/qlib158/NOTICE b/agent/src/factors/zoo/qlib158/NOTICE
new file mode 100644
index 000000000..9ed76d845
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/NOTICE
@@ -0,0 +1,29 @@
+Vibe-Trading qlib158 zoo
+========================
+
+This subpackage adapts the Alpha158 feature catalogue from:
+
+ Microsoft Qlib — https://github.com/microsoft/qlib
+ Pinned commit: d5379c520f66a39953bad76234a7019a72796fd0
+ Pinned path: qlib/contrib/data/handler.py (class Alpha158)
+ qlib/contrib/data/loader.py (class Alpha158DL)
+ License: Apache License, Version 2.0
+ Copyright: (c) Microsoft Corporation. All rights reserved.
+
+Per Apache-2.0 §4(d): the upstream microsoft/qlib repository does not ship
+a NOTICE file at its repository root (verified against the pinned commit
+above via `gh api repos/microsoft/qlib/contents`). There are therefore no
+upstream NOTICE attribution lines to reproduce here. This file exists to
+record that absence explicitly and to provide a stable attribution surface
+for downstream consumers per §4(d) ("If the Work includes a 'NOTICE' text
+file as part of its distribution …"). The Work as redistributed by us does
+not include such a file from the upstream; only the upstream LICENSE
+applies, copies of which are referenced from LICENSE.md.
+
+Modifications by Vibe-Trading
+-----------------------------
+
+The Python implementations in this directory are re-written from scratch on
+top of `src.factors.base` operators; no source code is copied from qlib.
+Per-file headers cite the upstream commit and path. See `LICENSE.md` for
+full attribution scope and the list of intentionally skipped fields.
diff --git a/agent/src/factors/zoo/qlib158/__init__.py b/agent/src/factors/zoo/qlib158/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/agent/src/factors/zoo/qlib158/beta10.py b/agent/src/factors/zoo/qlib158/beta10.py
new file mode 100644
index 000000000..84d7872fa
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/beta10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 BETA10: formula = (\\mathrm{close}_t - \\mathrm{close}_{{t-10}}) / (10\\,\\mathrm{close})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, delta
+
+__alpha_meta__ = {
+ 'id': 'qlib158_beta10',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close}_t - \\\\mathrm{close}_{{t-10}}) / (10\\\\,\\\\mathrm{close})',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 BETA10 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(delta(c, 10), c) / float(10)
diff --git a/agent/src/factors/zoo/qlib158/beta20.py b/agent/src/factors/zoo/qlib158/beta20.py
new file mode 100644
index 000000000..2f7bb0be0
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/beta20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 BETA20: formula = (\\mathrm{close}_t - \\mathrm{close}_{{t-20}}) / (20\\,\\mathrm{close})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, delta
+
+__alpha_meta__ = {
+ 'id': 'qlib158_beta20',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close}_t - \\\\mathrm{close}_{{t-20}}) / (20\\\\,\\\\mathrm{close})',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 BETA20 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(delta(c, 20), c) / float(20)
diff --git a/agent/src/factors/zoo/qlib158/beta30.py b/agent/src/factors/zoo/qlib158/beta30.py
new file mode 100644
index 000000000..db808e4d8
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/beta30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 BETA30: formula = (\\mathrm{close}_t - \\mathrm{close}_{{t-30}}) / (30\\,\\mathrm{close})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, delta
+
+__alpha_meta__ = {
+ 'id': 'qlib158_beta30',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close}_t - \\\\mathrm{close}_{{t-30}}) / (30\\\\,\\\\mathrm{close})',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 BETA30 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(delta(c, 30), c) / float(30)
diff --git a/agent/src/factors/zoo/qlib158/beta5.py b/agent/src/factors/zoo/qlib158/beta5.py
new file mode 100644
index 000000000..7796a2ec6
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/beta5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 BETA5: formula = (\\mathrm{close}_t - \\mathrm{close}_{{t-5}}) / (5\\,\\mathrm{close})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, delta
+
+__alpha_meta__ = {
+ 'id': 'qlib158_beta5',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close}_t - \\\\mathrm{close}_{{t-5}}) / (5\\\\,\\\\mathrm{close})',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 BETA5 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(delta(c, 5), c) / float(5)
diff --git a/agent/src/factors/zoo/qlib158/beta60.py b/agent/src/factors/zoo/qlib158/beta60.py
new file mode 100644
index 000000000..a68c9b08c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/beta60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 BETA60: formula = (\\mathrm{close}_t - \\mathrm{close}_{{t-60}}) / (60\\,\\mathrm{close})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, delta
+
+__alpha_meta__ = {
+ 'id': 'qlib158_beta60',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close}_t - \\\\mathrm{close}_{{t-60}}) / (60\\\\,\\\\mathrm{close})',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 BETA60 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(delta(c, 60), c) / float(60)
diff --git a/agent/src/factors/zoo/qlib158/cntd10.py b/agent/src/factors/zoo/qlib158/cntd10.py
new file mode 100644
index 000000000..7c45b8bf0
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntd10.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTD10: formula = \\mathrm{CNTP}_10 - \\mathrm{CNTN}_10."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntd10',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{CNTP}_10 - \\\\mathrm{CNTN}_10',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTD10 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ dn = (c < c.shift(1)).astype('float64')
+ up_w = up.rolling(window=10, min_periods=10).mean()
+ dn_w = dn.rolling(window=10, min_periods=10).mean()
+ return up_w - dn_w
diff --git a/agent/src/factors/zoo/qlib158/cntd20.py b/agent/src/factors/zoo/qlib158/cntd20.py
new file mode 100644
index 000000000..e3d266421
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntd20.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTD20: formula = \\mathrm{CNTP}_20 - \\mathrm{CNTN}_20."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntd20',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{CNTP}_20 - \\\\mathrm{CNTN}_20',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTD20 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ dn = (c < c.shift(1)).astype('float64')
+ up_w = up.rolling(window=20, min_periods=20).mean()
+ dn_w = dn.rolling(window=20, min_periods=20).mean()
+ return up_w - dn_w
diff --git a/agent/src/factors/zoo/qlib158/cntd30.py b/agent/src/factors/zoo/qlib158/cntd30.py
new file mode 100644
index 000000000..586521af8
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntd30.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTD30: formula = \\mathrm{CNTP}_30 - \\mathrm{CNTN}_30."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntd30',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{CNTP}_30 - \\\\mathrm{CNTN}_30',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTD30 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ dn = (c < c.shift(1)).astype('float64')
+ up_w = up.rolling(window=30, min_periods=30).mean()
+ dn_w = dn.rolling(window=30, min_periods=30).mean()
+ return up_w - dn_w
diff --git a/agent/src/factors/zoo/qlib158/cntd5.py b/agent/src/factors/zoo/qlib158/cntd5.py
new file mode 100644
index 000000000..bc54e0a1e
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntd5.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTD5: formula = \\mathrm{CNTP}_5 - \\mathrm{CNTN}_5."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntd5',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{CNTP}_5 - \\\\mathrm{CNTN}_5',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTD5 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ dn = (c < c.shift(1)).astype('float64')
+ up_w = up.rolling(window=5, min_periods=5).mean()
+ dn_w = dn.rolling(window=5, min_periods=5).mean()
+ return up_w - dn_w
diff --git a/agent/src/factors/zoo/qlib158/cntd60.py b/agent/src/factors/zoo/qlib158/cntd60.py
new file mode 100644
index 000000000..aaf6221b3
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntd60.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTD60: formula = \\mathrm{CNTP}_60 - \\mathrm{CNTN}_60."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntd60',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{CNTP}_60 - \\\\mathrm{CNTN}_60',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTD60 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ dn = (c < c.shift(1)).astype('float64')
+ up_w = up.rolling(window=60, min_periods=60).mean()
+ dn_w = dn.rolling(window=60, min_periods=60).mean()
+ return up_w - dn_w
diff --git a/agent/src/factors/zoo/qlib158/cntn10.py b/agent/src/factors/zoo/qlib158/cntn10.py
new file mode 100644
index 000000000..99887b855
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntn10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTN10: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}<\\mathrm{close}_{{-1}}], 10)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntn10',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}<\\\\mathrm{close}_{{-1}}], 10)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTN10 on the supplied OHLCV panel."""
+ c = panel['close']
+ dn = (c < c.shift(1)).astype('float64')
+ return dn.rolling(window=10, min_periods=10).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntn20.py b/agent/src/factors/zoo/qlib158/cntn20.py
new file mode 100644
index 000000000..09e2f135b
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntn20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTN20: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}<\\mathrm{close}_{{-1}}], 20)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntn20',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}<\\\\mathrm{close}_{{-1}}], 20)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTN20 on the supplied OHLCV panel."""
+ c = panel['close']
+ dn = (c < c.shift(1)).astype('float64')
+ return dn.rolling(window=20, min_periods=20).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntn30.py b/agent/src/factors/zoo/qlib158/cntn30.py
new file mode 100644
index 000000000..9c3a6f33a
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntn30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTN30: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}<\\mathrm{close}_{{-1}}], 30)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntn30',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}<\\\\mathrm{close}_{{-1}}], 30)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTN30 on the supplied OHLCV panel."""
+ c = panel['close']
+ dn = (c < c.shift(1)).astype('float64')
+ return dn.rolling(window=30, min_periods=30).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntn5.py b/agent/src/factors/zoo/qlib158/cntn5.py
new file mode 100644
index 000000000..fbe97d00a
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntn5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTN5: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}<\\mathrm{close}_{{-1}}], 5)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntn5',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}<\\\\mathrm{close}_{{-1}}], 5)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTN5 on the supplied OHLCV panel."""
+ c = panel['close']
+ dn = (c < c.shift(1)).astype('float64')
+ return dn.rolling(window=5, min_periods=5).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntn60.py b/agent/src/factors/zoo/qlib158/cntn60.py
new file mode 100644
index 000000000..d66f5f43a
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntn60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTN60: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}<\\mathrm{close}_{{-1}}], 60)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntn60',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}<\\\\mathrm{close}_{{-1}}], 60)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTN60 on the supplied OHLCV panel."""
+ c = panel['close']
+ dn = (c < c.shift(1)).astype('float64')
+ return dn.rolling(window=60, min_periods=60).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntp10.py b/agent/src/factors/zoo/qlib158/cntp10.py
new file mode 100644
index 000000000..5bdbdff84
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntp10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTP10: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}>\\mathrm{close}_{{-1}}], 10)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntp10',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}>\\\\mathrm{close}_{{-1}}], 10)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTP10 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ return up.rolling(window=10, min_periods=10).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntp20.py b/agent/src/factors/zoo/qlib158/cntp20.py
new file mode 100644
index 000000000..5d733dcb5
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntp20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTP20: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}>\\mathrm{close}_{{-1}}], 20)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntp20',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}>\\\\mathrm{close}_{{-1}}], 20)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTP20 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ return up.rolling(window=20, min_periods=20).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntp30.py b/agent/src/factors/zoo/qlib158/cntp30.py
new file mode 100644
index 000000000..bfea0a086
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntp30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTP30: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}>\\mathrm{close}_{{-1}}], 30)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntp30',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}>\\\\mathrm{close}_{{-1}}], 30)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTP30 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ return up.rolling(window=30, min_periods=30).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntp5.py b/agent/src/factors/zoo/qlib158/cntp5.py
new file mode 100644
index 000000000..85f645dcf
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntp5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTP5: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}>\\mathrm{close}_{{-1}}], 5)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntp5',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}>\\\\mathrm{close}_{{-1}}], 5)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTP5 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ return up.rolling(window=5, min_periods=5).mean()
diff --git a/agent/src/factors/zoo/qlib158/cntp60.py b/agent/src/factors/zoo/qlib158/cntp60.py
new file mode 100644
index 000000000..66616e3c7
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cntp60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CNTP60: formula = \\mathrm{rolling\\_mean}(\\mathrm{1}[\\mathrm{close}>\\mathrm{close}_{{-1}}], 60)."""
+from __future__ import annotations
+
+import pandas as pd
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cntp60',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{rolling\\\\_mean}(\\\\mathrm{1}[\\\\mathrm{close}>\\\\mathrm{close}_{{-1}}], 60)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CNTP60 on the supplied OHLCV panel."""
+ c = panel['close']
+ up = (c > c.shift(1)).astype('float64')
+ return up.rolling(window=60, min_periods=60).mean()
diff --git a/agent/src/factors/zoo/qlib158/cord10.py b/agent/src/factors/zoo/qlib158/cord10.py
new file mode 100644
index 000000000..b8f6998b4
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cord10.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORD10: formula = \\mathrm{ts\\_corr}(\\mathrm{close}/\\mathrm{close}_{{-1}}, \\log((\\mathrm{volume}+1)/(\\mathrm{volume}_{{-1}}+1)), 10)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import safe_div, ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cord10',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}/\\\\mathrm{close}_{{-1}}, \\\\log((\\\\mathrm{volume}+1)/(\\\\mathrm{volume}_{{-1}}+1)), 10)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORD10 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ c_ret = safe_div(c, c.shift(1))
+ v_ret = safe_div(v + 1.0, v.shift(1) + 1.0)
+ logvr = np.log(v_ret)
+ return ts_corr(c_ret, logvr, 10)
diff --git a/agent/src/factors/zoo/qlib158/cord20.py b/agent/src/factors/zoo/qlib158/cord20.py
new file mode 100644
index 000000000..0e8e63c54
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cord20.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORD20: formula = \\mathrm{ts\\_corr}(\\mathrm{close}/\\mathrm{close}_{{-1}}, \\log((\\mathrm{volume}+1)/(\\mathrm{volume}_{{-1}}+1)), 20)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import safe_div, ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cord20',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}/\\\\mathrm{close}_{{-1}}, \\\\log((\\\\mathrm{volume}+1)/(\\\\mathrm{volume}_{{-1}}+1)), 20)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORD20 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ c_ret = safe_div(c, c.shift(1))
+ v_ret = safe_div(v + 1.0, v.shift(1) + 1.0)
+ logvr = np.log(v_ret)
+ return ts_corr(c_ret, logvr, 20)
diff --git a/agent/src/factors/zoo/qlib158/cord30.py b/agent/src/factors/zoo/qlib158/cord30.py
new file mode 100644
index 000000000..b4b419b2c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cord30.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORD30: formula = \\mathrm{ts\\_corr}(\\mathrm{close}/\\mathrm{close}_{{-1}}, \\log((\\mathrm{volume}+1)/(\\mathrm{volume}_{{-1}}+1)), 30)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import safe_div, ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cord30',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}/\\\\mathrm{close}_{{-1}}, \\\\log((\\\\mathrm{volume}+1)/(\\\\mathrm{volume}_{{-1}}+1)), 30)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORD30 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ c_ret = safe_div(c, c.shift(1))
+ v_ret = safe_div(v + 1.0, v.shift(1) + 1.0)
+ logvr = np.log(v_ret)
+ return ts_corr(c_ret, logvr, 30)
diff --git a/agent/src/factors/zoo/qlib158/cord5.py b/agent/src/factors/zoo/qlib158/cord5.py
new file mode 100644
index 000000000..57fece7d8
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cord5.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORD5: formula = \\mathrm{ts\\_corr}(\\mathrm{close}/\\mathrm{close}_{{-1}}, \\log((\\mathrm{volume}+1)/(\\mathrm{volume}_{{-1}}+1)), 5)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import safe_div, ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cord5',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}/\\\\mathrm{close}_{{-1}}, \\\\log((\\\\mathrm{volume}+1)/(\\\\mathrm{volume}_{{-1}}+1)), 5)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORD5 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ c_ret = safe_div(c, c.shift(1))
+ v_ret = safe_div(v + 1.0, v.shift(1) + 1.0)
+ logvr = np.log(v_ret)
+ return ts_corr(c_ret, logvr, 5)
diff --git a/agent/src/factors/zoo/qlib158/cord60.py b/agent/src/factors/zoo/qlib158/cord60.py
new file mode 100644
index 000000000..5830585c8
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/cord60.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORD60: formula = \\mathrm{ts\\_corr}(\\mathrm{close}/\\mathrm{close}_{{-1}}, \\log((\\mathrm{volume}+1)/(\\mathrm{volume}_{{-1}}+1)), 60)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import safe_div, ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_cord60',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}/\\\\mathrm{close}_{{-1}}, \\\\log((\\\\mathrm{volume}+1)/(\\\\mathrm{volume}_{{-1}}+1)), 60)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORD60 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ c_ret = safe_div(c, c.shift(1))
+ v_ret = safe_div(v + 1.0, v.shift(1) + 1.0)
+ logvr = np.log(v_ret)
+ return ts_corr(c_ret, logvr, 60)
diff --git a/agent/src/factors/zoo/qlib158/corr10.py b/agent/src/factors/zoo/qlib158/corr10.py
new file mode 100644
index 000000000..93a059eec
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/corr10.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORR10: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, \\log(\\mathrm{volume}+1), 10)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_corr10',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, \\\\log(\\\\mathrm{volume}+1), 10)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORR10 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ logv = np.log1p(v)
+ return ts_corr(c, logv, 10)
diff --git a/agent/src/factors/zoo/qlib158/corr20.py b/agent/src/factors/zoo/qlib158/corr20.py
new file mode 100644
index 000000000..5e7b2b42c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/corr20.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORR20: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, \\log(\\mathrm{volume}+1), 20)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_corr20',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, \\\\log(\\\\mathrm{volume}+1), 20)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORR20 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ logv = np.log1p(v)
+ return ts_corr(c, logv, 20)
diff --git a/agent/src/factors/zoo/qlib158/corr30.py b/agent/src/factors/zoo/qlib158/corr30.py
new file mode 100644
index 000000000..1406228b7
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/corr30.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORR30: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, \\log(\\mathrm{volume}+1), 30)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_corr30',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, \\\\log(\\\\mathrm{volume}+1), 30)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORR30 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ logv = np.log1p(v)
+ return ts_corr(c, logv, 30)
diff --git a/agent/src/factors/zoo/qlib158/corr5.py b/agent/src/factors/zoo/qlib158/corr5.py
new file mode 100644
index 000000000..8da426548
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/corr5.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORR5: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, \\log(\\mathrm{volume}+1), 5)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_corr5',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, \\\\log(\\\\mathrm{volume}+1), 5)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORR5 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ logv = np.log1p(v)
+ return ts_corr(c, logv, 5)
diff --git a/agent/src/factors/zoo/qlib158/corr60.py b/agent/src/factors/zoo/qlib158/corr60.py
new file mode 100644
index 000000000..c342a20d3
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/corr60.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 CORR60: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, \\log(\\mathrm{volume}+1), 60)."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_corr60',
+ 'theme': ['volume', 'microstructure'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, \\\\log(\\\\mathrm{volume}+1), 60)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 CORR60 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ logv = np.log1p(v)
+ return ts_corr(c, logv, 60)
diff --git a/agent/src/factors/zoo/qlib158/imax10.py b/agent/src/factors/zoo/qlib158/imax10.py
new file mode 100644
index 000000000..75f701cf1
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imax10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMAX10: formula = \\mathrm{ts\\_argmax}(\\mathrm{high}, 10) / 10."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imax10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 10) / 10',
+ 'columns_required': ['high'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMAX10 on the supplied OHLCV panel."""
+ h = panel['high']
+ return ts_argmax(h, 10) / float(10)
diff --git a/agent/src/factors/zoo/qlib158/imax20.py b/agent/src/factors/zoo/qlib158/imax20.py
new file mode 100644
index 000000000..829fa1569
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imax20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMAX20: formula = \\mathrm{ts\\_argmax}(\\mathrm{high}, 20) / 20."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imax20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 20) / 20',
+ 'columns_required': ['high'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMAX20 on the supplied OHLCV panel."""
+ h = panel['high']
+ return ts_argmax(h, 20) / float(20)
diff --git a/agent/src/factors/zoo/qlib158/imax30.py b/agent/src/factors/zoo/qlib158/imax30.py
new file mode 100644
index 000000000..77708a537
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imax30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMAX30: formula = \\mathrm{ts\\_argmax}(\\mathrm{high}, 30) / 30."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imax30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 30) / 30',
+ 'columns_required': ['high'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMAX30 on the supplied OHLCV panel."""
+ h = panel['high']
+ return ts_argmax(h, 30) / float(30)
diff --git a/agent/src/factors/zoo/qlib158/imax5.py b/agent/src/factors/zoo/qlib158/imax5.py
new file mode 100644
index 000000000..57ebc1b76
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imax5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMAX5: formula = \\mathrm{ts\\_argmax}(\\mathrm{high}, 5) / 5."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imax5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 5) / 5',
+ 'columns_required': ['high'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMAX5 on the supplied OHLCV panel."""
+ h = panel['high']
+ return ts_argmax(h, 5) / float(5)
diff --git a/agent/src/factors/zoo/qlib158/imax60.py b/agent/src/factors/zoo/qlib158/imax60.py
new file mode 100644
index 000000000..e3b332ae3
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imax60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMAX60: formula = \\mathrm{ts\\_argmax}(\\mathrm{high}, 60) / 60."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imax60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 60) / 60',
+ 'columns_required': ['high'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMAX60 on the supplied OHLCV panel."""
+ h = panel['high']
+ return ts_argmax(h, 60) / float(60)
diff --git a/agent/src/factors/zoo/qlib158/imin10.py b/agent/src/factors/zoo/qlib158/imin10.py
new file mode 100644
index 000000000..0fc4e713d
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imin10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMIN10: formula = \\mathrm{ts\\_argmin}(\\mathrm{low}, 10) / 10."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imin10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 10) / 10',
+ 'columns_required': ['low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMIN10 on the supplied OHLCV panel."""
+ lo = panel['low']
+ return ts_argmin(lo, 10) / float(10)
diff --git a/agent/src/factors/zoo/qlib158/imin20.py b/agent/src/factors/zoo/qlib158/imin20.py
new file mode 100644
index 000000000..ae7ba5aaa
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imin20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMIN20: formula = \\mathrm{ts\\_argmin}(\\mathrm{low}, 20) / 20."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imin20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 20) / 20',
+ 'columns_required': ['low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMIN20 on the supplied OHLCV panel."""
+ lo = panel['low']
+ return ts_argmin(lo, 20) / float(20)
diff --git a/agent/src/factors/zoo/qlib158/imin30.py b/agent/src/factors/zoo/qlib158/imin30.py
new file mode 100644
index 000000000..01e6e92b6
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imin30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMIN30: formula = \\mathrm{ts\\_argmin}(\\mathrm{low}, 30) / 30."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imin30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 30) / 30',
+ 'columns_required': ['low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMIN30 on the supplied OHLCV panel."""
+ lo = panel['low']
+ return ts_argmin(lo, 30) / float(30)
diff --git a/agent/src/factors/zoo/qlib158/imin5.py b/agent/src/factors/zoo/qlib158/imin5.py
new file mode 100644
index 000000000..05b2c2d6b
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imin5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMIN5: formula = \\mathrm{ts\\_argmin}(\\mathrm{low}, 5) / 5."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imin5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 5) / 5',
+ 'columns_required': ['low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMIN5 on the supplied OHLCV panel."""
+ lo = panel['low']
+ return ts_argmin(lo, 5) / float(5)
diff --git a/agent/src/factors/zoo/qlib158/imin60.py b/agent/src/factors/zoo/qlib158/imin60.py
new file mode 100644
index 000000000..002d90e61
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imin60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMIN60: formula = \\mathrm{ts\\_argmin}(\\mathrm{low}, 60) / 60."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imin60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 60) / 60',
+ 'columns_required': ['low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMIN60 on the supplied OHLCV panel."""
+ lo = panel['low']
+ return ts_argmin(lo, 60) / float(60)
diff --git a/agent/src/factors/zoo/qlib158/imxd10.py b/agent/src/factors/zoo/qlib158/imxd10.py
new file mode 100644
index 000000000..6014e5a86
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imxd10.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMXD10: formula = (\\mathrm{ts\\_argmax}(\\mathrm{high}, 10) - \\mathrm{ts\\_argmin}(\\mathrm{low}, 10)) / 10."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax, ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imxd10',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 10) - \\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 10)) / 10',
+ 'columns_required': ['high', 'low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMXD10 on the supplied OHLCV panel."""
+ h = panel['high']
+ lo = panel['low']
+ return (ts_argmax(h, 10) - ts_argmin(lo, 10)) / float(10)
diff --git a/agent/src/factors/zoo/qlib158/imxd20.py b/agent/src/factors/zoo/qlib158/imxd20.py
new file mode 100644
index 000000000..2ca2e8ad8
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imxd20.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMXD20: formula = (\\mathrm{ts\\_argmax}(\\mathrm{high}, 20) - \\mathrm{ts\\_argmin}(\\mathrm{low}, 20)) / 20."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax, ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imxd20',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 20) - \\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 20)) / 20',
+ 'columns_required': ['high', 'low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMXD20 on the supplied OHLCV panel."""
+ h = panel['high']
+ lo = panel['low']
+ return (ts_argmax(h, 20) - ts_argmin(lo, 20)) / float(20)
diff --git a/agent/src/factors/zoo/qlib158/imxd30.py b/agent/src/factors/zoo/qlib158/imxd30.py
new file mode 100644
index 000000000..11c6c0b7a
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imxd30.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMXD30: formula = (\\mathrm{ts\\_argmax}(\\mathrm{high}, 30) - \\mathrm{ts\\_argmin}(\\mathrm{low}, 30)) / 30."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax, ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imxd30',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 30) - \\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 30)) / 30',
+ 'columns_required': ['high', 'low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMXD30 on the supplied OHLCV panel."""
+ h = panel['high']
+ lo = panel['low']
+ return (ts_argmax(h, 30) - ts_argmin(lo, 30)) / float(30)
diff --git a/agent/src/factors/zoo/qlib158/imxd5.py b/agent/src/factors/zoo/qlib158/imxd5.py
new file mode 100644
index 000000000..a60da29d7
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imxd5.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMXD5: formula = (\\mathrm{ts\\_argmax}(\\mathrm{high}, 5) - \\mathrm{ts\\_argmin}(\\mathrm{low}, 5)) / 5."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax, ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imxd5',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 5) - \\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 5)) / 5',
+ 'columns_required': ['high', 'low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMXD5 on the supplied OHLCV panel."""
+ h = panel['high']
+ lo = panel['low']
+ return (ts_argmax(h, 5) - ts_argmin(lo, 5)) / float(5)
diff --git a/agent/src/factors/zoo/qlib158/imxd60.py b/agent/src/factors/zoo/qlib158/imxd60.py
new file mode 100644
index 000000000..e9bb7d22f
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/imxd60.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 IMXD60: formula = (\\mathrm{ts\\_argmax}(\\mathrm{high}, 60) - \\mathrm{ts\\_argmin}(\\mathrm{low}, 60)) / 60."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_argmax, ts_argmin
+
+__alpha_meta__ = {
+ 'id': 'qlib158_imxd60',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{ts\\\\_argmax}(\\\\mathrm{high}, 60) - \\\\mathrm{ts\\\\_argmin}(\\\\mathrm{low}, 60)) / 60',
+ 'columns_required': ['high', 'low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 IMXD60 on the supplied OHLCV panel."""
+ h = panel['high']
+ lo = panel['low']
+ return (ts_argmax(h, 60) - ts_argmin(lo, 60)) / float(60)
diff --git a/agent/src/factors/zoo/qlib158/klen.py b/agent/src/factors/zoo/qlib158/klen.py
new file mode 100644
index 000000000..4057beedc
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/klen.py
@@ -0,0 +1,26 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KLEN: formula = (\\mathrm{high} - \\mathrm{low}) / \\mathrm{open}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_klen',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(\\\\mathrm{high} - \\\\mathrm{low}) / \\\\mathrm{open}',
+ 'columns_required': ['open', 'high', 'low'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KLEN on the supplied OHLCV panel."""
+ o = panel['open']
+ h = panel['high']
+ lo = panel['low']
+ return safe_div(h - lo, o)
diff --git a/agent/src/factors/zoo/qlib158/klow.py b/agent/src/factors/zoo/qlib158/klow.py
new file mode 100644
index 000000000..6130fd804
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/klow.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KLOW: formula = (\\min(\\mathrm{open}, \\mathrm{close}) - \\mathrm{low}) / \\mathrm{open}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_klow',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(\\\\min(\\\\mathrm{open}, \\\\mathrm{close}) - \\\\mathrm{low}) / \\\\mathrm{open}',
+ 'columns_required': ['open', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KLOW on the supplied OHLCV panel."""
+ o = panel['open']
+ c = panel['close']
+ lo = panel['low']
+ lower = o.where(o <= c, c)
+ return safe_div(lower - lo, o)
diff --git a/agent/src/factors/zoo/qlib158/klow2.py b/agent/src/factors/zoo/qlib158/klow2.py
new file mode 100644
index 000000000..0df888ef2
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/klow2.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KLOW2: formula = (\\min(\\mathrm{open}, \\mathrm{close}) - \\mathrm{low}) / (\\mathrm{high} - \\mathrm{low})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_klow2',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(\\\\min(\\\\mathrm{open}, \\\\mathrm{close}) - \\\\mathrm{low}) / (\\\\mathrm{high} - \\\\mathrm{low})',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KLOW2 on the supplied OHLCV panel."""
+ o = panel['open']
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ lower = o.where(o <= c, c)
+ return safe_div(lower - lo, h - lo)
diff --git a/agent/src/factors/zoo/qlib158/kmid.py b/agent/src/factors/zoo/qlib158/kmid.py
new file mode 100644
index 000000000..7548d25f1
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/kmid.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KMID: formula = (\\mathrm{close} - \\mathrm{open}) / \\mathrm{open}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_kmid',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{open}) / \\\\mathrm{open}',
+ 'columns_required': ['open', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KMID on the supplied OHLCV panel."""
+ o = panel['open']
+ c = panel['close']
+ return safe_div(c - o, o)
diff --git a/agent/src/factors/zoo/qlib158/kmid2.py b/agent/src/factors/zoo/qlib158/kmid2.py
new file mode 100644
index 000000000..f524beeeb
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/kmid2.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KMID2: formula = (\\mathrm{close} - \\mathrm{open}) / (\\mathrm{high} - \\mathrm{low})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_kmid2',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{open}) / (\\\\mathrm{high} - \\\\mathrm{low})',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KMID2 on the supplied OHLCV panel."""
+ o = panel['open']
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ return safe_div(c - o, h - lo)
diff --git a/agent/src/factors/zoo/qlib158/ksft.py b/agent/src/factors/zoo/qlib158/ksft.py
new file mode 100644
index 000000000..5530af2fd
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/ksft.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KSFT: formula = (2\\,\\mathrm{close} - \\mathrm{high} - \\mathrm{low}) / \\mathrm{open}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_ksft',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(2\\\\,\\\\mathrm{close} - \\\\mathrm{high} - \\\\mathrm{low}) / \\\\mathrm{open}',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KSFT on the supplied OHLCV panel."""
+ o = panel['open']
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ return safe_div(2.0 * c - h - lo, o)
diff --git a/agent/src/factors/zoo/qlib158/ksft2.py b/agent/src/factors/zoo/qlib158/ksft2.py
new file mode 100644
index 000000000..50c13ea5d
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/ksft2.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KSFT2: formula = (2\\,\\mathrm{close} - \\mathrm{high} - \\mathrm{low}) / (\\mathrm{high} - \\mathrm{low})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_ksft2',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(2\\\\,\\\\mathrm{close} - \\\\mathrm{high} - \\\\mathrm{low}) / (\\\\mathrm{high} - \\\\mathrm{low})',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KSFT2 on the supplied OHLCV panel."""
+ o = panel['open']
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ return safe_div(2.0 * c - h - lo, h - lo)
diff --git a/agent/src/factors/zoo/qlib158/kup.py b/agent/src/factors/zoo/qlib158/kup.py
new file mode 100644
index 000000000..e4bc1ea90
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/kup.py
@@ -0,0 +1,27 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KUP: formula = (\\mathrm{high} - \\max(\\mathrm{open}, \\mathrm{close})) / \\mathrm{open}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_kup',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(\\\\mathrm{high} - \\\\max(\\\\mathrm{open}, \\\\mathrm{close})) / \\\\mathrm{open}',
+ 'columns_required': ['open', 'high', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KUP on the supplied OHLCV panel."""
+ o = panel['open']
+ c = panel['close']
+ h = panel['high']
+ upper = o.where(o >= c, c)
+ return safe_div(h - upper, o)
diff --git a/agent/src/factors/zoo/qlib158/kup2.py b/agent/src/factors/zoo/qlib158/kup2.py
new file mode 100644
index 000000000..9c5361aab
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/kup2.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 KUP2: formula = (\\mathrm{high} - \\max(\\mathrm{open}, \\mathrm{close})) / (\\mathrm{high} - \\mathrm{low})."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_kup2',
+ 'theme': ['microstructure'],
+ 'formula_latex': '(\\\\mathrm{high} - \\\\max(\\\\mathrm{open}, \\\\mathrm{close})) / (\\\\mathrm{high} - \\\\mathrm{low})',
+ 'columns_required': ['open', 'high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 1,
+ 'min_warmup_bars': 1,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 KUP2 on the supplied OHLCV panel."""
+ o = panel['open']
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ upper = o.where(o >= c, c)
+ return safe_div(h - upper, h - lo)
diff --git a/agent/src/factors/zoo/qlib158/ma10.py b/agent/src/factors/zoo/qlib158/ma10.py
new file mode 100644
index 000000000..e096276b9
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/ma10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MA10: formula = \\mathrm{ts\\_mean}(\\mathrm{close}, 10) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_ma10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 10) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MA10 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_mean(c, 10), c)
diff --git a/agent/src/factors/zoo/qlib158/ma20.py b/agent/src/factors/zoo/qlib158/ma20.py
new file mode 100644
index 000000000..6efb5cee6
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/ma20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MA20: formula = \\mathrm{ts\\_mean}(\\mathrm{close}, 20) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_ma20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 20) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MA20 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_mean(c, 20), c)
diff --git a/agent/src/factors/zoo/qlib158/ma30.py b/agent/src/factors/zoo/qlib158/ma30.py
new file mode 100644
index 000000000..0dff06a3a
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/ma30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MA30: formula = \\mathrm{ts\\_mean}(\\mathrm{close}, 30) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_ma30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 30) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MA30 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_mean(c, 30), c)
diff --git a/agent/src/factors/zoo/qlib158/ma5.py b/agent/src/factors/zoo/qlib158/ma5.py
new file mode 100644
index 000000000..32f98377c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/ma5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MA5: formula = \\mathrm{ts\\_mean}(\\mathrm{close}, 5) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_ma5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 5) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MA5 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_mean(c, 5), c)
diff --git a/agent/src/factors/zoo/qlib158/ma60.py b/agent/src/factors/zoo/qlib158/ma60.py
new file mode 100644
index 000000000..5704fdb50
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/ma60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MA60: formula = \\mathrm{ts\\_mean}(\\mathrm{close}, 60) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_ma60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 60) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MA60 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_mean(c, 60), c)
diff --git a/agent/src/factors/zoo/qlib158/max10.py b/agent/src/factors/zoo/qlib158/max10.py
new file mode 100644
index 000000000..ed2195327
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/max10.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MAX10: formula = \\mathrm{ts\\_max}(\\mathrm{high}, 10) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max
+
+__alpha_meta__ = {
+ 'id': 'qlib158_max10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 10) / \\\\mathrm{close}',
+ 'columns_required': ['high', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MAX10 on the supplied OHLCV panel."""
+ h = panel['high']
+ c = panel['close']
+ return safe_div(ts_max(h, 10), c)
diff --git a/agent/src/factors/zoo/qlib158/max20.py b/agent/src/factors/zoo/qlib158/max20.py
new file mode 100644
index 000000000..26ce6a45d
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/max20.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MAX20: formula = \\mathrm{ts\\_max}(\\mathrm{high}, 20) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max
+
+__alpha_meta__ = {
+ 'id': 'qlib158_max20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 20) / \\\\mathrm{close}',
+ 'columns_required': ['high', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MAX20 on the supplied OHLCV panel."""
+ h = panel['high']
+ c = panel['close']
+ return safe_div(ts_max(h, 20), c)
diff --git a/agent/src/factors/zoo/qlib158/max30.py b/agent/src/factors/zoo/qlib158/max30.py
new file mode 100644
index 000000000..28b23c0d0
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/max30.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MAX30: formula = \\mathrm{ts\\_max}(\\mathrm{high}, 30) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max
+
+__alpha_meta__ = {
+ 'id': 'qlib158_max30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 30) / \\\\mathrm{close}',
+ 'columns_required': ['high', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MAX30 on the supplied OHLCV panel."""
+ h = panel['high']
+ c = panel['close']
+ return safe_div(ts_max(h, 30), c)
diff --git a/agent/src/factors/zoo/qlib158/max5.py b/agent/src/factors/zoo/qlib158/max5.py
new file mode 100644
index 000000000..2fb52b8da
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/max5.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MAX5: formula = \\mathrm{ts\\_max}(\\mathrm{high}, 5) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max
+
+__alpha_meta__ = {
+ 'id': 'qlib158_max5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 5) / \\\\mathrm{close}',
+ 'columns_required': ['high', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MAX5 on the supplied OHLCV panel."""
+ h = panel['high']
+ c = panel['close']
+ return safe_div(ts_max(h, 5), c)
diff --git a/agent/src/factors/zoo/qlib158/max60.py b/agent/src/factors/zoo/qlib158/max60.py
new file mode 100644
index 000000000..19889ef69
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/max60.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MAX60: formula = \\mathrm{ts\\_max}(\\mathrm{high}, 60) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max
+
+__alpha_meta__ = {
+ 'id': 'qlib158_max60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 60) / \\\\mathrm{close}',
+ 'columns_required': ['high', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MAX60 on the supplied OHLCV panel."""
+ h = panel['high']
+ c = panel['close']
+ return safe_div(ts_max(h, 60), c)
diff --git a/agent/src/factors/zoo/qlib158/min10.py b/agent/src/factors/zoo/qlib158/min10.py
new file mode 100644
index 000000000..74b792b2e
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/min10.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MIN10: formula = \\mathrm{ts\\_min}(\\mathrm{low}, 10) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_min10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 10) / \\\\mathrm{close}',
+ 'columns_required': ['low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MIN10 on the supplied OHLCV panel."""
+ lo = panel['low']
+ c = panel['close']
+ return safe_div(ts_min(lo, 10), c)
diff --git a/agent/src/factors/zoo/qlib158/min20.py b/agent/src/factors/zoo/qlib158/min20.py
new file mode 100644
index 000000000..d2978f38e
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/min20.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MIN20: formula = \\mathrm{ts\\_min}(\\mathrm{low}, 20) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_min20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 20) / \\\\mathrm{close}',
+ 'columns_required': ['low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MIN20 on the supplied OHLCV panel."""
+ lo = panel['low']
+ c = panel['close']
+ return safe_div(ts_min(lo, 20), c)
diff --git a/agent/src/factors/zoo/qlib158/min30.py b/agent/src/factors/zoo/qlib158/min30.py
new file mode 100644
index 000000000..b18b4cefe
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/min30.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MIN30: formula = \\mathrm{ts\\_min}(\\mathrm{low}, 30) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_min30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 30) / \\\\mathrm{close}',
+ 'columns_required': ['low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MIN30 on the supplied OHLCV panel."""
+ lo = panel['low']
+ c = panel['close']
+ return safe_div(ts_min(lo, 30), c)
diff --git a/agent/src/factors/zoo/qlib158/min5.py b/agent/src/factors/zoo/qlib158/min5.py
new file mode 100644
index 000000000..00e0581a3
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/min5.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MIN5: formula = \\mathrm{ts\\_min}(\\mathrm{low}, 5) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_min5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 5) / \\\\mathrm{close}',
+ 'columns_required': ['low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MIN5 on the supplied OHLCV panel."""
+ lo = panel['low']
+ c = panel['close']
+ return safe_div(ts_min(lo, 5), c)
diff --git a/agent/src/factors/zoo/qlib158/min60.py b/agent/src/factors/zoo/qlib158/min60.py
new file mode 100644
index 000000000..972b6de9f
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/min60.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 MIN60: formula = \\mathrm{ts\\_min}(\\mathrm{low}, 60) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_min60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 60) / \\\\mathrm{close}',
+ 'columns_required': ['low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 MIN60 on the supplied OHLCV panel."""
+ lo = panel['low']
+ c = panel['close']
+ return safe_div(ts_min(lo, 60), c)
diff --git a/agent/src/factors/zoo/qlib158/qtld10.py b/agent/src/factors/zoo/qlib158/qtld10.py
new file mode 100644
index 000000000..f13f5160e
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtld10.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLD10: formula = \\mathrm{quantile}_{{0.2}}(\\mathrm{close}, 10) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtld10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.2}}(\\\\mathrm{close}, 10) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLD10 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=10, min_periods=10).quantile(0.2)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtld20.py b/agent/src/factors/zoo/qlib158/qtld20.py
new file mode 100644
index 000000000..d8880407c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtld20.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLD20: formula = \\mathrm{quantile}_{{0.2}}(\\mathrm{close}, 20) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtld20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.2}}(\\\\mathrm{close}, 20) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLD20 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=20, min_periods=20).quantile(0.2)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtld30.py b/agent/src/factors/zoo/qlib158/qtld30.py
new file mode 100644
index 000000000..ca4d92cf8
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtld30.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLD30: formula = \\mathrm{quantile}_{{0.2}}(\\mathrm{close}, 30) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtld30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.2}}(\\\\mathrm{close}, 30) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLD30 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=30, min_periods=30).quantile(0.2)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtld5.py b/agent/src/factors/zoo/qlib158/qtld5.py
new file mode 100644
index 000000000..146a7d54e
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtld5.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLD5: formula = \\mathrm{quantile}_{{0.2}}(\\mathrm{close}, 5) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtld5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.2}}(\\\\mathrm{close}, 5) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLD5 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=5, min_periods=5).quantile(0.2)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtld60.py b/agent/src/factors/zoo/qlib158/qtld60.py
new file mode 100644
index 000000000..9b1b3f8bf
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtld60.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLD60: formula = \\mathrm{quantile}_{{0.2}}(\\mathrm{close}, 60) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtld60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.2}}(\\\\mathrm{close}, 60) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLD60 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=60, min_periods=60).quantile(0.2)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtlu10.py b/agent/src/factors/zoo/qlib158/qtlu10.py
new file mode 100644
index 000000000..10d728125
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtlu10.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLU10: formula = \\mathrm{quantile}_{{0.8}}(\\mathrm{close}, 10) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtlu10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.8}}(\\\\mathrm{close}, 10) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLU10 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=10, min_periods=10).quantile(0.8)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtlu20.py b/agent/src/factors/zoo/qlib158/qtlu20.py
new file mode 100644
index 000000000..1453e17db
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtlu20.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLU20: formula = \\mathrm{quantile}_{{0.8}}(\\mathrm{close}, 20) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtlu20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.8}}(\\\\mathrm{close}, 20) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLU20 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=20, min_periods=20).quantile(0.8)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtlu30.py b/agent/src/factors/zoo/qlib158/qtlu30.py
new file mode 100644
index 000000000..b36285144
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtlu30.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLU30: formula = \\mathrm{quantile}_{{0.8}}(\\mathrm{close}, 30) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtlu30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.8}}(\\\\mathrm{close}, 30) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLU30 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=30, min_periods=30).quantile(0.8)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtlu5.py b/agent/src/factors/zoo/qlib158/qtlu5.py
new file mode 100644
index 000000000..957c99ad3
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtlu5.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLU5: formula = \\mathrm{quantile}_{{0.8}}(\\mathrm{close}, 5) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtlu5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.8}}(\\\\mathrm{close}, 5) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLU5 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=5, min_periods=5).quantile(0.8)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/qtlu60.py b/agent/src/factors/zoo/qlib158/qtlu60.py
new file mode 100644
index 000000000..09b1234b8
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/qtlu60.py
@@ -0,0 +1,25 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 QTLU60: formula = \\mathrm{quantile}_{{0.8}}(\\mathrm{close}, 60) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_qtlu60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{quantile}_{{0.8}}(\\\\mathrm{close}, 60) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 QTLU60 on the supplied OHLCV panel."""
+ c = panel['close']
+ q = c.rolling(window=60, min_periods=60).quantile(0.8)
+ return safe_div(q, c)
diff --git a/agent/src/factors/zoo/qlib158/rank10.py b/agent/src/factors/zoo/qlib158/rank10.py
new file mode 100644
index 000000000..c1ac7ee16
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rank10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RANK10: formula = \\mathrm{ts\\_rank}(\\mathrm{close}, 10)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_rank, rank
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rank10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_rank}(\\\\mathrm{close}, 10)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RANK10 on the supplied OHLCV panel."""
+ c = panel['close']
+ return ts_rank(c, 10)
diff --git a/agent/src/factors/zoo/qlib158/rank20.py b/agent/src/factors/zoo/qlib158/rank20.py
new file mode 100644
index 000000000..5a329a040
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rank20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RANK20: formula = \\mathrm{ts\\_rank}(\\mathrm{close}, 20)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_rank, rank
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rank20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_rank}(\\\\mathrm{close}, 20)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RANK20 on the supplied OHLCV panel."""
+ c = panel['close']
+ return ts_rank(c, 20)
diff --git a/agent/src/factors/zoo/qlib158/rank30.py b/agent/src/factors/zoo/qlib158/rank30.py
new file mode 100644
index 000000000..12cdba784
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rank30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RANK30: formula = \\mathrm{ts\\_rank}(\\mathrm{close}, 30)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_rank, rank
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rank30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_rank}(\\\\mathrm{close}, 30)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RANK30 on the supplied OHLCV panel."""
+ c = panel['close']
+ return ts_rank(c, 30)
diff --git a/agent/src/factors/zoo/qlib158/rank5.py b/agent/src/factors/zoo/qlib158/rank5.py
new file mode 100644
index 000000000..79d6e4ad5
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rank5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RANK5: formula = \\mathrm{ts\\_rank}(\\mathrm{close}, 5)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_rank, rank
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rank5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_rank}(\\\\mathrm{close}, 5)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RANK5 on the supplied OHLCV panel."""
+ c = panel['close']
+ return ts_rank(c, 5)
diff --git a/agent/src/factors/zoo/qlib158/rank60.py b/agent/src/factors/zoo/qlib158/rank60.py
new file mode 100644
index 000000000..f7c43e3d9
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rank60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RANK60: formula = \\mathrm{ts\\_rank}(\\mathrm{close}, 60)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import ts_rank, rank
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rank60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_rank}(\\\\mathrm{close}, 60)',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RANK60 on the supplied OHLCV panel."""
+ c = panel['close']
+ return ts_rank(c, 60)
diff --git a/agent/src/factors/zoo/qlib158/resi10.py b/agent/src/factors/zoo/qlib158/resi10.py
new file mode 100644
index 000000000..1c3999d52
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/resi10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RESI10: formula = (\\mathrm{close} - \\mathrm{ts\\_mean}(\\mathrm{close}, 10)) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_resi10',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 10)) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RESI10 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c - ts_mean(c, 10), c)
diff --git a/agent/src/factors/zoo/qlib158/resi20.py b/agent/src/factors/zoo/qlib158/resi20.py
new file mode 100644
index 000000000..ff62a0caf
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/resi20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RESI20: formula = (\\mathrm{close} - \\mathrm{ts\\_mean}(\\mathrm{close}, 20)) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_resi20',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 20)) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RESI20 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c - ts_mean(c, 20), c)
diff --git a/agent/src/factors/zoo/qlib158/resi30.py b/agent/src/factors/zoo/qlib158/resi30.py
new file mode 100644
index 000000000..5a222f2d7
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/resi30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RESI30: formula = (\\mathrm{close} - \\mathrm{ts\\_mean}(\\mathrm{close}, 30)) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_resi30',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 30)) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RESI30 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c - ts_mean(c, 30), c)
diff --git a/agent/src/factors/zoo/qlib158/resi5.py b/agent/src/factors/zoo/qlib158/resi5.py
new file mode 100644
index 000000000..0aa65fb9b
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/resi5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RESI5: formula = (\\mathrm{close} - \\mathrm{ts\\_mean}(\\mathrm{close}, 5)) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_resi5',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 5)) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RESI5 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c - ts_mean(c, 5), c)
diff --git a/agent/src/factors/zoo/qlib158/resi60.py b/agent/src/factors/zoo/qlib158/resi60.py
new file mode 100644
index 000000000..09dd99855
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/resi60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RESI60: formula = (\\mathrm{close} - \\mathrm{ts\\_mean}(\\mathrm{close}, 60)) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_resi60',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_mean}(\\\\mathrm{close}, 60)) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RESI60 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c - ts_mean(c, 60), c)
diff --git a/agent/src/factors/zoo/qlib158/roc10.py b/agent/src/factors/zoo/qlib158/roc10.py
new file mode 100644
index 000000000..3d15b3b72
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/roc10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 ROC10: formula = \\mathrm{close}_t / \\mathrm{close}_{{t-10}} - 1."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_roc10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{close}_t / \\\\mathrm{close}_{{t-10}} - 1',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 ROC10 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c, c.shift(10)) - 1.0
diff --git a/agent/src/factors/zoo/qlib158/roc20.py b/agent/src/factors/zoo/qlib158/roc20.py
new file mode 100644
index 000000000..5da85a36a
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/roc20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 ROC20: formula = \\mathrm{close}_t / \\mathrm{close}_{{t-20}} - 1."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_roc20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{close}_t / \\\\mathrm{close}_{{t-20}} - 1',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 ROC20 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c, c.shift(20)) - 1.0
diff --git a/agent/src/factors/zoo/qlib158/roc30.py b/agent/src/factors/zoo/qlib158/roc30.py
new file mode 100644
index 000000000..bbe3cddc3
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/roc30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 ROC30: formula = \\mathrm{close}_t / \\mathrm{close}_{{t-30}} - 1."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_roc30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{close}_t / \\\\mathrm{close}_{{t-30}} - 1',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 ROC30 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c, c.shift(30)) - 1.0
diff --git a/agent/src/factors/zoo/qlib158/roc5.py b/agent/src/factors/zoo/qlib158/roc5.py
new file mode 100644
index 000000000..700540356
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/roc5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 ROC5: formula = \\mathrm{close}_t / \\mathrm{close}_{{t-5}} - 1."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_roc5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{close}_t / \\\\mathrm{close}_{{t-5}} - 1',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 ROC5 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c, c.shift(5)) - 1.0
diff --git a/agent/src/factors/zoo/qlib158/roc60.py b/agent/src/factors/zoo/qlib158/roc60.py
new file mode 100644
index 000000000..3868a553c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/roc60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 ROC60: formula = \\mathrm{close}_t / \\mathrm{close}_{{t-60}} - 1."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_roc60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{close}_t / \\\\mathrm{close}_{{t-60}} - 1',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 ROC60 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(c, c.shift(60)) - 1.0
diff --git a/agent/src/factors/zoo/qlib158/rsqr10.py b/agent/src/factors/zoo/qlib158/rsqr10.py
new file mode 100644
index 000000000..bccdcc0fa
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsqr10.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSQR10: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, t, 10)^2."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsqr10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, t, 10)^2',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSQR10 on the supplied OHLCV panel."""
+ c = panel['close']
+ t_arr = np.arange(len(c.index), dtype=np.float64)
+ t_df = pd.DataFrame(np.broadcast_to(t_arr[:, None], c.shape).copy(), index=c.index, columns=c.columns)
+ corr = ts_corr(c, t_df, 10)
+ return corr * corr
diff --git a/agent/src/factors/zoo/qlib158/rsqr20.py b/agent/src/factors/zoo/qlib158/rsqr20.py
new file mode 100644
index 000000000..b9052e49d
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsqr20.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSQR20: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, t, 20)^2."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsqr20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, t, 20)^2',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSQR20 on the supplied OHLCV panel."""
+ c = panel['close']
+ t_arr = np.arange(len(c.index), dtype=np.float64)
+ t_df = pd.DataFrame(np.broadcast_to(t_arr[:, None], c.shape).copy(), index=c.index, columns=c.columns)
+ corr = ts_corr(c, t_df, 20)
+ return corr * corr
diff --git a/agent/src/factors/zoo/qlib158/rsqr30.py b/agent/src/factors/zoo/qlib158/rsqr30.py
new file mode 100644
index 000000000..a4f179ebd
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsqr30.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSQR30: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, t, 30)^2."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsqr30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, t, 30)^2',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSQR30 on the supplied OHLCV panel."""
+ c = panel['close']
+ t_arr = np.arange(len(c.index), dtype=np.float64)
+ t_df = pd.DataFrame(np.broadcast_to(t_arr[:, None], c.shape).copy(), index=c.index, columns=c.columns)
+ corr = ts_corr(c, t_df, 30)
+ return corr * corr
diff --git a/agent/src/factors/zoo/qlib158/rsqr5.py b/agent/src/factors/zoo/qlib158/rsqr5.py
new file mode 100644
index 000000000..f0acff663
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsqr5.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSQR5: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, t, 5)^2."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsqr5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, t, 5)^2',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSQR5 on the supplied OHLCV panel."""
+ c = panel['close']
+ t_arr = np.arange(len(c.index), dtype=np.float64)
+ t_df = pd.DataFrame(np.broadcast_to(t_arr[:, None], c.shape).copy(), index=c.index, columns=c.columns)
+ corr = ts_corr(c, t_df, 5)
+ return corr * corr
diff --git a/agent/src/factors/zoo/qlib158/rsqr60.py b/agent/src/factors/zoo/qlib158/rsqr60.py
new file mode 100644
index 000000000..de80dab96
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsqr60.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSQR60: formula = \\mathrm{ts\\_corr}(\\mathrm{close}, t, 60)^2."""
+from __future__ import annotations
+
+import numpy as np
+import pandas as pd
+from src.factors.base import ts_corr
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsqr60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_corr}(\\\\mathrm{close}, t, 60)^2',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSQR60 on the supplied OHLCV panel."""
+ c = panel['close']
+ t_arr = np.arange(len(c.index), dtype=np.float64)
+ t_df = pd.DataFrame(np.broadcast_to(t_arr[:, None], c.shape).copy(), index=c.index, columns=c.columns)
+ corr = ts_corr(c, t_df, 60)
+ return corr * corr
diff --git a/agent/src/factors/zoo/qlib158/rsv10.py b/agent/src/factors/zoo/qlib158/rsv10.py
new file mode 100644
index 000000000..f2010c95f
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsv10.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSV10: formula = (\\mathrm{close} - \\mathrm{ts\\_min}(\\mathrm{low}, 10)) / (\\mathrm{ts\\_max}(\\mathrm{high}, 10) - \\mathrm{ts\\_min}(\\mathrm{low}, 10))."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsv10',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 10)) / (\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 10) - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 10))',
+ 'columns_required': ['high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSV10 on the supplied OHLCV panel."""
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ hh = ts_max(h, 10)
+ ll = ts_min(lo, 10)
+ return safe_div(c - ll, hh - ll)
diff --git a/agent/src/factors/zoo/qlib158/rsv20.py b/agent/src/factors/zoo/qlib158/rsv20.py
new file mode 100644
index 000000000..295d2009c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsv20.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSV20: formula = (\\mathrm{close} - \\mathrm{ts\\_min}(\\mathrm{low}, 20)) / (\\mathrm{ts\\_max}(\\mathrm{high}, 20) - \\mathrm{ts\\_min}(\\mathrm{low}, 20))."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsv20',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 20)) / (\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 20) - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 20))',
+ 'columns_required': ['high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSV20 on the supplied OHLCV panel."""
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ hh = ts_max(h, 20)
+ ll = ts_min(lo, 20)
+ return safe_div(c - ll, hh - ll)
diff --git a/agent/src/factors/zoo/qlib158/rsv30.py b/agent/src/factors/zoo/qlib158/rsv30.py
new file mode 100644
index 000000000..42464c274
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsv30.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSV30: formula = (\\mathrm{close} - \\mathrm{ts\\_min}(\\mathrm{low}, 30)) / (\\mathrm{ts\\_max}(\\mathrm{high}, 30) - \\mathrm{ts\\_min}(\\mathrm{low}, 30))."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsv30',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 30)) / (\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 30) - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 30))',
+ 'columns_required': ['high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSV30 on the supplied OHLCV panel."""
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ hh = ts_max(h, 30)
+ ll = ts_min(lo, 30)
+ return safe_div(c - ll, hh - ll)
diff --git a/agent/src/factors/zoo/qlib158/rsv5.py b/agent/src/factors/zoo/qlib158/rsv5.py
new file mode 100644
index 000000000..82bc5dc34
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsv5.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSV5: formula = (\\mathrm{close} - \\mathrm{ts\\_min}(\\mathrm{low}, 5)) / (\\mathrm{ts\\_max}(\\mathrm{high}, 5) - \\mathrm{ts\\_min}(\\mathrm{low}, 5))."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsv5',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 5)) / (\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 5) - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 5))',
+ 'columns_required': ['high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSV5 on the supplied OHLCV panel."""
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ hh = ts_max(h, 5)
+ ll = ts_min(lo, 5)
+ return safe_div(c - ll, hh - ll)
diff --git a/agent/src/factors/zoo/qlib158/rsv60.py b/agent/src/factors/zoo/qlib158/rsv60.py
new file mode 100644
index 000000000..d49f01a68
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/rsv60.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 RSV60: formula = (\\mathrm{close} - \\mathrm{ts\\_min}(\\mathrm{low}, 60)) / (\\mathrm{ts\\_max}(\\mathrm{high}, 60) - \\mathrm{ts\\_min}(\\mathrm{low}, 60))."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_max, ts_min
+
+__alpha_meta__ = {
+ 'id': 'qlib158_rsv60',
+ 'theme': ['momentum'],
+ 'formula_latex': '(\\\\mathrm{close} - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 60)) / (\\\\mathrm{ts\\\\_max}(\\\\mathrm{high}, 60) - \\\\mathrm{ts\\\\_min}(\\\\mathrm{low}, 60))',
+ 'columns_required': ['high', 'low', 'close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 RSV60 on the supplied OHLCV panel."""
+ c = panel['close']
+ h = panel['high']
+ lo = panel['low']
+ hh = ts_max(h, 60)
+ ll = ts_min(lo, 60)
+ return safe_div(c - ll, hh - ll)
diff --git a/agent/src/factors/zoo/qlib158/std10.py b/agent/src/factors/zoo/qlib158/std10.py
new file mode 100644
index 000000000..91fcda971
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/std10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 STD10: formula = \\mathrm{ts\\_std}(\\mathrm{close}, 10) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_std10',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{close}, 10) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 STD10 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_std(c, 10), c)
diff --git a/agent/src/factors/zoo/qlib158/std20.py b/agent/src/factors/zoo/qlib158/std20.py
new file mode 100644
index 000000000..20654cec2
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/std20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 STD20: formula = \\mathrm{ts\\_std}(\\mathrm{close}, 20) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_std20',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{close}, 20) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 STD20 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_std(c, 20), c)
diff --git a/agent/src/factors/zoo/qlib158/std30.py b/agent/src/factors/zoo/qlib158/std30.py
new file mode 100644
index 000000000..aea2fea8f
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/std30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 STD30: formula = \\mathrm{ts\\_std}(\\mathrm{close}, 30) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_std30',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{close}, 30) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 STD30 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_std(c, 30), c)
diff --git a/agent/src/factors/zoo/qlib158/std5.py b/agent/src/factors/zoo/qlib158/std5.py
new file mode 100644
index 000000000..9f8205afb
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/std5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 STD5: formula = \\mathrm{ts\\_std}(\\mathrm{close}, 5) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_std5',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{close}, 5) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 STD5 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_std(c, 5), c)
diff --git a/agent/src/factors/zoo/qlib158/std60.py b/agent/src/factors/zoo/qlib158/std60.py
new file mode 100644
index 000000000..e703ef795
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/std60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 STD60: formula = \\mathrm{ts\\_std}(\\mathrm{close}, 60) / \\mathrm{close}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_std60',
+ 'theme': ['momentum'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{close}, 60) / \\\\mathrm{close}',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 STD60 on the supplied OHLCV panel."""
+ c = panel['close']
+ return safe_div(ts_std(c, 60), c)
diff --git a/agent/src/factors/zoo/qlib158/sumd10.py b/agent/src/factors/zoo/qlib158/sumd10.py
new file mode 100644
index 000000000..b71bdc724
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumd10.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMD10: formula = \\mathrm{SUMP}_w - \\mathrm{SUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumd10',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{SUMP}_w - \\\\mathrm{SUMN}_w',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMD10 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=10, min_periods=10).sum()
+ num_n = neg.rolling(window=10, min_periods=10).sum()
+ den = absd.rolling(window=10, min_periods=10).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/sumd20.py b/agent/src/factors/zoo/qlib158/sumd20.py
new file mode 100644
index 000000000..bd544d604
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumd20.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMD20: formula = \\mathrm{SUMP}_w - \\mathrm{SUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumd20',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{SUMP}_w - \\\\mathrm{SUMN}_w',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMD20 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=20, min_periods=20).sum()
+ num_n = neg.rolling(window=20, min_periods=20).sum()
+ den = absd.rolling(window=20, min_periods=20).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/sumd30.py b/agent/src/factors/zoo/qlib158/sumd30.py
new file mode 100644
index 000000000..cbcac8c0a
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumd30.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMD30: formula = \\mathrm{SUMP}_w - \\mathrm{SUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumd30',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{SUMP}_w - \\\\mathrm{SUMN}_w',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMD30 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=30, min_periods=30).sum()
+ num_n = neg.rolling(window=30, min_periods=30).sum()
+ den = absd.rolling(window=30, min_periods=30).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/sumd5.py b/agent/src/factors/zoo/qlib158/sumd5.py
new file mode 100644
index 000000000..d47026cfc
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumd5.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMD5: formula = \\mathrm{SUMP}_w - \\mathrm{SUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumd5',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{SUMP}_w - \\\\mathrm{SUMN}_w',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMD5 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=5, min_periods=5).sum()
+ num_n = neg.rolling(window=5, min_periods=5).sum()
+ den = absd.rolling(window=5, min_periods=5).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/sumd60.py b/agent/src/factors/zoo/qlib158/sumd60.py
new file mode 100644
index 000000000..8efa979f6
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumd60.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMD60: formula = \\mathrm{SUMP}_w - \\mathrm{SUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumd60',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\mathrm{SUMP}_w - \\\\mathrm{SUMN}_w',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMD60 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=60, min_periods=60).sum()
+ num_n = neg.rolling(window=60, min_periods=60).sum()
+ den = absd.rolling(window=60, min_periods=60).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/sumn10.py b/agent/src/factors/zoo/qlib158/sumn10.py
new file mode 100644
index 000000000..7c2f883a0
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumn10.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMN10: formula = \\sum \\max(-\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumn10',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMN10 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=10, min_periods=10).sum()
+ den = absd.rolling(window=10, min_periods=10).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sumn20.py b/agent/src/factors/zoo/qlib158/sumn20.py
new file mode 100644
index 000000000..73d715245
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumn20.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMN20: formula = \\sum \\max(-\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumn20',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMN20 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=20, min_periods=20).sum()
+ den = absd.rolling(window=20, min_periods=20).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sumn30.py b/agent/src/factors/zoo/qlib158/sumn30.py
new file mode 100644
index 000000000..602eb31d1
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumn30.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMN30: formula = \\sum \\max(-\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumn30',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMN30 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=30, min_periods=30).sum()
+ den = absd.rolling(window=30, min_periods=30).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sumn5.py b/agent/src/factors/zoo/qlib158/sumn5.py
new file mode 100644
index 000000000..ac00703b3
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumn5.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMN5: formula = \\sum \\max(-\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumn5',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMN5 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=5, min_periods=5).sum()
+ den = absd.rolling(window=5, min_periods=5).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sumn60.py b/agent/src/factors/zoo/qlib158/sumn60.py
new file mode 100644
index 000000000..b51eb5ee6
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sumn60.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMN60: formula = \\sum \\max(-\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sumn60',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMN60 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=60, min_periods=60).sum()
+ den = absd.rolling(window=60, min_periods=60).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sump10.py b/agent/src/factors/zoo/qlib158/sump10.py
new file mode 100644
index 000000000..329d2a69c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sump10.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMP10: formula = \\sum \\max(\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sump10',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMP10 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=10, min_periods=10).sum()
+ den = absd.rolling(window=10, min_periods=10).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sump20.py b/agent/src/factors/zoo/qlib158/sump20.py
new file mode 100644
index 000000000..9b5ebb0d5
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sump20.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMP20: formula = \\sum \\max(\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sump20',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMP20 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=20, min_periods=20).sum()
+ den = absd.rolling(window=20, min_periods=20).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sump30.py b/agent/src/factors/zoo/qlib158/sump30.py
new file mode 100644
index 000000000..a0cdd12aa
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sump30.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMP30: formula = \\sum \\max(\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sump30',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMP30 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=30, min_periods=30).sum()
+ den = absd.rolling(window=30, min_periods=30).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sump5.py b/agent/src/factors/zoo/qlib158/sump5.py
new file mode 100644
index 000000000..25719bbe8
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sump5.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMP5: formula = \\sum \\max(\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sump5',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMP5 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=5, min_periods=5).sum()
+ den = absd.rolling(window=5, min_periods=5).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/sump60.py b/agent/src/factors/zoo/qlib158/sump60.py
new file mode 100644
index 000000000..7402a237c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/sump60.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 SUMP60: formula = \\sum \\max(\\Delta\\mathrm{close}, 0) / \\sum |\\Delta\\mathrm{close}|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_sump60',
+ 'theme': ['reversal'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta\\\\mathrm{close}, 0) / \\\\sum |\\\\Delta\\\\mathrm{close}|',
+ 'columns_required': ['close'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 SUMP60 on the supplied OHLCV panel."""
+ c = panel['close']
+ diff = c - c.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=60, min_periods=60).sum()
+ den = absd.rolling(window=60, min_periods=60).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vma10.py b/agent/src/factors/zoo/qlib158/vma10.py
new file mode 100644
index 000000000..6afc0c9be
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vma10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VMA10: formula = \\mathrm{ts\\_mean}(\\mathrm{volume}, 10) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vma10',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{volume}, 10) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VMA10 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_mean(v, 10), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vma20.py b/agent/src/factors/zoo/qlib158/vma20.py
new file mode 100644
index 000000000..83c32e257
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vma20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VMA20: formula = \\mathrm{ts\\_mean}(\\mathrm{volume}, 20) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vma20',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{volume}, 20) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VMA20 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_mean(v, 20), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vma30.py b/agent/src/factors/zoo/qlib158/vma30.py
new file mode 100644
index 000000000..ca7358827
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vma30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VMA30: formula = \\mathrm{ts\\_mean}(\\mathrm{volume}, 30) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vma30',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{volume}, 30) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VMA30 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_mean(v, 30), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vma5.py b/agent/src/factors/zoo/qlib158/vma5.py
new file mode 100644
index 000000000..f83a73a3c
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vma5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VMA5: formula = \\mathrm{ts\\_mean}(\\mathrm{volume}, 5) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vma5',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{volume}, 5) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VMA5 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_mean(v, 5), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vma60.py b/agent/src/factors/zoo/qlib158/vma60.py
new file mode 100644
index 000000000..eb8922547
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vma60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VMA60: formula = \\mathrm{ts\\_mean}(\\mathrm{volume}, 60) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vma60',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_mean}(\\\\mathrm{volume}, 60) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VMA60 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_mean(v, 60), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vstd10.py b/agent/src/factors/zoo/qlib158/vstd10.py
new file mode 100644
index 000000000..2d544b874
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vstd10.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSTD10: formula = \\mathrm{ts\\_std}(\\mathrm{volume}, 10) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vstd10',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{volume}, 10) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSTD10 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_std(v, 10), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vstd20.py b/agent/src/factors/zoo/qlib158/vstd20.py
new file mode 100644
index 000000000..cf2b11ccf
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vstd20.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSTD20: formula = \\mathrm{ts\\_std}(\\mathrm{volume}, 20) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vstd20',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{volume}, 20) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSTD20 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_std(v, 20), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vstd30.py b/agent/src/factors/zoo/qlib158/vstd30.py
new file mode 100644
index 000000000..7b35d0d75
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vstd30.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSTD30: formula = \\mathrm{ts\\_std}(\\mathrm{volume}, 30) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vstd30',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{volume}, 30) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSTD30 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_std(v, 30), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vstd5.py b/agent/src/factors/zoo/qlib158/vstd5.py
new file mode 100644
index 000000000..d64c406ec
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vstd5.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSTD5: formula = \\mathrm{ts\\_std}(\\mathrm{volume}, 5) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vstd5',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{volume}, 5) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSTD5 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_std(v, 5), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vstd60.py b/agent/src/factors/zoo/qlib158/vstd60.py
new file mode 100644
index 000000000..a87bf1744
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vstd60.py
@@ -0,0 +1,24 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSTD60: formula = \\mathrm{ts\\_std}(\\mathrm{volume}, 60) / \\mathrm{volume}."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vstd60',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{volume}, 60) / \\\\mathrm{volume}',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSTD60 on the supplied OHLCV panel."""
+ v = panel['volume']
+ return safe_div(ts_std(v, 60), v + 1e-12)
diff --git a/agent/src/factors/zoo/qlib158/vsumd10.py b/agent/src/factors/zoo/qlib158/vsumd10.py
new file mode 100644
index 000000000..2f4b38254
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumd10.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMD10: formula = \\mathrm{VSUMP}_w - \\mathrm{VSUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumd10',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{VSUMP}_w - \\\\mathrm{VSUMN}_w',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMD10 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=10, min_periods=10).sum()
+ num_n = neg.rolling(window=10, min_periods=10).sum()
+ den = absd.rolling(window=10, min_periods=10).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumd20.py b/agent/src/factors/zoo/qlib158/vsumd20.py
new file mode 100644
index 000000000..f63e28217
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumd20.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMD20: formula = \\mathrm{VSUMP}_w - \\mathrm{VSUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumd20',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{VSUMP}_w - \\\\mathrm{VSUMN}_w',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMD20 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=20, min_periods=20).sum()
+ num_n = neg.rolling(window=20, min_periods=20).sum()
+ den = absd.rolling(window=20, min_periods=20).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumd30.py b/agent/src/factors/zoo/qlib158/vsumd30.py
new file mode 100644
index 000000000..4e3bec6ed
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumd30.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMD30: formula = \\mathrm{VSUMP}_w - \\mathrm{VSUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumd30',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{VSUMP}_w - \\\\mathrm{VSUMN}_w',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMD30 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=30, min_periods=30).sum()
+ num_n = neg.rolling(window=30, min_periods=30).sum()
+ den = absd.rolling(window=30, min_periods=30).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumd5.py b/agent/src/factors/zoo/qlib158/vsumd5.py
new file mode 100644
index 000000000..67d6fd797
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumd5.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMD5: formula = \\mathrm{VSUMP}_w - \\mathrm{VSUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumd5',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{VSUMP}_w - \\\\mathrm{VSUMN}_w',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMD5 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=5, min_periods=5).sum()
+ num_n = neg.rolling(window=5, min_periods=5).sum()
+ den = absd.rolling(window=5, min_periods=5).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumd60.py b/agent/src/factors/zoo/qlib158/vsumd60.py
new file mode 100644
index 000000000..efd6d5842
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumd60.py
@@ -0,0 +1,31 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMD60: formula = \\mathrm{VSUMP}_w - \\mathrm{VSUMN}_w."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumd60',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{VSUMP}_w - \\\\mathrm{VSUMN}_w',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMD60 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num_p = pos.rolling(window=60, min_periods=60).sum()
+ num_n = neg.rolling(window=60, min_periods=60).sum()
+ den = absd.rolling(window=60, min_periods=60).sum()
+ return safe_div(num_p - num_n, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumn10.py b/agent/src/factors/zoo/qlib158/vsumn10.py
new file mode 100644
index 000000000..89eaafaeb
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumn10.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMN10: formula = \\sum \\max(-\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumn10',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMN10 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=10, min_periods=10).sum()
+ den = absd.rolling(window=10, min_periods=10).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumn20.py b/agent/src/factors/zoo/qlib158/vsumn20.py
new file mode 100644
index 000000000..0b168dd43
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumn20.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMN20: formula = \\sum \\max(-\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumn20',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMN20 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=20, min_periods=20).sum()
+ den = absd.rolling(window=20, min_periods=20).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumn30.py b/agent/src/factors/zoo/qlib158/vsumn30.py
new file mode 100644
index 000000000..d38c4d6cf
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumn30.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMN30: formula = \\sum \\max(-\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumn30',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMN30 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=30, min_periods=30).sum()
+ den = absd.rolling(window=30, min_periods=30).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumn5.py b/agent/src/factors/zoo/qlib158/vsumn5.py
new file mode 100644
index 000000000..33bbaab2f
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumn5.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMN5: formula = \\sum \\max(-\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumn5',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMN5 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=5, min_periods=5).sum()
+ den = absd.rolling(window=5, min_periods=5).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsumn60.py b/agent/src/factors/zoo/qlib158/vsumn60.py
new file mode 100644
index 000000000..ae64c8935
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsumn60.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMN60: formula = \\sum \\max(-\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsumn60',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(-\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMN60 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ neg = (-diff).where(diff < 0, 0.0)
+ absd = diff.abs()
+ num = neg.rolling(window=60, min_periods=60).sum()
+ den = absd.rolling(window=60, min_periods=60).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsump10.py b/agent/src/factors/zoo/qlib158/vsump10.py
new file mode 100644
index 000000000..945e94638
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsump10.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMP10: formula = \\sum \\max(\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsump10',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMP10 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=10, min_periods=10).sum()
+ den = absd.rolling(window=10, min_periods=10).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsump20.py b/agent/src/factors/zoo/qlib158/vsump20.py
new file mode 100644
index 000000000..c95923ca0
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsump20.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMP20: formula = \\sum \\max(\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsump20',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMP20 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=20, min_periods=20).sum()
+ den = absd.rolling(window=20, min_periods=20).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsump30.py b/agent/src/factors/zoo/qlib158/vsump30.py
new file mode 100644
index 000000000..86b49bb93
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsump30.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMP30: formula = \\sum \\max(\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsump30',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMP30 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=30, min_periods=30).sum()
+ den = absd.rolling(window=30, min_periods=30).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsump5.py b/agent/src/factors/zoo/qlib158/vsump5.py
new file mode 100644
index 000000000..07210c193
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsump5.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMP5: formula = \\sum \\max(\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsump5',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMP5 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=5, min_periods=5).sum()
+ den = absd.rolling(window=5, min_periods=5).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/vsump60.py b/agent/src/factors/zoo/qlib158/vsump60.py
new file mode 100644
index 000000000..b2ad6a012
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/vsump60.py
@@ -0,0 +1,29 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 VSUMP60: formula = \\sum \\max(\\Delta v, 0) / \\sum |\\Delta v|."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div
+
+__alpha_meta__ = {
+ 'id': 'qlib158_vsump60',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\sum \\\\max(\\\\Delta v, 0) / \\\\sum |\\\\Delta v|',
+ 'columns_required': ['volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 VSUMP60 on the supplied OHLCV panel."""
+ v = panel['volume']
+ diff = v - v.shift(1)
+ pos = diff.where(diff > 0, 0.0)
+ absd = diff.abs()
+ num = pos.rolling(window=60, min_periods=60).sum()
+ den = absd.rolling(window=60, min_periods=60).sum()
+ return safe_div(num, den)
diff --git a/agent/src/factors/zoo/qlib158/wvma10.py b/agent/src/factors/zoo/qlib158/wvma10.py
new file mode 100644
index 000000000..1a68720b0
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/wvma10.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 WVMA10: formula = \\mathrm{ts\\_std}(\\mathrm{ret}\\cdot v, 10) / \\mathrm{ts\\_mean}(|\\mathrm{ret}|\\cdot v, 10)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_wvma10',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{ret}\\\\cdot v, 10) / \\\\mathrm{ts\\\\_mean}(|\\\\mathrm{ret}|\\\\cdot v, 10)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 10,
+ 'min_warmup_bars': 10,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 WVMA10 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ ret = safe_div(c, c.shift(1)) - 1.0
+ rv = ret * v
+ arv = ret.abs() * v
+ return safe_div(ts_std(rv, 10), ts_mean(arv, 10))
diff --git a/agent/src/factors/zoo/qlib158/wvma20.py b/agent/src/factors/zoo/qlib158/wvma20.py
new file mode 100644
index 000000000..fa3d4371d
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/wvma20.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 WVMA20: formula = \\mathrm{ts\\_std}(\\mathrm{ret}\\cdot v, 20) / \\mathrm{ts\\_mean}(|\\mathrm{ret}|\\cdot v, 20)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_wvma20',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{ret}\\\\cdot v, 20) / \\\\mathrm{ts\\\\_mean}(|\\\\mathrm{ret}|\\\\cdot v, 20)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 20,
+ 'min_warmup_bars': 20,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 WVMA20 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ ret = safe_div(c, c.shift(1)) - 1.0
+ rv = ret * v
+ arv = ret.abs() * v
+ return safe_div(ts_std(rv, 20), ts_mean(arv, 20))
diff --git a/agent/src/factors/zoo/qlib158/wvma30.py b/agent/src/factors/zoo/qlib158/wvma30.py
new file mode 100644
index 000000000..e90bc353d
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/wvma30.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 WVMA30: formula = \\mathrm{ts\\_std}(\\mathrm{ret}\\cdot v, 30) / \\mathrm{ts\\_mean}(|\\mathrm{ret}|\\cdot v, 30)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_wvma30',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{ret}\\\\cdot v, 30) / \\\\mathrm{ts\\\\_mean}(|\\\\mathrm{ret}|\\\\cdot v, 30)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 30,
+ 'min_warmup_bars': 30,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 WVMA30 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ ret = safe_div(c, c.shift(1)) - 1.0
+ rv = ret * v
+ arv = ret.abs() * v
+ return safe_div(ts_std(rv, 30), ts_mean(arv, 30))
diff --git a/agent/src/factors/zoo/qlib158/wvma5.py b/agent/src/factors/zoo/qlib158/wvma5.py
new file mode 100644
index 000000000..e679e87f0
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/wvma5.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 WVMA5: formula = \\mathrm{ts\\_std}(\\mathrm{ret}\\cdot v, 5) / \\mathrm{ts\\_mean}(|\\mathrm{ret}|\\cdot v, 5)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_wvma5',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{ret}\\\\cdot v, 5) / \\\\mathrm{ts\\\\_mean}(|\\\\mathrm{ret}|\\\\cdot v, 5)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 5,
+ 'min_warmup_bars': 5,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 WVMA5 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ ret = safe_div(c, c.shift(1)) - 1.0
+ rv = ret * v
+ arv = ret.abs() * v
+ return safe_div(ts_std(rv, 5), ts_mean(arv, 5))
diff --git a/agent/src/factors/zoo/qlib158/wvma60.py b/agent/src/factors/zoo/qlib158/wvma60.py
new file mode 100644
index 000000000..589a8d5ad
--- /dev/null
+++ b/agent/src/factors/zoo/qlib158/wvma60.py
@@ -0,0 +1,28 @@
+# Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
+# (Apache-2.0). Copyright (c) Microsoft Corporation.
+"""qlib158 WVMA60: formula = \\mathrm{ts\\_std}(\\mathrm{ret}\\cdot v, 60) / \\mathrm{ts\\_mean}(|\\mathrm{ret}|\\cdot v, 60)."""
+from __future__ import annotations
+
+import pandas as pd
+from src.factors.base import safe_div, ts_mean, ts_std
+
+__alpha_meta__ = {
+ 'id': 'qlib158_wvma60',
+ 'theme': ['volume', 'volatility'],
+ 'formula_latex': '\\\\mathrm{ts\\\\_std}(\\\\mathrm{ret}\\\\cdot v, 60) / \\\\mathrm{ts\\\\_mean}(|\\\\mathrm{ret}|\\\\cdot v, 60)',
+ 'columns_required': ['close', 'volume'],
+ 'universe': ['equity_us', 'equity_cn', 'equity_hk'],
+ 'frequency': ['1d'],
+ 'decay_horizon': 60,
+ 'min_warmup_bars': 60,
+}
+
+
+def compute(panel: dict[str, pd.DataFrame]) -> pd.DataFrame:
+ """Return qlib158 WVMA60 on the supplied OHLCV panel."""
+ c = panel['close']
+ v = panel['volume']
+ ret = safe_div(c, c.shift(1)) - 1.0
+ rv = ret * v
+ arv = ret.abs() * v
+ return safe_div(ts_std(rv, 60), ts_mean(arv, 60))
diff --git a/agent/tests/factors/fixtures/goldens/academic_carhart_mom.csv b/agent/tests/factors/fixtures/goldens/academic_carhart_mom.csv
new file mode 100644
index 000000000..68e833aad
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/academic_carhart_mom.csv
@@ -0,0 +1,301 @@
+date,C00,C01,C02,C03,C04,C05,C06,C07
+2024-01-01,,,,,,,,
+2024-01-02,,,,,,,,
+2024-01-03,,,,,,,,
+2024-01-04,,,,,,,,
+2024-01-05,,,,,,,,
+2024-01-08,,,,,,,,
+2024-01-09,,,,,,,,
+2024-01-10,,,,,,,,
+2024-01-11,,,,,,,,
+2024-01-12,,,,,,,,
+2024-01-15,,,,,,,,
+2024-01-16,,,,,,,,
+2024-01-17,,,,,,,,
+2024-01-18,,,,,,,,
+2024-01-19,,,,,,,,
+2024-01-22,,,,,,,,
+2024-01-23,,,,,,,,
+2024-01-24,,,,,,,,
+2024-01-25,,,,,,,,
+2024-01-26,,,,,,,,
+2024-01-29,,,,,,,,
+2024-01-30,,,,,,,,
+2024-01-31,,,,,,,,
+2024-02-01,,,,,,,,
+2024-02-02,,,,,,,,
+2024-02-05,,,,,,,,
+2024-02-06,,,,,,,,
+2024-02-07,,,,,,,,
+2024-02-08,,,,,,,,
+2024-02-09,,,,,,,,
+2024-02-12,,,,,,,,
+2024-02-13,,,,,,,,
+2024-02-14,,,,,,,,
+2024-02-15,,,,,,,,
+2024-02-16,,,,,,,,
+2024-02-19,,,,,,,,
+2024-02-20,,,,,,,,
+2024-02-21,,,,,,,,
+2024-02-22,,,,,,,,
+2024-02-23,,,,,,,,
+2024-02-26,,,,,,,,
+2024-02-27,,,,,,,,
+2024-02-28,,,,,,,,
+2024-02-29,,,,,,,,
+2024-03-01,,,,,,,,
+2024-03-04,,,,,,,,
+2024-03-05,,,,,,,,
+2024-03-06,,,,,,,,
+2024-03-07,,,,,,,,
+2024-03-08,,,,,,,,
+2024-03-11,,,,,,,,
+2024-03-12,,,,,,,,
+2024-03-13,,,,,,,,
+2024-03-14,,,,,,,,
+2024-03-15,,,,,,,,
+2024-03-18,,,,,,,,
+2024-03-19,,,,,,,,
+2024-03-20,,,,,,,,
+2024-03-21,,,,,,,,
+2024-03-22,,,,,,,,
+2024-03-25,,,,,,,,
+2024-03-26,,,,,,,,
+2024-03-27,,,,,,,,
+2024-03-28,,,,,,,,
+2024-03-29,,,,,,,,
+2024-04-01,,,,,,,,
+2024-04-02,,,,,,,,
+2024-04-03,,,,,,,,
+2024-04-04,,,,,,,,
+2024-04-05,,,,,,,,
+2024-04-08,,,,,,,,
+2024-04-09,,,,,,,,
+2024-04-10,,,,,,,,
+2024-04-11,,,,,,,,
+2024-04-12,,,,,,,,
+2024-04-15,,,,,,,,
+2024-04-16,,,,,,,,
+2024-04-17,,,,,,,,
+2024-04-18,,,,,,,,
+2024-04-19,,,,,,,,
+2024-04-22,,,,,,,,
+2024-04-23,,,,,,,,
+2024-04-24,,,,,,,,
+2024-04-25,,,,,,,,
+2024-04-26,,,,,,,,
+2024-04-29,,,,,,,,
+2024-04-30,,,,,,,,
+2024-05-01,,,,,,,,
+2024-05-02,,,,,,,,
+2024-05-03,,,,,,,,
+2024-05-06,,,,,,,,
+2024-05-07,,,,,,,,
+2024-05-08,,,,,,,,
+2024-05-09,,,,,,,,
+2024-05-10,,,,,,,,
+2024-05-13,,,,,,,,
+2024-05-14,,,,,,,,
+2024-05-15,,,,,,,,
+2024-05-16,,,,,,,,
+2024-05-17,,,,,,,,
+2024-05-20,,,,,,,,
+2024-05-21,,,,,,,,
+2024-05-22,,,,,,,,
+2024-05-23,,,,,,,,
+2024-05-24,,,,,,,,
+2024-05-27,,,,,,,,
+2024-05-28,,,,,,,,
+2024-05-29,,,,,,,,
+2024-05-30,,,,,,,,
+2024-05-31,,,,,,,,
+2024-06-03,,,,,,,,
+2024-06-04,,,,,,,,
+2024-06-05,,,,,,,,
+2024-06-06,,,,,,,,
+2024-06-07,,,,,,,,
+2024-06-10,,,,,,,,
+2024-06-11,,,,,,,,
+2024-06-12,,,,,,,,
+2024-06-13,,,,,,,,
+2024-06-14,,,,,,,,
+2024-06-17,,,,,,,,
+2024-06-18,,,,,,,,
+2024-06-19,,,,,,,,
+2024-06-20,,,,,,,,
+2024-06-21,,,,,,,,
+2024-06-24,,,,,,,,
+2024-06-25,,,,,,,,
+2024-06-26,,,,,,,,
+2024-06-27,,,,,,,,
+2024-06-28,,,,,,,,
+2024-07-01,,,,,,,,
+2024-07-02,,,,,,,,
+2024-07-03,,,,,,,,
+2024-07-04,,,,,,,,
+2024-07-05,,,,,,,,
+2024-07-08,,,,,,,,
+2024-07-09,,,,,,,,
+2024-07-10,,,,,,,,
+2024-07-11,,,,,,,,
+2024-07-12,,,,,,,,
+2024-07-15,,,,,,,,
+2024-07-16,,,,,,,,
+2024-07-17,,,,,,,,
+2024-07-18,,,,,,,,
+2024-07-19,,,,,,,,
+2024-07-22,,,,,,,,
+2024-07-23,,,,,,,,
+2024-07-24,,,,,,,,
+2024-07-25,,,,,,,,
+2024-07-26,,,,,,,,
+2024-07-29,,,,,,,,
+2024-07-30,,,,,,,,
+2024-07-31,,,,,,,,
+2024-08-01,,,,,,,,
+2024-08-02,,,,,,,,
+2024-08-05,,,,,,,,
+2024-08-06,,,,,,,,
+2024-08-07,,,,,,,,
+2024-08-08,,,,,,,,
+2024-08-09,,,,,,,,
+2024-08-12,,,,,,,,
+2024-08-13,,,,,,,,
+2024-08-14,,,,,,,,
+2024-08-15,,,,,,,,
+2024-08-16,,,,,,,,
+2024-08-19,,,,,,,,
+2024-08-20,,,,,,,,
+2024-08-21,,,,,,,,
+2024-08-22,,,,,,,,
+2024-08-23,,,,,,,,
+2024-08-26,,,,,,,,
+2024-08-27,,,,,,,,
+2024-08-28,,,,,,,,
+2024-08-29,,,,,,,,
+2024-08-30,,,,,,,,
+2024-09-02,,,,,,,,
+2024-09-03,,,,,,,,
+2024-09-04,,,,,,,,
+2024-09-05,,,,,,,,
+2024-09-06,,,,,,,,
+2024-09-09,,,,,,,,
+2024-09-10,,,,,,,,
+2024-09-11,,,,,,,,
+2024-09-12,,,,,,,,
+2024-09-13,,,,,,,,
+2024-09-16,,,,,,,,
+2024-09-17,,,,,,,,
+2024-09-18,,,,,,,,
+2024-09-19,,,,,,,,
+2024-09-20,,,,,,,,
+2024-09-23,,,,,,,,
+2024-09-24,,,,,,,,
+2024-09-25,,,,,,,,
+2024-09-26,,,,,,,,
+2024-09-27,,,,,,,,
+2024-09-30,,,,,,,,
+2024-10-01,,,,,,,,
+2024-10-02,,,,,,,,
+2024-10-03,,,,,,,,
+2024-10-04,,,,,,,,
+2024-10-07,,,,,,,,
+2024-10-08,,,,,,,,
+2024-10-09,,,,,,,,
+2024-10-10,,,,,,,,
+2024-10-11,,,,,,,,
+2024-10-14,,,,,,,,
+2024-10-15,,,,,,,,
+2024-10-16,,,,,,,,
+2024-10-17,,,,,,,,
+2024-10-18,,,,,,,,
+2024-10-21,,,,,,,,
+2024-10-22,,,,,,,,
+2024-10-23,,,,,,,,
+2024-10-24,,,,,,,,
+2024-10-25,,,,,,,,
+2024-10-28,,,,,,,,
+2024-10-29,,,,,,,,
+2024-10-30,,,,,,,,
+2024-10-31,,,,,,,,
+2024-11-01,,,,,,,,
+2024-11-04,,,,,,,,
+2024-11-05,,,,,,,,
+2024-11-06,,,,,,,,
+2024-11-07,,,,,,,,
+2024-11-08,,,,,,,,
+2024-11-11,,,,,,,,
+2024-11-12,,,,,,,,
+2024-11-13,,,,,,,,
+2024-11-14,,,,,,,,
+2024-11-15,,,,,,,,
+2024-11-18,,,,,,,,
+2024-11-19,,,,,,,,
+2024-11-20,,,,,,,,
+2024-11-21,,,,,,,,
+2024-11-22,,,,,,,,
+2024-11-25,,,,,,,,
+2024-11-26,,,,,,,,
+2024-11-27,,,,,,,,
+2024-11-28,,,,,,,,
+2024-11-29,,,,,,,,
+2024-12-02,,,,,,,,
+2024-12-03,,,,,,,,
+2024-12-04,,,,,,,,
+2024-12-05,,,,,,,,
+2024-12-06,,,,,,,,
+2024-12-09,,,,,,,,
+2024-12-10,,,,,,,,
+2024-12-11,,,,,,,,
+2024-12-12,,,,,,,,
+2024-12-13,,,,,,,,
+2024-12-16,,,,,,,,
+2024-12-17,,,,,,,,
+2024-12-18,-0.7576764249825483,1.1131241212954752,-0.32058330680622826,1.789594592358432,-0.10881283010402955,-0.4986594002363294,0.054993194516836694,-1.271979946041608
+2024-12-19,-0.691766599691831,0.9431648301178843,-0.31485136722884255,1.8290490325894322,-0.20591236385231634,-0.36895036624269434,0.21082828114192365,-1.4015614468335558
+2024-12-20,-0.5332269593601272,0.6854322767947814,-0.1928992947934103,2.0597041033466637,-0.4031783163042603,-0.40574725719656857,0.06835380665277291,-1.2784383591398512
+2024-12-23,-0.507936797234558,0.682757141228243,-0.03797596323623991,2.0204844943816487,-0.39652806425792786,-0.38054479855321416,-0.005496371245322968,-1.374759641082629
+2024-12-24,-0.48878493541320606,0.8410474793159228,-0.2078507062161388,1.9677241257742495,-0.45680360638391543,-0.26982110435299156,-0.022944237107889502,-1.3625670156160308
+2024-12-25,-0.5682279478876864,0.8158786669461854,-0.17365088179752036,1.948889192945882,-0.3813279815469377,-0.23519110348702812,0.0016097453698684602,-1.4079796905427628
+2024-12-26,-0.6054635405262399,1.007813785765936,-0.2202714011611037,1.847085915139154,-0.2991747464472542,-0.30316525211095985,-0.021259847132136415,-1.4055649135273964
+2024-12-27,-0.6258955811845066,1.1321341240386957,-0.37973229983870443,1.7576063685338779,-0.37391527262687957,-0.3121918819682086,0.15540609327424346,-1.3534115502285173
+2024-12-30,-0.5815526122735611,1.1923395892529278,-0.4247132681028176,1.6644270989472254,-0.38236183240217214,-0.24105178952193804,0.202619968548796,-1.4297071544484603
+2024-12-31,-0.7211751580089071,1.1972657185605564,-0.2947172053721239,1.6909969088287529,-0.24822019644316465,-0.2888230235169753,0.061565952044556733,-1.396892996092695
+2025-01-01,-0.600646489983852,1.1591254845303522,-0.48222226409230734,1.6995675801608245,-0.20784012739723798,-0.262974978212201,0.12553966467147257,-1.4305488696770512
+2025-01-02,-0.6039990422958785,1.2095129412676309,-0.4755481789335681,1.6466275434386284,-0.1754698658281164,-0.2923526051733175,0.13998071939487755,-1.4487515118702559
+2025-01-03,-0.6319412244391812,1.1532712654160377,-0.4847780858878052,1.71462948474038,-0.015870918347301116,-0.3064951246803963,-0.014156404881530638,-1.4146589919202037
+2025-01-06,-0.6583504220193561,1.0625987264280958,-0.6558362543349635,1.73075168081304,-0.180108838536535,-0.09513981188638772,0.18723177712926156,-1.391146857593155
+2025-01-07,-0.6583403764405182,0.8800201917790982,-0.6016197315988352,1.8128045411500617,-0.11055450257212396,0.04108855189773375,0.09309330140394358,-1.4564919756193602
+2025-01-08,-0.7048163312414483,1.118170096855738,-0.647199934665946,1.6719022285867253,-0.10193907093176627,-0.11708159244331313,0.18787851281868534,-1.406913908978675
+2025-01-09,-0.6366875352066618,1.2582474490260334,-0.6012462260085206,1.5784010335760388,-0.09497542940723504,-0.2769548981472232,0.19912585524456974,-1.4259102490770026
+2025-01-10,-0.5486612274266356,1.232336869878227,-0.646523945923198,1.5895429129998104,-0.20644230081965084,-0.388228348059728,0.35283795213108965,-1.3848619127799158
+2025-01-13,-0.49807344145785043,1.1118695188707934,-0.5384704036665006,1.7330418391144984,-0.23275673907167893,-0.46395804230438686,0.2611699518328453,-1.3728226833177204
+2025-01-14,-0.43490530233070285,1.0788541452729234,-0.524972785537455,1.739139609472912,-0.4271687136315571,-0.42268475023009894,0.3553153079444468,-1.3635775109604682
+2025-01-15,-0.29907107602117966,1.0570993462657463,-0.589669147218751,1.7444916842141935,-0.471509519770634,-0.4335900269675773,0.35752836436961044,-1.365279624871409
+2025-01-16,-0.30807086967748504,1.046981122319098,-0.5019345278183107,1.719159361528948,-0.4524338893113644,-0.4220004760458152,0.3629351885498759,-1.4446359095449461
+2025-01-17,-0.4061479526123044,0.9812685419293472,-0.37052758708283073,1.6319730743944332,-0.4490738539915896,-0.3658514492798434,0.5413534432323218,-1.5629942165895334
+2025-01-20,-0.3606967157259487,0.8771476091393293,-0.34780666094445306,1.6236101561962364,-0.3848285740675963,-0.3059595412286783,0.5662073922544151,-1.6676736656233044
+2025-01-21,-0.4212387092955313,0.9565321977954765,-0.4000470582715572,1.6077101454289955,-0.3776934341645963,-0.27293023548235723,0.5375991377468733,-1.6299320437573026
+2025-01-22,-0.43690061465079655,0.9788946266186751,-0.37786594374681,1.543805733104619,-0.299630114801415,-0.20689289595530694,0.5107098128947162,-1.7121206034636824
+2025-01-23,-0.4444169696886636,0.811764168639067,-0.3303035259276972,1.5517206858519952,-0.27043798561940263,-0.1807902142974415,0.6299351622171386,-1.7674713211749962
+2025-01-24,-0.4301317748850498,0.8218954099570763,-0.4738782329539062,1.5908007045528618,-0.37318669155370154,-0.048574954881713435,0.6080448054509489,-1.6949692656865158
+2025-01-27,-0.4058073941350207,0.7378147585490505,-0.5129531234132618,1.604552444086318,-0.28640548791304565,-0.038102784262634415,0.6264082124124921,-1.7255066253238973
+2025-01-28,-0.3714182824727715,0.8887317853251214,-0.6830763429677562,1.4900126710802308,-0.1603724357386012,-0.08225722468482388,0.6356329769038723,-1.7172531474452712
+2025-01-29,-0.3806859507425988,0.9481491861187428,-0.7342325147374145,1.393059008683831,-0.07670115364331297,-0.1552384962312068,0.7177390400497843,-1.712089119497825
+2025-01-30,-0.42628923402193997,0.9212449931899899,-0.7339916327686509,1.4209734435212726,-0.17903704024087566,-0.24638931591321284,0.8531580811721438,-1.6096692949387277
+2025-01-31,-0.5751807268682357,1.0223616310632706,-0.794998395375417,1.231976610168316,-0.1507470398566015,-0.24023261007913613,1.0324930694391903,-1.5256725384913865
+2025-02-03,-0.5567288300617231,1.0975852973902813,-0.8389715818943652,1.338699579734607,-0.1238814245938447,-0.2829104233271234,0.8435213293188604,-1.4773139465666922
+2025-02-04,-0.5414313528504616,1.2051196190672353,-0.8417098372174768,1.3281438239210859,-0.16797331241819854,-0.2594780596192519,0.7398972390261368,-1.4625681199090699
+2025-02-05,-0.4948491562955984,1.1962854091946205,-0.878357538309893,1.3355166097440618,-0.2570587785725494,-0.11290428467403961,0.6963515405419973,-1.4849838016285988
+2025-02-06,-0.4976876344960882,1.406718875345007,-0.920502562463044,1.211164610477421,-0.21977132742172867,-0.1715684576402798,0.6094186993214236,-1.4177722031227105
+2025-02-07,-0.5310824857425992,1.5092937428380864,-1.028374332410126,1.1482335712568437,-0.13992106868917487,-0.20234373091154098,0.5488785913371367,-1.3046842876786255
+2025-02-10,-0.49802823960734044,1.4752807594552135,-1.109091182866424,1.177103701329155,-0.18265672828120597,-0.1858074561248902,0.5734495027727781,-1.2502503566772851
+2025-02-11,-0.5499734712401299,1.4353431166511086,-1.0857975317104531,1.2278375171169575,-0.1280918091558097,-0.18739345644745942,0.5511861239340431,-1.2631104891482563
+2025-02-12,-0.6073446109264358,1.5299860236477705,-1.07435680086163,1.123054937463019,-0.07783389559972652,-0.10986429688144128,0.4884080406612792,-1.2720493975028349
+2025-02-13,-0.7467210217422363,1.5394396591872594,-0.9833742497496498,1.182149507488542,-0.09507449086575628,-0.10060752365769732,0.4304090875889384,-1.2262209682494
+2025-02-14,-0.7835641454290619,1.5777958438154402,-1.0436171954436702,1.2010900865106424,-0.05203825904108682,-0.0672286489368805,0.2948118689665127,-1.1272495504418962
+2025-02-17,-0.7035139914222018,1.4388866900906494,-1.015571978341917,1.3641522219338147,-0.016188670476219247,-0.060899330462493316,0.21473050618323633,-1.2215954475048694
+2025-02-18,-0.6923962769604399,1.4676230529236147,-1.010296799658812,1.3370570759131741,-0.09948790700332356,-0.04352553163659956,0.25761603922895293,-1.2165896528065667
+2025-02-19,-0.7133122381736675,1.3344895567503205,-1.0637925261274572,1.4366814171106177,-0.06690427651645708,-0.00861615815834659,0.2783590160850087,-1.196904790970018
+2025-02-20,-0.7321316089273183,1.4674712098407061,-0.9402155196108675,1.4174480603391908,-0.14565264720110568,-0.06681738657376748,0.1676187591316162,-1.167720866998454
+2025-02-21,-0.8179968789661555,1.474143841882825,-0.9783247882786801,1.3677012807350788,-0.22124377996340466,0.004350761803037661,0.27043762538820165,-1.0990680626009026
diff --git a/agent/tests/factors/fixtures/goldens/academic_mkt_rf.csv b/agent/tests/factors/fixtures/goldens/academic_mkt_rf.csv
new file mode 100644
index 000000000..8f3e9d40a
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/academic_mkt_rf.csv
@@ -0,0 +1,301 @@
+date,C00,C01,C02,C03,C04,C05,C06,C07
+2024-01-01,,,,,,,,
+2024-01-02,,,,,,,,
+2024-01-03,,,,,,,,
+2024-01-04,,,,,,,,
+2024-01-05,,,,,,,,
+2024-01-08,,,,,,,,
+2024-01-09,,,,,,,,
+2024-01-10,,,,,,,,
+2024-01-11,,,,,,,,
+2024-01-12,,,,,,,,
+2024-01-15,,,,,,,,
+2024-01-16,,,,,,,,
+2024-01-17,,,,,,,,
+2024-01-18,,,,,,,,
+2024-01-19,,,,,,,,
+2024-01-22,,,,,,,,
+2024-01-23,,,,,,,,
+2024-01-24,,,,,,,,
+2024-01-25,,,,,,,,
+2024-01-26,,,,,,,,
+2024-01-29,,,,,,,,
+2024-01-30,-0.394996997098567,1.381616644372759,0.1851662368490226,-1.0577783044578282,0.19461352447524433,-0.28627169111739,-1.364292530363194,1.3419431173399534
+2024-01-31,-0.5272530312874841,1.4247098949705497,0.003395115229522536,-0.606021671079954,0.058086517552442665,-0.27974599026787966,-1.4927144151747096,1.4195435800575125
+2024-02-01,-0.35161850381789844,1.219658893955527,0.22275041408982063,-0.31021097686574983,-0.4771196700007687,-0.5513947554788656,-1.4058256403089169,1.653760238426852
+2024-02-02,-0.19022482776907843,1.2331729341850248,0.708824607294597,-0.32757421015988986,-0.6135257819743903,-0.5275978089906526,-1.5800302101777195,1.2969552975921086
+2024-02-05,-0.2850364108721309,1.4408193643813332,0.5560391657300869,0.057610527796932466,-1.1549317696289423,-0.4536704409845365,-1.3005950821660148,1.139764645743272
+2024-02-06,-0.553536539541599,1.8983177824886985,0.37179922176946983,0.10585620336161407,-0.7595541485686644,-0.35938897146707577,-1.3484945293465793,0.6450009813041363
+2024-02-07,-0.6537609838630581,2.105856850001118,0.2164790522752489,0.23808222289097483,-0.05797738115613283,-0.7370894816242649,-1.2153170964589042,0.1037268179350181
+2024-02-08,-0.5894819519137329,2.2152888164488065,0.10277495770411389,-0.20453277979412327,-0.1441937620009892,-0.5817317855111274,-1.1114190560860573,0.3132955611531091
+2024-02-09,-0.666442095442659,2.001842084877429,0.6694570667301717,-0.18379592509541892,-0.5009424934456445,-0.36237204725800587,-1.2616993762209643,0.303952785855092
+2024-02-12,-0.7650334548228633,1.5047557590654688,1.2504296675785416,-0.17536174659860515,-0.7024010409399872,-0.3572783508176977,-1.2858495858059225,0.5307387523410649
+2024-02-13,-0.5046407450099228,1.608312837806816,0.7139265554646974,0.05240297023048187,-0.2500306495373564,-0.1321676761377601,-1.8528352325516557,0.3650319397346999
+2024-02-14,-0.11605237815703322,1.2686321274031953,0.7659003533684432,0.041480050252303106,-0.24554462548996261,-0.04455629627671255,-2.1257216345244103,0.4558624034241767
+2024-02-15,-0.25481722707985827,1.0316501878245914,1.1945733507469312,-0.2148929589249418,-0.08884649391037687,0.04837137435709154,-2.065279340881573,0.34924110786813595
+2024-02-16,0.061417950051346426,1.2456411134030776,0.7485504185889993,-0.15787284776882685,-0.08653481403239219,-0.03442543847941038,-2.1674921636939795,0.39071578193118556
+2024-02-19,0.10460690027202843,0.6945637115896207,1.1521366011714052,-0.453676748106758,0.47495720879545805,-0.1746790375210345,-2.14415760652924,0.34624897032852026
+2024-02-20,0.07152768487924457,0.987993158564631,0.9650040254339187,-0.2025848116903996,0.315393575792079,-0.47311452780715124,-2.1240764358325195,0.4598573306601972
+2024-02-21,0.1288353281987312,1.0065582958639532,1.4232394807071627,-0.19374138262651805,0.21190574096035686,-0.8422125657288658,-1.7751682883333901,0.04058339095856996
+2024-02-22,0.21023277735529186,0.9857348665127377,1.4000888214315876,-0.13799667188936257,0.17805089760427,-1.2733366516396147,-1.5249426702443072,0.1621686308693973
+2024-02-23,0.1919786309015725,0.7288939563000694,1.6862554043937055,0.061915523225007124,0.07652450484021248,-1.29474131174775,-1.3772978730620888,-0.07352883485072802
+2024-02-26,0.3427183118946218,0.7925990961911186,1.3941675142754026,0.6654942886267694,-0.5487638956713937,-1.6313650526051142,-0.9491778050527523,-0.06567245765865255
+2024-02-27,0.7646788396387181,0.8145493811473246,1.1563959738759728,0.7110711959540966,-0.6085798395310525,-1.6628690781002158,-0.791088903930426,-0.384157569054418
+2024-02-28,0.594270299973544,0.843570113974932,1.3431179458275422,0.7118465516877437,-0.6750469095129079,-1.5237329090309013,-0.7171558467957869,-0.5768692461241651
+2024-02-29,0.7612215244237542,0.8799146401848368,1.4729353556778702,0.06269843542569799,-0.9187672614728186,-1.5380342096808628,-0.4044957051288597,-0.3154727794296179
+2024-03-01,1.0994254932616154,0.7297951142475337,1.4547866309753283,-0.14340655299362293,-0.7952144772881268,-1.387103411684573,-0.24879579244698138,-0.7094870040711737
+2024-03-04,0.9608565988518737,1.2123485297946643,1.1508169741142944,-0.27941829854140116,-0.5652655163962153,-1.561511168872067,-0.3460734057221339,-0.5717537132290151
+2024-03-05,1.052497537273033,1.0362980742606203,1.0445710614542973,-0.5402567841950887,0.020895128260320285,-1.504778525285316,-0.027668078690673586,-1.0815584130771925
+2024-03-06,1.2574862916893446,0.2585035153659451,1.576233660292732,-0.6166273585448957,-0.12425633685242495,-1.263612182041445,-0.16741242436705386,-0.920315165542202
+2024-03-07,1.2018438924772112,0.26140060915071717,1.7521537443293533,-0.3261334675569948,-0.5436227514901558,-1.1280118320566697,-0.6369856699779385,-0.5806445248755229
+2024-03-08,0.8733211689071376,0.34814406433048267,1.9318395645017339,-0.2667718458253623,-0.8400976922795726,-1.0475627571155177,-0.5732926148907811,-0.4255798876281208
+2024-03-11,0.7534024991652761,0.6202337998500463,1.9000684899495026,-0.35896544590951335,-0.47219051074778084,-1.0681656338859706,-0.6964641935640639,-0.6779190048574965
+2024-03-12,0.9187799104415078,0.7061005893966046,1.7921204706573406,-0.9420663440396424,-0.6013148728708526,-0.6416651580327682,-0.502155415474036,-0.7297991800781537
+2024-03-13,0.5822220046379203,0.3831473104366766,2.0607442594947285,-1.135944018792866,-0.6700351642238116,-0.5221388443476249,-0.2715220583213471,-0.426473488883676
+2024-03-14,0.40130922222274795,0.9145165912270974,1.6896330651345381,-1.240039438586685,-0.2490254437422367,-0.9882441501932737,0.2006515053722342,-0.7288013514344224
+2024-03-15,0.3005353263933969,1.288315735859687,1.4644987265382785,-0.8914995326805273,0.19107374749817804,-1.3083582439598236,-0.6131780416532541,-0.43138771799593517
+2024-03-18,0.2285218736096511,1.520041762875914,1.409903032990746,-1.017836519066133,-0.08058665624467048,-1.044696151975657,-0.5012053386045539,-0.5141420035852965
+2024-03-19,0.2816611915087468,1.5533397371160311,1.4397494481758504,-0.4309854243722917,-0.9443722398065825,-0.38048223239826817,-0.5876624218746286,-0.9312480583488577
+2024-03-20,0.17808362940385375,1.5485283543551396,1.452205484481683,-0.7094586477068605,-0.09276735482710038,-0.6943193914880602,-1.003013999423307,-0.6792580747953487
+2024-03-21,0.03313005586056474,1.3933970012773944,1.425449330497603,-0.37847568591234915,0.22562412008675647,-0.4107202166923194,-0.9955375803473847,-1.2928670247702656
+2024-03-22,-0.6014205294945917,1.5951674043605037,1.3215902748028385,-0.4296757795132331,0.05425098003122005,-0.4082444231048304,-0.1255597365263738,-1.4061081905555335
+2024-03-25,-0.6152064855914492,1.7303587005484489,0.9338807351198315,0.028270668774450208,0.00029273814939980607,-0.43837420303270597,-0.03898612645662273,-1.6002360275113527
+2024-03-26,-0.17924045380634562,1.5699950791757808,1.0188611492634085,-0.3609407419615537,0.22896326852649865,-0.45348809524367933,-0.07160070342828492,-1.7525495025258246
+2024-03-27,-0.6992494270768134,1.3926574308977449,0.8129975906830367,-0.454856055913052,0.6642589875326366,0.6072673690376456,-0.8490143984794543,-1.474061496681744
+2024-03-28,-0.6254471418519345,1.4717971693653176,0.5059107576248704,-0.5494871928038177,1.1302836708287132,0.2621468597525489,-0.8436095694346584,-1.3515945534810396
+2024-03-29,-0.572175400524752,0.8281193330107134,0.7183498180125629,0.20806581351363365,1.4415873478807963,-0.12215913432396695,-0.9307783941025725,-1.5710093834664147
+2024-04-01,-1.0704717606975716,1.0824529905355844,0.5523452449270997,0.8341570403374968,1.1192923445122283,-0.4099805391265725,-1.1938664850036333,-0.9139288354846313
+2024-04-02,-0.9969657944545964,0.6100267828794256,1.1633052632217222,0.4760252934385368,1.2499636855977503,-0.4468304112889503,-1.327253261048689,-0.7282715583451995
+2024-04-03,-0.992704662259356,0.7080729056892073,1.3524567368120806,0.17536557698224586,0.9415124727560278,-0.8445991748826814,-1.4301654813771962,0.09006162627967233
+2024-04-04,-1.7112518661879754,0.454364135739776,0.8795111741565848,0.38225416202054735,1.3034087145718636,-0.7635762748761119,-0.7799151724505063,0.23520512702582216
+2024-04-05,-1.5629535661097844,0.6986580257174162,1.2134091060176668,-0.2343009499571787,1.2250935110969925,-0.877892196979682,-0.5169416282865255,0.054927698501095155
+2024-04-08,-0.7580404193996657,0.6221666684938634,0.8573271660456916,-0.10976227412225374,1.7914948981444914,-1.0607225156075515,-0.8378681195737848,-0.5045954039807903
+2024-04-09,-0.7832024094551249,0.5670186819660719,0.7193055381541604,0.23594535768681454,1.7550352994245253,-1.1706553734436056,-0.3739092669922097,-0.9495378273406327
+2024-04-10,-0.7742605540901573,0.4414801061617859,0.05514048489897794,0.5799832322548834,1.8753948638782192,-1.4414728949815714,-0.37817340117164283,-0.3580918369504949
+2024-04-11,-0.7765429745056774,0.6534421084278704,-0.06000338242055283,0.5694191734073947,1.7089556489281084,-1.596325191879597,-0.09310926269031145,-0.40583611926723456
+2024-04-12,-0.9831327182598275,0.4646696134893219,0.3344192174894635,0.33204328557088736,1.587969154485489,-1.7531820131946276,0.007633726761460892,0.009579733657831971
+2024-04-15,-1.060256523111546,0.07265509398565248,0.2058293394637935,0.7885188796272293,1.6445219754836493,-1.5164184576933806,0.2435248682898451,-0.3783751760452424
+2024-04-16,-1.3253504020465339,0.22576878335681475,0.5899543079150915,0.4141557407186614,1.394084554706456,-1.569711582794637,0.4736988824447833,-0.2026002843006362
+2024-04-17,-1.324703417694664,0.40892049719724316,0.4945049097052948,0.05820629060599556,1.1838548674005624,-1.6731531848307921,0.7907399094905031,0.06163012812585696
+2024-04-18,-1.2866609903487818,0.5780071931671902,0.43069194199036737,0.28798512590748443,0.8585339471659074,-1.8628551672243148,0.6391984033899044,0.35509954595224286
+2024-04-19,-1.2232929442999152,0.5959770129517622,0.08664104429625812,-0.24560379644272548,1.2989554645863535,-1.6486623926354715,0.44565467110232865,0.6903309404414097
+2024-04-22,-0.6704107866916169,1.0307501346563128,-0.07512822041359155,-0.2477360380457221,1.4467464582894425,-1.5271552840576776,-0.6838294929435971,0.7267632292064504
+2024-04-23,-0.9842832679971002,1.0526939428294193,0.4357777443453302,-0.3512103100049958,1.139058031665028,-1.6927171900897071,-0.22788467898187711,0.6285657282339028
+2024-04-24,-1.145376982679675,1.0270941889677425,0.6992756775099268,-0.5206415935254836,1.1790596784792362,-1.4195469209072478,-0.3851242406978844,0.5652601928533852
+2024-04-25,-1.165258855103208,1.2274827209488568,0.9565752451960937,0.19218041529477561,0.3101167804915617,-1.7323340994926957,0.2845377414803026,-0.07329994881568698
+2024-04-26,-1.4202582926189304,1.4047972777079816,0.7651646455116192,0.1488786242885031,-0.10791265487457286,-1.4625630713901534,0.4484476556076219,0.22344581576793074
+2024-04-29,-1.275054934322503,1.6043626550805157,0.9675927801579789,0.12850653380106544,-0.6966882344871755,-1.072487644001907,0.44830160334876834,-0.10453275957674232
+2024-04-30,-0.8560181095438382,1.3893003343626982,0.8511964703630696,0.02420485229684227,-1.2779169552588447,-0.6007081269655415,1.1031907134865244,-0.6332491787409101
+2024-05-01,-0.8452839821737931,1.0336681479696954,0.8004213557803165,0.5110286426008894,-1.4191010103284374,0.22953409160641092,0.8938025217730885,-1.2040697672281706
+2024-05-02,-0.6801153496282725,0.9568346045269216,-0.03680521052189437,0.9687950760919377,-1.539679308185573,0.9104348737062514,0.5210075768712898,-1.1004722628606605
+2024-05-03,-0.316998134788211,1.047288933873227,-0.29015348108745787,1.0860507815273688,-1.5706809929323595,0.8945522200106297,0.24967021206026524,-1.0997295386634625
+2024-05-06,-0.45352338136981135,0.6364249857497044,-0.6091781724581846,1.4623388567709141,-1.401545103816409,1.03271061860413,0.22599776341913635,-0.8932255668994797
+2024-05-07,-0.5697440582015495,0.03376290930451162,-0.6910783283578129,1.384863113979764,-1.5067304938725583,0.7946342991108045,1.0592959140868932,-0.5050033560500526
+2024-05-08,-0.15356957930084117,0.3119344846750378,-0.40397860944126074,1.229942959788813,-2.116825433522996,0.507670379254025,0.6793407471653234,-0.054514948618100995
+2024-05-09,0.19097500573917614,0.21257849323033703,0.2830446473049685,1.0400710366268706,-2.1572117486634323,0.5473354051420013,0.5726812458322954,-0.6894740852122163
+2024-05-10,-0.19640169221358683,0.24442968910458482,0.021141474940132222,1.585350517635836,-1.9574408467363056,0.579999045410595,0.16273947663118232,-0.43981766477243783
+2024-05-13,-0.5448272859084128,0.09318406451972713,0.25530781384131496,1.6397013818291555,-1.8813819989100702,0.5547081153168971,0.14970372782604116,-0.26639581851465327
+2024-05-14,-0.8596740225582757,0.7746876187934072,0.23954343555645013,1.213869652878576,-1.9035328453796905,0.36939592539077043,0.504956108151958,-0.33924587283319585
+2024-05-15,-0.5793163946597576,0.45241551950478925,0.15623101721452665,1.5565792618423044,-1.949223454634079,0.4231694988076693,0.09662215803118164,-0.15647760610663472
+2024-05-16,-0.4006755034905305,0.6418598766959854,0.3353868437010073,1.7480904471690164,-1.7602907912516803,-0.026989342146632102,-0.18085869810887722,-0.3565228325682892
+2024-05-17,-0.6075932677346746,0.4185811621506979,0.30382153894303005,1.877463188364319,-1.5490271786359064,-0.08730481613253331,0.25097635248233563,-0.6069169794372683
+2024-05-20,-0.4377104106986767,0.24236018636955434,0.383833777321494,1.8180967908080228,-1.6777870058705897,-0.258077744316007,0.4189510850675802,-0.4896666786813781
+2024-05-21,-0.2317720086344753,-0.34920485500312,0.25302662404422005,1.7750933589427822,-1.382832349784973,-0.2630881250923403,0.9960942905784486,-0.7973169350505417
+2024-05-22,-0.1536545409331706,-0.3268335675611839,-0.08137062392218877,1.7620714892011902,-1.4387634884634828,0.1836758217221734,0.9364947080103825,-0.8816197980537199
+2024-05-23,-0.2621850254736123,-0.07929812455996045,0.16806630380575988,1.7551325184839268,-1.5038526326728097,0.2319118890265068,0.6974323881207029,-1.0072073167305138
+2024-05-24,-0.44484176952008453,-0.3488677776558663,0.2634347682242076,1.9503078682045576,-1.079533264588719,-0.25146758659558355,0.8428161270112208,-0.9318483650797329
+2024-05-27,-0.47192904937202207,-0.18759408292377872,0.22675606433088405,2.1563144041247426,-0.8664063531098422,-0.6651619701690362,0.5480030883548811,-0.7399821012358284
+2024-05-28,-0.8508240116902999,-0.05538262856039622,0.18889717983484108,1.8905019037023774,-0.7693936950270048,-0.5864751990872538,1.0162021378890622,-0.8335256870613262
+2024-05-29,-1.172940972335691,-0.04888056141511726,0.12759680566610498,1.6438978680203566,-0.424457265752737,-1.0664855654065952,1.2264751969277783,-0.28520550570409975
+2024-05-30,-1.4172841609736508,0.06634995513990888,-0.12958706818765542,1.6114111127969066,-0.22187350943527834,-0.8976253237707063,1.2118808902986848,-0.2232718958682103
+2024-05-31,-1.374976993524358,-0.288421105131176,0.128506527357513,1.5297977854202114,0.11231238617945344,-1.2255065490923642,1.0737758813835883,0.04451206740713305
+2024-06-03,-0.9487247905551114,-0.7081259035061868,-0.11787906542841219,1.5706003338430312,0.1393050474773337,-1.1144819611493315,1.351539130573785,-0.17223279125510746
+2024-06-04,-1.2350449175360796,-0.2804357998594952,0.18200487117622455,1.2547218922212353,0.08824512054288244,-1.1272744336190406,1.5297964815546903,-0.41201321448041717
+2024-06-05,-1.4557035390189998,-0.15817283558274295,0.4169732434289693,1.3719040038259023,-0.051131280337977,-1.035863083437253,1.2648318584673788,-0.3528383673452778
+2024-06-06,-1.5703433764976438,-0.5603834225688443,-0.6910805602757993,1.1869773603567717,0.7185314482358374,0.003380839964902294,1.293261179509126,-0.3803434687243506
+2024-06-07,-1.7737634549222698,-0.10544562967422785,-0.996913272934238,1.1017196373363904,0.7346622668489414,0.19726225185767485,1.0134790815747567,-0.17100088008702752
+2024-06-10,-1.3048404639518612,-0.7307325832044054,-0.6658067418054882,0.20836088073574677,1.354067309816784,-0.235731270359189,1.536683643167096,-0.16200077439868346
+2024-06-11,-0.26605266021038076,-0.4938957156482185,-1.3332231680453128,1.0486512941917006,0.4863870288972326,-0.48187693318840125,1.7029127594949183,-0.6629026054915379
+2024-06-12,-0.28653410110269834,-0.7229889452011495,-1.3439551271003045,1.1234530924411754,-0.039849481408457794,-0.4062582101357942,1.7749438354004372,-0.09881106289320846
+2024-06-13,0.5402395557930888,-0.932608112942987,-1.7067677439001303,0.6927502524687085,-0.08921292455332729,0.10346923140972628,1.5498057125300537,-0.1576759708051333
+2024-06-14,-0.07458453989103084,-0.7993444660563107,-1.826029892015548,0.7759829780254371,-0.013287624219655703,0.6580067848723151,1.403680866154788,-0.12442410686999425
+2024-06-17,-0.19529292214032798,-0.33765035115189607,-2.056993996264448,0.5841368642464241,-0.2646870220334223,0.8379353964331823,1.204699565884493,0.2278524650259959
+2024-06-18,-0.40039392513576066,-0.5231601309734422,-1.9770878840117017,0.6705245335135482,0.3275208167183554,0.8859199861998818,1.1402278354452202,-0.12355123175610126
+2024-06-19,-0.6657145228601393,-0.7146586932095189,-1.8533527032320927,1.0831999597960102,0.22722298967518859,0.9606552514583097,0.4840272605968638,0.47862045777537804
+2024-06-20,-0.5886803512843417,-1.1929241512345081,-1.4327105685235832,1.4150867965110459,0.6108053694060135,0.8601242156271741,0.09907124464040462,0.22922744485779484
+2024-06-21,-0.4179090035272015,-1.3203152681144015,-1.5677330912411358,0.9879971357883408,0.9044011436492727,0.7658290475647715,0.19351622922776662,0.45421380665258754
+2024-06-24,-0.0032606824156673673,-1.1865202782175928,-1.8081887485724917,0.6968271629651722,0.6157083612492668,1.0613749187505077,0.0505856968138049,0.5734735694270002
+2024-06-25,0.22695702995980363,-1.6088236115995316,-1.4183630122205495,0.625304057449941,1.1302453219699506,0.7289584772993388,0.380058120465933,-0.06433638332488573
+2024-06-26,0.14525163717504117,-1.573818488453981,-1.33641991051885,0.7844078264109436,1.3206690610521414,0.16466929404290975,-0.0739144284519807,0.5691550087437761
+2024-06-27,0.8373084656374761,-1.4746368119244775,-1.109105198201817,0.6763654149426032,1.4362695962676226,0.3321851953035218,-0.44840766740469024,-0.24997899462023904
+2024-06-28,1.1465830713317595,-1.2605039240949634,-1.2856149641737713,1.0394744814849808,0.9764619273792902,-0.49395727395766814,-0.34246551841640727,0.22002220044677925
+2024-07-01,1.7888135409136907,-1.149787800408695,-0.9998477082248203,0.4641548108992276,0.9338885208685844,-0.356640680887901,-0.21367354977853495,-0.4669071333815518
+2024-07-02,1.7815204231238086,-0.7245080486303895,-1.0314386998972171,0.4503233279663562,1.087821038274255,-0.6698984414499269,-0.4079168079320445,-0.4859027914548415
+2024-07-03,1.678036509077976,-0.40701682022035673,-0.7539354278730214,0.4341638433076481,1.1390414090656231,-1.1937349527226595,-0.18627498929184003,-0.7102795713433696
+2024-07-04,1.5708170856049972,-0.5525971511172347,-1.0900814796567493,0.8951627528775943,0.9329604527386469,-0.8984390731816139,-0.11904171178168058,-0.7387808754839604
+2024-07-05,1.6989060423875728,-0.7706191484310246,-0.6149672200032372,0.7327032620368492,0.555659563121905,-1.3599208233497457,0.33598844623066826,-0.577750121992988
+2024-07-08,1.4135439822349116,-1.0745166910384065,-0.6306105710499025,1.0373118424055432,0.4458544935551421,-1.2357892133011503,0.5907345229222356,-0.5465283657283736
+2024-07-09,1.1525041263499267,-1.0354299799744744,-0.7566258211551217,1.2188721795332658,0.33152028937235795,-1.071455192487586,0.8773851589134072,-0.7167707605517762
+2024-07-10,0.758318854603213,-1.3344231870763092,-0.4545029857286085,0.8091658687802898,0.8169588925561306,-1.1525224859657095,1.1818539712008225,-0.6248489283698284
+2024-07-11,1.1091067252217104,-1.5690645965342847,-0.399787117839317,0.6211768272086687,0.8604000581963155,-0.9467141157706928,0.894867921220645,-0.5699857017030454
+2024-07-12,0.7437520637904222,-1.4623245469260187,-0.24688075040880406,0.6729629373539984,1.2075172763515285,-1.1420259383950953,0.8229094758453578,-0.5959105176113889
+2024-07-15,1.0858492222550797,-1.2943246060393854,-0.0864075114433403,0.20825586832304285,1.3035653525646052,-1.2081186362068477,0.6796758059729578,-0.6884954954261125
+2024-07-16,0.8741058439755773,-1.2671359775691966,-0.0425435449831985,0.16046687920971917,1.4817251573916297,-1.1896271650976031,0.695734206594638,-0.7127253995215665
+2024-07-17,1.0442699111975693,-1.4595405631543148,-0.09092768576914015,0.2805787303163219,1.2651032641996443,-1.1280355313554344,0.6827813338126918,-0.594229459247338
+2024-07-18,1.0897591288509192,-1.0677740867208072,0.015616763143546649,-0.04673524913826895,1.4014977847343786,-1.23327675743804,0.6859734985386421,-0.8450610819703701
+2024-07-19,1.0103923828666364,-1.2695945233449017,-0.026973060749638917,-0.09696467729405407,1.3833780893755845,-1.10030889674175,0.8335165510110518,-0.733445865122928
+2024-07-22,0.6395952737435352,-0.9721649566592818,-0.13979119820866923,-0.40710157785504486,1.3775406215001564,-0.97860993385898,1.356014278205882,-0.875482506867598
+2024-07-23,0.5945771049499484,-0.9872316551772647,0.08069465059811645,-0.16573162339094927,1.4345459114762997,-1.0686360012487497,1.1585513815237507,-1.0467697687311515
+2024-07-24,0.26330175831355723,-0.7954678006020274,-0.2069394302189306,-0.24382901357777775,1.4376664150443443,-0.5080113430340314,1.417547154183528,-1.364267740108662
+2024-07-25,0.24558160992727196,-0.3037202145755557,-0.22390484146818043,-0.2524925004662909,1.3366990326853556,-0.42551341702387635,1.3437977788048243,-1.720447447883549
+2024-07-26,-0.28983446256259976,-0.3811686706082418,-0.6411430539990656,-0.22025420640447751,1.339857431341943,-0.1228505476921939,1.6495217063701373,-1.3341281964455023
+2024-07-29,-0.2821338151132527,-0.5292384822816327,-0.4151424333641226,-0.3784196458000489,1.5473958505195429,0.25189937442385285,1.289900537432347,-1.4842613858166862
+2024-07-30,-0.9089185283903811,0.007042198287951054,-0.8820057169361891,-0.4782541546489428,1.6168195399791199,0.35647075579968424,1.2362708342469209,-0.9474249283381628
+2024-07-31,-1.3127847161602237,-0.21388474366392082,-0.8856482321911611,-0.051292058286750215,1.1925735837327036,0.3925182512355789,1.5531814740624437,-0.6746635587286701
+2024-08-01,-1.258749380653976,-0.5104583723545582,-0.9439324683034637,-0.06434746156179853,1.038247267721857,1.40339271934224,0.9281763701776796,-0.5923286743679803
+2024-08-02,-1.4174475605498333,0.03138974257430868,-1.0593780851060148,-0.17132786134337427,1.3314236452950607,0.994463134697194,0.8645599612040755,-0.5736829767714169
+2024-08-05,-1.2813943608035419,0.3384014063673764,-1.1449878644548663,-0.15699539005790372,1.5230519895739485,0.8477740432904455,0.593406154467267,-0.7192559783827254
+2024-08-06,-1.1883195533050388,0.2549075948534306,-1.0203568625808614,-0.2944542618421638,1.2713987627105063,1.0762113127347699,0.8490452942872955,-0.948432286857938
+2024-08-07,-0.8516305421664709,0.377175606324263,-1.1768915500437809,-0.3210170124953291,1.234166664870623,1.0819862807091394,0.8005714913522555,-1.1443609385506999
+2024-08-08,-0.7365998207828661,0.41009166473655845,-1.1960412921167403,-0.5180597241996626,0.6826073542427925,1.7707355062662171,0.46583598929133857,-0.8785696774376378
+2024-08-09,-1.0864993015398523,0.4824177661795692,-1.085254995968478,-0.33325743203223884,1.177481644984895,1.3303474325172515,0.4729030823484101,-0.9581381964895566
+2024-08-12,-1.2212706843015695,0.6346252754845926,-0.983650300448197,-0.07329682627298516,0.8711734369614857,1.4816701182950298,0.32618295654921625,-1.035433976267573
+2024-08-13,-1.3898941625749919,-0.039045981012644414,-0.881644371330997,0.6259047829854585,0.4689400179895452,1.7316509560287208,0.2645451227372644,-0.7804563648223557
+2024-08-14,-1.1474207165166488,-0.07759806412819942,-0.8046186196470605,0.6625137742340377,0.11649076458703167,1.8780360430045657,0.33962136247363295,-0.967024544007359
+2024-08-15,-1.283982482886145,-0.012010322319184343,-0.9189551414670365,0.560808258660582,0.38706066709152614,1.7645030007105063,0.38581861355430774,-0.8832425933445559
+2024-08-16,-1.1994840566591385,0.01499658050747406,-0.8747645269384318,0.554131901490419,-0.1858155854666078,1.9541830017829456,0.41643188177157636,-0.6796791964882372
+2024-08-19,-1.223259887016669,0.6744590911718265,-1.3486115351150318,0.7526291617529348,0.12286647273895013,1.4705359414260188,0.21462927803164678,-0.6632485229896761
+2024-08-20,-1.031856392193815,0.22486506990094468,-0.7596364811346622,1.6306834662803589,-0.2305294683152958,1.2753454733528855,-0.13367234012239435,-0.9751993277680213
+2024-08-21,-1.2575722210740885,-0.06258086485550961,-0.9869427652240461,1.562654094536744,-0.18292162235944867,1.2716368863332606,0.20790869662473108,-0.5521822039816431
+2024-08-22,-0.45567018336471365,-0.27422444041288735,-1.128826135692659,2.0765727298010255,-0.41689562719018597,0.8462884274507366,-0.19853455503175693,-0.4487102155595592
+2024-08-23,-0.09678896274580415,-0.33629752552623343,-1.159837529205747,1.6514607228576608,-0.72945148877391,1.3748583722523648,-0.6116706116632978,-0.09227297719503336
+2024-08-26,0.12273552554756785,-0.28167875726442765,-0.8593849099381563,1.5740605297185315,-0.46825423762136575,1.4912562160089868,-0.783208405563195,-0.7955259608879414
+2024-08-27,-0.03914596538131389,-0.3984771955037938,-0.9151831988483778,1.9969372359609867,-0.8784373348992378,0.9227617609884243,-0.06652445014634124,-0.6219308521703465
+2024-08-28,0.022378797117832822,-0.6114963475352728,-0.6884988748931509,2.1393811694512705,-0.4769918894416178,0.22274469515045148,0.44220156884709194,-1.0497191186966053
+2024-08-29,0.3474223213922202,-0.7005309661706682,-0.23667685012517994,2.019432042065053,-0.24688144753585067,-0.10980980217856243,0.35957123810648484,-1.4325265355534966
+2024-08-30,0.821251091674108,-0.5266197961197066,-0.28291202096160245,1.7973200284330009,-0.7019056115663477,-0.776254112130783,0.7255812977380084,-1.0564608770666772
+2024-09-02,0.7798103994840477,-0.8679075434202795,0.32503849552066666,1.8090146268851686,-0.7484845376839759,-0.7204343599061109,0.423769191672617,-1.0008062725521332
+2024-09-03,0.517000689612607,-1.1302959019212366,0.522277069607517,1.9464301081895774,-0.7578463092228614,-0.2053850434504269,-0.010618843440172526,-0.8815617693750041
+2024-09-04,0.3867725698112822,-0.9602004812645607,0.780898145747645,1.9376612436617524,-0.3416557409211381,-0.1886813704022997,-0.5750404772538942,-1.039753889378787
+2024-09-05,-0.22959124761277097,-1.3004695304538656,1.5102597485624445,1.5307881080056243,-0.4050322543213505,-0.1693788512021326,-0.4847579711032751,-0.45181800187467364
+2024-09-06,-0.15312928794808814,-1.170684356225934,1.3513713340468152,1.6998379720085182,-0.37099142037442506,-0.1682330390104936,-0.6904794627433175,-0.49769173975307485
+2024-09-09,0.375360009992812,-0.903977563443262,1.3256437324376997,1.5962485877661174,-0.8407395831972734,-0.3908261918746591,-0.8988297454325516,-0.26287924624888326
+2024-09-10,0.4508885823129661,-1.0753688002294786,0.9710774391980479,1.5769076141662297,-0.7984637523114869,0.4405507457910773,-0.5057722669861746,-1.0598195619411814
+2024-09-11,1.02175428999289,-0.458853093046068,1.2912369991724728,1.0873546482893164,-0.8796063272151656,-0.1325870696401163,-0.6157556928608486,-1.3135437546924802
+2024-09-12,0.5121934646248971,-0.25629824441757604,1.6383853639027361,1.0340400542428514,-1.0377766863128097,-0.32361129769479097,-0.27894678543128926,-1.2879858689140193
+2024-09-13,0.39592704772027454,0.093033464734376,1.3831355489731987,1.236651442713423,-1.1424082317886803,-0.2140737695491862,-0.37310468722462814,-1.3791608155787776
+2024-09-16,0.14510244961087246,-0.16295700701320026,1.539443422637013,1.2174694495100937,-0.7526010920266877,0.040306551094600934,-0.5243248034330477,-1.502438970379644
+2024-09-17,-0.37963557882277854,-0.19214875552469968,1.2369970364514773,1.538895705548952,-1.0633044047072304,0.33123306602210084,-0.18975126702613435,-1.2822858019416872
+2024-09-18,0.34710530670744,-0.09138714316923718,1.2140382110146761,1.5133310126021504,-0.9857224827971311,-0.15690282201385453,-0.46350950801916163,-1.3769525743248814
+2024-09-19,0.35531910635890906,-0.13507985552465138,1.2326755828260314,1.4185757700453456,-0.866136352065268,0.1413455948242455,-0.7202744465408784,-1.426425399923734
+2024-09-20,-0.17503857114551657,-0.418667505018188,1.8157766808086484,1.1127098377726425,-0.5294833553291278,0.16826067324247823,-0.9494862079841169,-1.0240715523468202
+2024-09-23,-0.2567309192019911,-0.7030993974546059,1.7142664434113455,1.3267431475502474,-0.7375239661209331,0.10289971918301326,-0.45870901835975825,-0.9878460090073167
+2024-09-24,-0.21410879005576333,-0.8873773066464666,1.7605079821683038,1.1902778332044202,-0.748352541642321,0.23283216906026152,-0.3959254239118603,-0.9378539221765742
+2024-09-25,-0.005765711625665728,-0.937081974681311,1.7234151763946273,0.12131903463373454,-0.5355148052726196,1.1795743209672962,-0.40977907366269,-1.1361669667533714
+2024-09-26,0.07278513447787878,-0.8923416061920876,1.496976711392884,-0.17494271662559047,-0.39519455069365556,1.5483241975678537,-0.7898532932970727,-0.8657538766302103
+2024-09-27,-0.21140850284897827,-1.1095143700022552,1.298125505015916,-0.3700785909860773,-0.1136840772635031,1.7558878714331765,-0.5112619537467181,-0.7380658816015603
+2024-09-30,-0.6214638573779238,-1.2153339112408619,0.7692657934496395,-0.1575174997618651,0.4223601215155351,1.9176741029239677,-0.7036207453191164,-0.41136400418937524
+2024-10-01,-0.5921146403101555,-1.2903218186732068,0.8100555659447588,-0.4597604119088995,0.3930972453620705,1.889877878239108,-0.14211383377521877,-0.6087199848784562
+2024-10-02,-0.7789260921348405,-0.92316190418522,0.5433857594887795,-0.6525504974972905,0.5639513978132683,2.0034971260159757,-0.06029445142851031,-0.6959013380721626
+2024-10-03,-0.5189067247752372,-0.6620962483032373,0.4327606740685374,-0.7012117596640698,0.450500158984006,2.076406267765102,-0.02955064885334724,-1.0479017192217541
+2024-10-04,-0.15447263444319728,0.018475950311669518,-0.6249720483586492,-0.5810632753626406,0.4857796071489506,2.1536878768750927,-0.13318425317452987,-1.1642512229966957
+2024-10-07,-0.3349666833057248,0.6245661855067013,-0.7519479471311751,-0.8403738255356282,0.6191332899554569,1.9110048607204897,-0.14599005546080243,-1.0814258247493176
+2024-10-08,-0.46625089327116975,0.21514578564749953,-0.9151411869219682,-0.9557561661104349,0.7063848503645663,2.048872476290123,-0.10685933389504017,-0.5263955321035757
+2024-10-09,-0.6699373745144687,0.28245642555946654,-1.1977996508728581,-1.1957891576195958,1.1581985379691908,1.4842501809314055,0.2316931225046889,-0.09307208395782869
+2024-10-10,-0.38159854385392783,0.2822382491498799,-1.5120405559616321,-0.9401277170726879,0.8519585029385215,1.6668901235555837,0.23964177396017713,-0.20696183271591523
+2024-10-11,-0.30173657060216136,0.3879334152365698,-1.6620982269231284,-0.9379566894709743,0.8330355131962793,1.4697183987480023,0.4518370918772664,-0.24073293206185364
+2024-10-14,-0.36542702608556854,0.6450945027316705,-1.6469305384283355,-1.0926034598992276,0.5216508208984124,1.407713453296631,0.538802388892578,-0.008300141406160288
+2024-10-15,-0.37033061995471633,1.118369196538364,-1.8189920689004957,-0.9766184602963968,0.32116607414663934,0.8205937662796088,0.7382306438102127,0.16758146837678445
+2024-10-16,0.10541064478849416,1.2052006902144345,-1.7043604121464033,-1.0796244637502646,0.8332001002976286,0.840089639631765,0.05168332289205155,-0.251599521927706
+2024-10-17,0.028924003852802294,0.9109242510757868,-1.7629610988949362,-1.075752439925124,0.8370941245063211,1.0508699630496736,0.22792710481242012,-0.2170259084769437
+2024-10-18,-0.05867577093880498,0.7341706624766182,-1.604228411404448,-1.2696777263666275,0.9691721185806975,0.9656886198477469,0.559175374664488,-0.29562486685967004
+2024-10-21,0.1389606903201584,1.0436844035988533,-1.6277005929024635,-1.1357626511256504,0.446198636829456,1.0293994140605207,0.6390206398050348,-0.5338005405859092
+2024-10-22,0.06634459912123185,1.106598825307407,-1.6575481284774352,-1.1379451858695604,0.8517893341490891,0.7602698244457263,0.46624541245039014,-0.45575468112684886
+2024-10-23,-0.19296896372883396,1.0877065135127508,-1.825873623388689,-1.0026447083044732,0.731008418674414,0.7658744918405306,0.5532396907834876,-0.11634181938918683
+2024-10-24,-0.3649032186821979,1.361439667452494,-2.0164487923277514,-0.22619656633110335,0.8003093967628222,0.14667023251779582,0.4572581593045984,-0.15812887869665768
+2024-10-25,-0.6639696324376314,1.4843472199169505,-1.7989429830868844,-0.2538200133227162,0.723097224212289,-0.05339422215120832,0.7121607237920617,-0.14947831692286143
+2024-10-28,-0.4436733878207738,1.7585401447314217,-1.84467575208564,-0.28500630814011,0.21105126101642735,0.39533770662027456,0.1493681927017925,0.05905814297660801
+2024-10-29,-0.3529023908274701,2.17107201696296,-1.1911375917744391,-0.5884682855595118,-0.05750478324767179,0.2772813028079171,0.2471548224385459,-0.5054950908003294
+2024-10-30,-0.40623874829356427,2.0778762507245943,-1.4232791778332718,-0.033179634194190684,-0.31484567077433123,0.48087982821298675,0.018607625096981325,-0.3998204729392037
+2024-10-31,-0.32197057474102125,2.092564963537683,-1.2559102469719507,0.3304936063027964,-0.42917614814701543,0.47521954079088535,-0.5547135289903311,-0.33650761178104655
+2024-11-01,-1.07207593882691,1.0795872419334407,-1.6516837421890793,0.731587401099769,-0.5618754863218869,0.5652648782213765,0.022557053741559488,0.8866385923417311
+2024-11-04,-0.8333800689746803,1.0814494290649352,-1.0150874514512156,0.4895235815323282,-1.0986025797273014,-0.6910668754632202,0.8838748711920335,1.183289093827121
+2024-11-05,-0.7627281978627799,0.791735230578037,-0.7878803875368702,1.7938029793577297,-1.2575345783258713,-0.21208471250178623,0.5579807774294776,-0.12329111113793748
+2024-11-06,-0.6061244856669105,0.8801335418139336,-0.36539892545273,1.8382619022073534,-1.372730483620456,0.08789513742555753,0.18515552346474592,-0.6471922101714952
+2024-11-07,-0.661971825769618,0.7844720335668145,-0.2770319028288044,1.3514405761248203,-1.362263691649919,1.2407356717004698,-0.7245717479666638,-0.35080911317709906
+2024-11-08,-1.3591608405760751,0.9769038856659061,0.1981820321826382,0.9038397528318652,-1.5068190938583566,0.9492965312285553,-0.3615754334367536,0.19933316596222014
+2024-11-11,-0.1700055263197357,0.7385902275042633,0.22909092552209878,0.6498669448783534,-1.8551684747665866,0.2704256054689208,-1.0328944857076696,1.170094783420355
+2024-11-12,-1.1925848694917176,0.8928321509816715,0.21826784060139776,0.9124809207603717,-0.8444868885935584,0.897436955098144,-1.4397451335456275,0.5557990241893175
+2024-11-13,-1.800233712463011,-0.41250481104625536,0.33620658174705803,0.5598641780371082,-0.18009758291628034,1.4190048153021266,-0.7072706716668278,0.7850312030060818
+2024-11-14,-1.6654887761534831,-0.811089519467177,0.16371868783709506,0.5108166373718674,-0.8308622716696734,1.2051341287157629,0.47037177535405916,0.9573993380115495
+2024-11-15,-1.5056540872526978,-0.5550472958827446,0.3110398627712829,0.7884269148804635,-1.350053047161274,0.8947474608764173,0.5081999004656261,0.9083402913029263
+2024-11-18,-1.1354006275568345,-0.6051490108666214,-0.18418674670812035,1.2116242518364533,-1.4111943775676659,0.2337180791200207,0.8765701902922731,1.014018241450495
+2024-11-19,-0.9810249567991248,-0.5324709086884354,-0.21034654904118694,1.4657204787646807,-1.4022750040965823,0.0001281271846751544,1.1594223534839436,0.50084645919203
+2024-11-20,-0.5520433828842962,-0.45247595927807027,-0.25838851972667726,1.482719569570861,-1.450339546793515,0.6057649182874875,1.1954701789830782,-0.5707072581588678
+2024-11-21,0.138086759580115,-0.5773214067286947,-0.03273270879115037,1.706901299896436,-1.577679312698195,0.3990209987452674,0.7077885800699395,-0.7640642100737176
+2024-11-22,0.045449472952158766,-0.2540267602511433,0.2211752977356933,1.7100118740400414,-1.6424679456846032,0.7088938742829586,0.07920426628287928,-0.8682400793579852
+2024-11-25,0.8096354423579235,-0.11538419537859208,-0.01892634036524231,1.4806812298519478,-1.7517070459454005,0.6634017906139801,-0.36089129691365257,-0.7068095842209642
+2024-11-26,0.7092272043381292,0.050854788436700535,0.0351845237869567,1.5488082139515762,-1.695552015893598,0.49151331682267463,-0.16502253852832008,-0.9750134929141193
+2024-11-27,0.4866737022430751,-0.1281380295581784,0.1781618915907418,1.6605137663901772,-1.829738940921969,0.43568446537036354,-0.18091384873927208,-0.6222430063749376
+2024-11-28,0.8574640201985059,0.4020025612974883,-0.5854658569635534,0.7539433302939094,-2.149116010861293,0.5898642915970672,0.39481049537404117,-0.26350283093616533
+2024-11-29,1.1452220646682876,0.4541171263368747,-1.0017416205871237,0.3893610342044442,-1.7556292184237998,0.12394390158281093,1.037109275560423,-0.39238256334191685
+2024-12-02,1.1194272579606208,1.482947587905534,-1.2588801902886797,0.3560322960619164,-1.1834075656447178,-0.12695301114048566,0.2200943796043128,-0.6092607544585011
+2024-12-03,0.7554394423793526,1.485543679683076,-1.3429915076243972,0.7353137542605441,-1.067770794481543,0.012924827408463983,0.24488150367537315,-0.8233409053008693
+2024-12-04,0.8337916801848325,1.5934842797435391,-1.3221988849108526,0.3619024406178141,-1.0328620406716875,-0.17677871034947082,0.4858424927206688,-0.7431812573348433
+2024-12-05,1.1103951972592747,1.479602691145239,-1.4251446295616865,0.4154228498721013,-0.655191562763363,-0.35577752215616,0.2881798626693099,-0.8574868864647155
+2024-12-06,0.5428249226167516,1.2879034051373286,-1.3532655680775265,0.7196269769847978,-1.1812196984615764,-0.015274285997692198,0.8065297948940048,-0.8071255470960879
+2024-12-09,0.5401553853114461,1.1846875543199704,-1.386508759328115,1.0546674404546446,-1.0850110227572025,0.14735185786495664,0.4678098081608317,-0.9231522640265318
+2024-12-10,-0.02778501788255712,1.5659263907582666,-1.258627325627605,0.6875710950416105,-0.6420856085494192,0.5734490038049271,0.3709839974546688,-1.2694325349998914
+2024-12-11,0.6779295634785696,1.5264528647653821,-1.244677230034903,0.7425913873358994,-1.1836775214544397,-0.007949232234298003,0.2823184479713663,-0.7929882798275766
+2024-12-12,1.035562291138178,1.3426271443453897,-1.130807350885875,0.7210822031643424,-1.3534015025945014,-0.18217891341466302,0.21233497404983506,-0.6452188458027054
+2024-12-13,1.2501086788021762,1.375539490245746,-0.8210338103171192,0.6320331914730056,-1.2980890988169187,-0.3547656643882147,0.028518507270630305,-0.8123112942693053
+2024-12-16,1.039724575930627,1.460147757270526,-0.7861346924425388,0.6276542830010096,-1.396497686070237,-0.23550790629326282,0.15407959045172856,-0.8634659218478523
+2024-12-17,0.9662878746800551,1.741510011653288,-0.8554183165398966,0.3142098708642187,-1.324346894201667,-0.21641269509498562,0.008333911772686917,-0.6341637631336996
+2024-12-18,1.0878234715578747,1.7364170716417557,-0.6558179418162347,-0.12494600959332829,-1.2739338698322464,-0.2519075955722547,0.2586035257041661,-0.776238652089732
+2024-12-19,0.11170386205076542,2.109163205124809,-0.3072017956000623,0.1645387450611613,-1.2758871016867865,-0.5324927675357295,0.34968461453579763,-0.6195087619499546
+2024-12-20,-0.18853597387595272,2.144779405275725,-0.35818044031699803,0.36500525195039235,-0.8835446274414649,-0.5674830615200074,0.40317337022680727,-0.9152139242985021
+2024-12-23,-0.24932779432509203,2.0102350086354384,-0.728201386095764,0.14513137542945415,-0.9595085968489809,-0.2915164940939316,0.8542532978453256,-0.7810654105464496
+2024-12-24,-0.4460467907960159,1.9080988690390726,-0.20408438118328598,0.2147029474234673,-1.0596104538426594,-0.3296774089180422,0.9168270816080014,-1.0002098633305376
+2024-12-25,-0.5095564824614308,1.9843327771240944,-0.33978894009588706,0.16784364682205585,-0.8293721313718646,-0.4035224104847117,0.9152984656875338,-0.98523492521979
+2024-12-26,-0.39413713466142136,1.74707414508786,-1.0897235698830485,0.31627472083157165,-0.7257110227564401,-0.07263600030164358,1.096591680700222,-0.8777328190171004
+2024-12-27,-0.35087509853398885,1.7072337697317648,-0.8716792063101476,0.5517553266893221,-0.26466885466780715,0.21734789556531042,0.5758444440801808,-1.5649582765546342
+2024-12-30,-0.4603326585130938,1.9140898961937862,-0.7336951424426846,0.15050818441703168,-0.12487589740589897,0.14049366247118383,0.5902005515451967,-1.4763885962655212
+2024-12-31,-0.2140559748030299,1.6493323147547705,-0.4857582895634113,-0.04322648143101791,-0.6419228890366739,-0.12116853795036905,1.262388939500324,-1.4055890814705927
+2025-01-01,-0.30536601884265235,1.8501987675409715,-0.7671775687815046,0.36714526001435577,-0.5375083727210473,-0.29950522825677156,0.9264246007189366,-1.2342114396722879
+2025-01-02,-0.6477357910840225,1.9273568761217508,-1.1655377555757573,0.548396440610199,-0.5471130125311094,0.19876869553225066,0.4825941830004086,-0.7967296360737199
+2025-01-03,-0.5900787340832165,1.9457421469438474,-0.7949227741551147,0.6317824443444363,-0.748641616548743,0.123280723182188,0.45748045115044406,-1.0246426408338418
+2025-01-06,0.43774220799464225,2.2486432420608593,-0.6401769789016357,-0.03013942896819906,-0.09660365808899407,-0.7830034595437477,-0.3771147118071118,-0.7593472127458132
+2025-01-07,0.6208081785952422,2.2089925669638077,-0.6410173755050307,-0.23762906192672695,-0.07840506815622923,-0.6057900220717839,-0.41917088041522016,-0.8477883374840587
+2025-01-08,0.6251437955374654,2.1151424236546936,-1.0766450575138498,0.1613630233773813,-0.22780153538875414,-0.6122996280107622,-0.35398887624144665,-0.6309141454147269
+2025-01-09,0.2649369806658018,2.2173524197298073,-1.196651401877868,-0.137919391145009,0.03770015471562946,-0.6206143578735948,-0.19275060828623825,-0.3720537959285288
+2025-01-10,0.1477237120981042,2.1042404891817883,-1.4054301630737014,-0.2654262456960259,0.2294460116356065,-0.6161184455837867,0.06635901193242005,-0.26079437049440546
+2025-01-13,-0.33099153159561456,2.050877028468625,-1.3139405398692987,-0.18342383173655982,0.6966950867945638,-0.582428561219625,-0.021860651731893485,-0.31492699911019784
+2025-01-14,-0.41916277218876863,1.9789768922387332,-1.1050824110866209,-0.32190141769251357,0.8808873911627154,-0.779430426859504,-0.41057652224896674,0.17628926667492506
+2025-01-15,-1.0746993224270565,1.7820358671735004,-0.4051373040519643,-0.2448670535227979,0.9959761869747695,-0.7812116445294807,-0.7708691709196287,0.4987724413026582
+2025-01-16,-1.0283194415543657,1.9016697011666277,-0.6130717063411146,-0.008933513859442894,0.5720173099076244,-0.4836330430459333,-0.9857880640858925,0.6460587578124967
+2025-01-17,-0.25878899194551613,1.6668730413341524,-0.9268361213913175,-0.35752245320318793,0.6361703661138968,-0.43668373421203627,-1.2841203227131655,0.9609082160171744
+2025-01-20,-0.014629668736956758,1.4651420862057436,-0.9357385319125173,-0.9852210193743718,0.3705067420529014,-0.24860955306203866,-0.9977003035838224,1.346250248411062
+2025-01-21,0.031201833858377777,1.416696647749609,-0.9861878654102109,-0.8640961803575034,0.6166374901519861,-0.4882951345034066,-1.0067757043445853,1.2808189128557335
+2025-01-22,-0.06908581506210185,1.3673963282548534,-0.9318715482271891,-0.900780500777285,0.6221792364010733,-0.6533963464143437,-0.828909091169098,1.3944677369940905
+2025-01-23,-0.07488938492720248,1.4331858717289585,-0.709634809208009,-0.9701206597305531,0.15234998590683116,-0.4351705634297007,-0.942949243018171,1.5472288026778467
+2025-01-24,-0.33776312321005075,1.6801585616377543,-0.4190983077455527,-0.719349448849031,-0.008728187151114652,-0.6097532546950499,-0.9993983443375634,1.4139321043506081
+2025-01-27,-0.3306424338178491,1.7043715141851916,-0.03539507356709097,-0.8723059427546842,0.13885961810523295,-0.7481149667192747,-1.076081401946369,1.2193086865148435
+2025-01-28,-0.4639070922163544,1.6987439773891682,0.06752496656454088,-0.45455288635119834,-0.09647716067202759,-0.6936741623705507,-1.2928951314465933,1.2352374891030156
+2025-01-29,-0.2270086692906389,1.6528755727679472,-0.35537400580298284,-0.46284278325819994,-0.06254140659694678,-0.4670059262469066,-1.3901434109804955,1.3120406294082234
+2025-01-30,-0.24094151621716905,2.0208560597121994,-0.4018490042303151,-0.5478574184549858,-0.23292976653564373,-0.33844050627865657,-1.1768349899248234,0.9179971419293943
+2025-01-31,-0.11704525393010323,1.8453838917785406,-0.412008300155963,-0.8237171517519781,-0.01964333521518573,-0.6128512970248433,-1.013304847488788,1.153186293788321
+2025-02-03,-0.5140354961587932,1.938507240270119,-0.41608038596584573,-1.0094128848659083,-0.13214562065578206,-0.4477380362526092,-0.5459870946068669,1.1268922782356865
+2025-02-04,-0.9705024344783469,1.9916381659751234,-0.06937471556414532,-0.7375260570084917,-0.0983008749214044,-0.6386668882794946,-0.441684682793683,0.9644174870704425
+2025-02-05,-0.8879461687804624,1.917312372685012,-0.012293549646678717,-0.859267572913341,-0.01146681024563115,-0.7838542833930595,-0.38095644110164784,1.018472453395809
+2025-02-06,-0.7468107980859952,1.9198420840243557,0.0980990349480523,-0.8029290219078752,-0.12665540775387063,-0.7921173358843524,-0.598474798057703,1.0490462427173881
+2025-02-07,-0.814152122988122,1.9739662709016514,0.5034609456377378,-0.7513157244450006,-0.0056914676776799065,-0.7748478386213731,-0.7776117304186935,0.6461916676114802
+2025-02-10,-0.7818630379873618,1.9339320357196172,0.7264757006246472,-0.4229175666634824,-0.010603599842888679,-0.6549088595726043,-1.1699161009810388,0.37980142870311145
+2025-02-11,-0.5232160876292892,2.0113539036636428,0.5443579985178657,-0.6431025038896574,-0.5498072962755493,-0.576842127945979,-0.9379827106484185,0.6752388242073856
+2025-02-12,-0.4138784580497878,2.202490547417499,0.4555266970018698,-0.7835869311582543,-0.3925959985633513,-0.558647854788225,-0.7839509856222243,0.2746429837624742
+2025-02-13,-0.4545879244998764,2.343279409815495,0.005549475965898336,-0.8568865812803202,-0.1850508380881151,-0.5045262824296396,-0.5046762679067339,0.15689900842329157
+2025-02-14,0.01812330774352229,2.0933293423438073,0.5706044903971065,-1.025288192414769,-0.27390895077350275,-0.7857230474769035,-0.7287808405864166,0.13164389076715635
+2025-02-17,-0.5573688229215352,2.3653709868216253,0.31952576691957985,-0.5435570059719502,-0.3939718259648914,-0.3412621029839618,-0.60458820938516,-0.24414878651370603
+2025-02-18,-1.0303322366630274,2.3162107803505854,0.07090222277020501,-0.3297506428215175,-0.12862722663973114,-0.2984976286102608,-0.5951064315666021,-0.004798836819651409
+2025-02-19,-1.0582905295959817,2.267358409101083,0.34755766163090024,-0.35367211404836624,-0.45556573549058094,-0.35386318043156756,-0.4005227117194143,0.006998200553927557
+2025-02-20,-0.9019380451838446,2.286389578237247,-0.06959384901772535,-0.4127403415640345,-0.09139125893213959,0.117024291488123,-0.8708918576964367,-0.05685851733118922
+2025-02-21,-1.0468793964950063,2.2572261378353438,-0.2622738523407896,-0.4870436266966735,0.3532790141035133,-0.18277326539910066,-0.5853451942364808,-0.04618981677080606
diff --git a/agent/tests/factors/fixtures/goldens/academic_smb.csv b/agent/tests/factors/fixtures/goldens/academic_smb.csv
new file mode 100644
index 000000000..48a8d2fa2
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/academic_smb.csv
@@ -0,0 +1,301 @@
+date,C00,C01,C02,C03,C04,C05,C06,C07
+2024-01-01,,,,,,,,
+2024-01-02,,,,,,,,
+2024-01-03,,,,,,,,
+2024-01-04,,,,,,,,
+2024-01-05,,,,,,,,
+2024-01-08,,,,,,,,
+2024-01-09,,,,,,,,
+2024-01-10,,,,,,,,
+2024-01-11,,,,,,,,
+2024-01-12,,,,,,,,
+2024-01-15,,,,,,,,
+2024-01-16,,,,,,,,
+2024-01-17,,,,,,,,
+2024-01-18,,,,,,,,
+2024-01-19,,,,,,,,
+2024-01-22,,,,,,,,
+2024-01-23,,,,,,,,
+2024-01-24,,,,,,,,
+2024-01-25,,,,,,,,
+2024-01-26,,,,,,,,
+2024-01-29,,,,,,,,
+2024-01-30,,,,,,,,
+2024-01-31,,,,,,,,
+2024-02-01,,,,,,,,
+2024-02-02,,,,,,,,
+2024-02-05,,,,,,,,
+2024-02-06,,,,,,,,
+2024-02-07,,,,,,,,
+2024-02-08,,,,,,,,
+2024-02-09,,,,,,,,
+2024-02-12,,,,,,,,
+2024-02-13,,,,,,,,
+2024-02-14,,,,,,,,
+2024-02-15,,,,,,,,
+2024-02-16,,,,,,,,
+2024-02-19,,,,,,,,
+2024-02-20,,,,,,,,
+2024-02-21,,,,,,,,
+2024-02-22,,,,,,,,
+2024-02-23,,,,,,,,
+2024-02-26,,,,,,,,
+2024-02-27,,,,,,,,
+2024-02-28,,,,,,,,
+2024-02-29,,,,,,,,
+2024-03-01,,,,,,,,
+2024-03-04,,,,,,,,
+2024-03-05,,,,,,,,
+2024-03-06,,,,,,,,
+2024-03-07,,,,,,,,
+2024-03-08,,,,,,,,
+2024-03-11,,,,,,,,
+2024-03-12,,,,,,,,
+2024-03-13,,,,,,,,
+2024-03-14,,,,,,,,
+2024-03-15,,,,,,,,
+2024-03-18,,,,,,,,
+2024-03-19,,,,,,,,
+2024-03-20,,,,,,,,
+2024-03-21,,,,,,,,
+2024-03-22,-0.7548342867712774,-1.8182698674702338,-0.709783142616623,0.8080567011847152,0.9606370284445771,0.908806941904108,0.43568223242456333,0.16970439290026568
+2024-03-25,-0.6447911699236505,-1.79682358562089,-0.8224771772579752,0.9268661127048236,0.8566957017529944,0.9421082882211373,0.433032869696028,0.10538896042748568
+2024-03-26,-0.6080303207998048,-1.8070149836086087,-0.8370252565277714,0.9621118110242532,0.788947858428387,0.9055733506354345,0.5415945705753352,0.05384297027290534
+2024-03-27,-0.5485215336481237,-1.7932834363194614,-0.8993770075167181,0.8324717490992617,0.8559640389699202,0.9309447076698016,0.618080983849006,0.003720497896399312
+2024-03-28,-0.5445657383785046,-1.7970503666679307,-0.9164958671199509,0.762637341014614,0.8042284608062874,0.9991732170034423,0.6357473038448505,0.05632564949721279
+2024-03-29,-0.506361338317519,-1.8051575901269377,-0.8802807990483379,0.7567274705686582,0.8806159615117896,0.9855317764935937,0.6227510500780957,-0.053826531159403286
+2024-04-01,-0.5426363837088231,-1.771706885571196,-0.8723371423588109,0.9040558697906097,0.8344396472285379,0.9615821266828671,0.5961402444619042,-0.109537476525169
+2024-04-02,-0.6585873400449332,-1.725056942566832,-0.9121356358030349,0.766933194594497,0.842469099009544,1.0434029102984546,0.608812312320498,0.034162402191847456
+2024-04-03,-0.6059206647212951,-1.7682282612893465,-0.816087380575058,0.697108793638794,0.8654585259372991,1.0533211331389323,0.6938851776288832,-0.11953732375810724
+2024-04-04,-0.5633065502098706,-1.7594913243063173,-0.8211781847327279,0.5589048850541299,0.7771148103744011,1.2142139790678332,0.712611317556874,-0.11886893280426045
+2024-04-05,-0.5270939933318468,-1.777904775318872,-0.8470088461558233,0.47508674088244995,0.8471740015112735,1.1494696990278916,0.7571051567727891,-0.07682798338798968
+2024-04-08,-0.4226620915676077,-1.820066682410922,-0.8799349791869359,0.6145312842778857,0.7882299256659467,1.1056945880417672,0.7097745111115398,-0.09556655593163184
+2024-04-09,-0.33876010020051667,-1.8260579438832505,-0.8394388505522783,0.5090377081257158,0.6683967491371563,1.2471387196818549,0.7463783860357394,-0.16669466834446392
+2024-04-10,-0.2783397665581251,-1.778935632060824,-0.8260888720509529,0.5696775980984738,0.6242134180361462,1.2735578300778674,0.7793047359696158,-0.36338931151228826
+2024-04-11,-0.16636469171061394,-1.8002063790151461,-0.8316275120950224,0.5322593327188064,0.5651028389910305,1.2474192190759996,0.8506020021347018,-0.3971848100999326
+2024-04-12,-0.24560918116511912,-1.7714062605306822,-0.8652009111976909,0.5293927880656288,0.6316916267441288,1.2674435181308132,0.8033000518831629,-0.3496116319302635
+2024-04-15,-0.22281931096047747,-1.75396458795679,-0.8832091929973578,0.5341513713198143,0.6020587902301865,1.2363072588885233,0.8757334537467205,-0.3882577822706641
+2024-04-16,-0.3084884897366962,-1.725371854263616,-0.8181919493532365,0.40266456797700806,0.6806677338447137,1.326451709575046,0.8439369498914232,-0.40166866793470896
+2024-04-17,-0.17000847893675053,-1.7977410573372523,-0.9060718147254067,0.4049015194757736,0.7050456956303156,1.2126934837405348,0.8389276405925851,-0.2877469884397348
+2024-04-18,-0.11099109509413146,-1.8601395618632237,-0.8045737176701412,0.43170399241497387,0.7218293029984417,1.1690631565780747,0.8196201386773682,-0.3665122160412978
+2024-04-19,-0.1891676326254843,-1.7365113109877195,-0.8848420016157857,0.2672238663535623,0.7114393908055551,1.3245023615008704,0.8474928217707465,-0.34013749520172326
+2024-04-22,-0.3006765618437811,-1.693690685707946,-0.943844080747092,0.27783980130528946,0.7433709029068731,1.314175377164239,0.8544101379024533,-0.25158489098001524
+2024-04-23,-0.22625371006982042,-1.7321440397585162,-0.8481699835605009,0.17765474879253126,0.7081016627063279,1.3429043741440716,0.8913422231362109,-0.3134352753902839
+2024-04-24,-0.18101195408242557,-1.7898516476113768,-0.7940169060214395,0.26566443626087954,0.6024022760595951,1.3612182833146536,0.860836675069972,-0.3252411629899171
+2024-04-25,-0.06173113227636812,-1.7937937227389777,-0.8147016891771919,0.17584831151542565,0.5791339932811821,1.3396546332179224,0.9155325909881561,-0.33994298481006957
+2024-04-26,-0.15295373380111504,-1.7283985591337307,-0.7506113438572918,0.13664198697925523,0.518616038047764,1.4378890281086414,0.9496678182153282,-0.4108512345587104
+2024-04-29,-0.24756706468527856,-1.7143635103090042,-0.6480796237423541,0.14281486289148349,0.5792586218567428,1.489268699143675,0.8798981546402369,-0.48123013979550133
+2024-04-30,-0.27302539902356704,-1.7054230066719807,-0.7156811115352756,0.13791863280951444,0.5739168917289849,1.4729259678921143,0.9093400668555389,-0.39997204205530823
+2024-05-01,-0.34071078121943366,-1.6673027859315297,-0.6726708066389222,0.21107823904093756,0.5636586535206692,1.5266664468260536,0.8554591777247972,-0.4761781433225512
+2024-05-02,-0.22115556137341646,-1.76875269471173,-0.6719060166772131,0.33703779462640776,0.5318835676542044,1.4330211502697252,0.8342860783217277,-0.47441431810976514
+2024-05-03,-0.2596853233664452,-1.7977999551847208,-0.642267304652603,0.2348687146678451,0.5744402998149858,1.464941926633695,0.7899188728448923,-0.3644172307577084
+2024-05-06,-0.19894335703931734,-1.7747199148886807,-0.6048195788484432,0.09582729722358208,0.601475539781869,1.5713593980726668,0.6825766705788766,-0.37275605488057295
+2024-05-07,-0.07683491894459857,-1.8329579331750463,-0.5109183891077527,0.14133548781201516,0.4731109588899506,1.5882759164841926,0.6489640438214543,-0.43097516578029643
+2024-05-08,-0.15424365165187814,-1.7814763275276733,-0.4988373262639014,0.1002466543475134,0.3530803033109793,1.6593851242061197,0.714838695510003,-0.3929934719310798
+2024-05-09,-0.1444870037007818,-1.6969508340797599,-0.5483341278211985,0.09563054078365443,0.3593185306988711,1.7204693893739973,0.6892280463488002,-0.4748745416036247
+2024-05-10,-0.048219325354713585,-1.7306248815763472,-0.48528464291670714,-0.016290453674206916,0.41976936466998827,1.727662294700371,0.6128360552988243,-0.4798484111471668
+2024-05-13,-0.02439693514953441,-1.729732776968699,-0.6179688441647535,0.11978336846626533,0.4547329252302223,1.6771657557815678,0.6007074157078729,-0.4802909089029198
+2024-05-14,-0.05084818311670942,-1.7328374949654908,-0.6852418931822736,0.17874099655943873,0.5823787110548811,1.59325433010057,0.6090911843075056,-0.4945376507578412
+2024-05-15,-0.05182509084061347,-1.611966118679129,-0.8000285341245739,0.2880686266871963,0.5585998338175571,1.6174350545439302,0.6112991305958895,-0.6115829020003131
+2024-05-16,0.05584035406604675,-1.6464595226732415,-0.8240507311010838,0.13556484201173596,0.6562176807809297,1.58521666889766,0.5864498306551325,-0.5487791226372902
+2024-05-17,0.07107016685742307,-1.672327767748766,-0.8278994172326674,0.10093041335010478,0.6526973450453945,1.5343309881075444,0.6674703924292759,-0.526272120808239
+2024-05-20,0.004948074821794306,-1.6890229204328622,-0.8600799300308951,0.1850043676990441,0.613180392833076,1.4991473847354932,0.7231275847479001,-0.47630495437356724
+2024-05-21,0.007425376200128635,-1.6493714576163505,-0.8904180741566784,0.1084240241917689,0.5790013768598309,1.4872379643192664,0.8360506150523911,-0.47834982485039046
+2024-05-22,0.055282104333282414,-1.660658250067511,-0.8789796115600327,0.16569040179902156,0.5546697518535595,1.4846930250656625,0.8060305811095108,-0.5267280025335617
+2024-05-23,0.11586402425299905,-1.7100750237841673,-0.799175798687733,0.200327290968381,0.5675718065499714,1.4917136401301094,0.7099697896627362,-0.5761957290922968
+2024-05-24,0.05858461813299013,-1.730997310160581,-0.7707304949426558,0.2335704699580079,0.6440810972166002,1.5108813171946947,0.5985063143985674,-0.5438960117976749
+2024-05-27,-0.01095192761580795,-1.7190345053999667,-0.6966967083136089,0.07309697122582316,0.5771352335434509,1.5933441207752976,0.6683880184821509,-0.4852812026973914
+2024-05-28,0.009271298331761225,-1.7310072270171735,-0.6876051497446273,-0.010587012924705578,0.5942081208397006,1.5813633251927013,0.6909343134210866,-0.4465776680987602
+2024-05-29,-0.03419104966661856,-1.758761884911199,-0.7254364665104105,0.04064439329537348,0.656037176182894,1.5062890916841762,0.7183525165579135,-0.4029337766320783
+2024-05-30,-0.06370333781238582,-1.7881232424579736,-0.6270884287320695,-0.06982923592583974,0.6163875335398792,1.5199633621502002,0.7652963007427529,-0.3529029515045808
+2024-05-31,-0.07326831952333106,-1.7942838706096318,-0.5121818272302419,-0.09560924103752834,0.5453794794628274,1.4748066838617933,0.9086175596093781,-0.45346046453312533
+2024-06-03,-0.01558010758469026,-1.7451117311261528,-0.6513385750653884,-0.08802884496538867,0.44428656458944144,1.5562268677447053,0.8736100944913147,-0.3740642680838068
+2024-06-04,0.06145201379408864,-1.7334553244455755,-0.7083185247937854,-0.07876143911514148,0.42357377318871026,1.62300141085707,0.7469979809362299,-0.3344898904215787
+2024-06-05,0.04842709022307591,-1.6401621805816284,-0.7845661638950059,-0.2065062431620408,0.4134110895736452,1.6738032135784056,0.7741053042896368,-0.2785121100261224
+2024-06-06,0.04734214409528752,-1.6669501792707713,-0.7800761425714391,-0.14586704320049185,0.27652477462439634,1.6974986180331526,0.7694736929689646,-0.19794586467916603
+2024-06-07,0.04068487844248456,-1.7249240772356806,-0.7258264084205188,-0.19316510755420627,0.2001640337436182,1.6575503404662677,0.8162718994339505,-0.07075555887584692
+2024-06-10,0.07395586013570467,-1.7062509977067692,-0.7450098981828422,-0.20882337992966216,0.11737145092070508,1.6610062876143894,0.8429895537722375,-0.035238876623711446
+2024-06-11,0.13371711348106366,-1.6623705952856649,-0.796621505474345,-0.22320875095632314,0.12334141122320105,1.720534863604279,0.7463383803446485,-0.04173091693675905
+2024-06-12,0.3016519048467501,-1.6125071969966736,-0.8469925047971913,-0.27528882654948894,0.13182562056859728,1.737789975841011,0.6814957123778377,-0.11797468529082565
+2024-06-13,0.3374644223921115,-1.5651294245603036,-0.9319568834188776,-0.2539735203848403,0.1892066181065199,1.7118573354135092,0.7067335610188472,-0.194202108566999
+2024-06-14,0.25744556235394217,-1.5059373158712182,-0.9782348989821835,-0.3244559473389808,0.2927852833863108,1.731460725682891,0.7000166040772758,-0.17308001330808576
+2024-06-17,0.17805909352214094,-1.535176672571173,-0.9703308924422982,-0.35015039712291984,0.3886228255095455,1.6866118161760943,0.7314563003850721,-0.12909207345653037
+2024-06-18,0.23182438837983121,-1.5844260427020593,-0.9289814792147891,-0.35987964095461616,0.33254468172991236,1.696156535425334,0.6724820640896733,-0.05972050675321423
+2024-06-19,0.17002913165359845,-1.5987000645208138,-0.895467198316276,-0.34905410067965725,0.26847095407715843,1.7356915396424673,0.6370423557558998,0.03198738238773223
+2024-06-20,0.08661659007168714,-1.6047821995932097,-0.8761982181922027,-0.3547358655300487,0.43988606711660794,1.6763732843463386,0.7161952431063372,-0.08335490132558442
+2024-06-21,0.17923713141766634,-1.5292508089465664,-0.9506539358784888,-0.46718337404963534,0.502156525577891,1.6346317949700202,0.753686829355946,-0.12262416244683305
+2024-06-24,0.19669226705577944,-1.5455159245722068,-1.0203736288264582,-0.4538599037057496,0.4377911633472981,1.5656141290487755,0.8262501339626931,-0.006598236310131515
+2024-06-25,0.34289352184948974,-1.6073828195871669,-1.001708397637701,-0.43481036994777217,0.5370463261947116,1.5252748405453742,0.6984358914259492,-0.059748992842902506
+2024-06-26,0.31355438896850196,-1.548981895479916,-1.0660155146508066,-0.4636806537699528,0.515375251269405,1.5799939169812216,0.6218196949109387,0.047934811770590585
+2024-06-27,0.3379145077894238,-1.5151125212194745,-1.111445717982797,-0.44862588938668335,0.6526451811959428,1.5575798780239223,0.5488135941087464,-0.02176903252902835
+2024-06-28,0.33675340412800736,-1.5507784705689587,-1.0897954039890123,-0.38405836648330655,0.5816792040578931,1.5913446384066408,0.5250673123988012,-0.01021231795009879
+2024-07-01,0.2748996902001579,-1.5408586854652155,-1.0605951392630548,-0.391581935843487,0.5211119148812049,1.6537415814868925,0.5145295185703622,0.028753055433139958
+2024-07-02,0.18381615572566187,-1.5171827227131003,-1.0855989798731922,-0.42370744689371537,0.5473085815832162,1.6384184158349897,0.5593024279071107,0.0976435684289428
+2024-07-03,0.14669718379902977,-1.4645030429916157,-1.1286996402644918,-0.47549902956611007,0.5796888557757232,1.6496717957756093,0.48107095449203324,0.21157292297990415
+2024-07-04,0.21031409985126642,-1.532162370143704,-1.0608049269076933,-0.5527824248972295,0.5165829405039233,1.599552951598055,0.4999752366312695,0.31932449336412855
+2024-07-05,0.20326778994958122,-1.516088035170553,-1.0273823491828247,-0.5459156371992949,0.480058093537976,1.6721569994473382,0.44026319329179464,0.29363994532598264
+2024-07-08,0.23326308379505312,-1.5124269933828636,-1.0896562142385053,-0.4750608699373266,0.5379707175372902,1.6544571543862503,0.38177508652978176,0.26967803531032036
+2024-07-09,0.26196136564091804,-1.561698808623625,-1.1185528123995276,-0.39179266177706235,0.4607248211549836,1.614067348069792,0.3661991420655972,0.3690916058689562
+2024-07-10,0.29583472970951913,-1.5033702519340961,-1.0778016021631436,-0.4888877451320342,0.42984454897773,1.6887724325402078,0.32220659047911043,0.33340129752262737
+2024-07-11,0.24881536907009077,-1.3955533347548448,-1.1048428603891545,-0.518927159272665,0.3589873269119769,1.776292064925957,0.2318367490578571,0.40339184445079784
+2024-07-12,0.27425757041745175,-1.4732006702661289,-1.097883333723785,-0.5007548589194325,0.4484855725045328,1.6959431016311588,0.26455678463721144,0.3885958337188636
+2024-07-15,0.24320716639276618,-1.4557444095839343,-1.0981470228631847,-0.5101033134826648,0.4680006552609526,1.6994119461209272,0.19430318685801434,0.4590717912970434
+2024-07-16,0.23745303264603365,-1.4001992492035,-1.1865052794625792,-0.4481924951110342,0.4205734008368091,1.7122589014921092,0.18260622971530266,0.48200545908680936
+2024-07-17,0.19024959678733133,-1.3037938568566723,-1.2605516535219217,-0.49469610993988256,0.4726655193389609,1.7041693873148147,0.16820955421254818,0.5237475626647368
+2024-07-18,0.03867919880221047,-1.2492179995194885,-1.2967999068843927,-0.48786293713477646,0.5121562097848711,1.6850198119852342,0.1773826376891057,0.6206429852772867
+2024-07-19,0.05784711147740828,-1.1987616257104732,-1.3361036611256323,-0.5340712782784567,0.528618383098803,1.6605605886846175,0.17163132953349572,0.650279152320269
+2024-07-22,0.07940154875810007,-1.1639207748188516,-1.4177705450596334,-0.4507449718570371,0.49345131153211763,1.6702720615667472,0.19349617100353292,0.5958151988751037
+2024-07-23,0.058501812263169355,-1.1371236297749945,-1.3743174257895932,-0.5321965683193983,0.4489432144181772,1.725533243388282,0.29590724630931153,0.5147521075049811
+2024-07-24,0.08833330825046944,-1.0967740478132317,-1.4018039607377246,-0.49007383215790534,0.37425710099303044,1.7467679515588772,0.1785290106625936,0.6007644692439225
+2024-07-25,-0.023901255445185256,-0.9363358982393989,-1.456772911473312,-0.5664682641154503,0.400841645764359,1.7358142542293429,0.1519789558038921,0.6948434734757681
+2024-07-26,-0.020570437197164462,-0.8422249114909044,-1.5575964054864957,-0.5022030765071712,0.34940386045281546,1.7302494696415496,0.15614256526671527,0.6867989353207181
+2024-07-29,-0.011506769641246799,-0.8953189501149306,-1.5653389164272566,-0.4667090112774209,0.3435462834244119,1.7146166560192293,0.23491881177846197,0.6457918962387361
+2024-07-30,-0.041886985973244806,-0.8710801229109627,-1.5516156058801263,-0.5885213579890767,0.421863653956215,1.6708648938575015,0.31484340642898195,0.6455321185106966
+2024-07-31,-0.031755120838954924,-0.889041973562466,-1.5046255867832599,-0.6709472807545022,0.4859079081754389,1.6536848315515174,0.29667973984929175,0.6600974823629349
+2024-08-01,0.005535936320118087,-0.965387929490473,-1.4654173771284167,-0.6538873354639329,0.3642999597053885,1.6636132499305525,0.38402582249891426,0.6672176736278032
+2024-08-02,-0.03958072635072104,-0.9700107957763962,-1.4583516609343836,-0.6379706246581237,0.37387175157421854,1.653847074748569,0.35542128773806153,0.722773693658731
+2024-08-05,-0.056184354596353576,-0.9756042975929796,-1.365493997244584,-0.7277364569845481,0.41591738037721676,1.7020761871916734,0.31146520600759925,0.6955603328419024
+2024-08-06,0.03724912437998196,-0.9362347971845643,-1.3448794243470406,-0.8239165517325173,0.32486023569362205,1.7105628974860494,0.3289680061092862,0.7033905095951825
+2024-08-07,0.07146479696906059,-0.8980976578627831,-1.258917209029012,-0.9646715055428997,0.25100993897529467,1.6814554914314666,0.27793166491590315,0.8398244801429698
+2024-08-08,0.02800671162459791,-0.8879439048637878,-1.2189570939307066,-0.9694832115168629,0.21824353998150978,1.695440411868357,0.23636037180540148,0.8983331750315072
+2024-08-09,0.01778695303703753,-0.8356135997713469,-1.2072384650034513,-0.966706260903766,0.08821299847554444,1.7037341442679812,0.22627648284554144,0.9735477470524264
+2024-08-12,0.07321261247582724,-0.7015211393925295,-1.196055759131377,-1.0828739242870447,0.10962329801979914,1.739064254393204,0.14022764972538615,0.9183230081966146
+2024-08-13,0.025035613419191523,-0.6331733839295955,-1.1754758477075014,-1.1331950599155332,0.1938554528956745,1.706691067725343,0.02552282773035407,0.9907393297820669
+2024-08-14,-0.026778215855107347,-0.6919540329389214,-1.1214562826733763,-1.1980746943383145,0.26137755123288176,1.602223459515703,0.08629144939694232,1.0883707656601924
+2024-08-15,-0.049138202683670036,-0.6878762434922497,-1.172565584735358,-1.1685674612800994,0.3157511379851066,1.597919830684776,0.10636937474638651,1.0581071487751754
+2024-08-16,-0.03981795522781859,-0.6747260537802321,-1.1769713199520542,-1.222137436931749,0.3676649234067571,1.5833305077995028,0.16522841003066438,0.9974289246549127
+2024-08-19,0.04954552801850543,-0.7488483736529555,-1.2061359273270384,-1.1997168278793962,0.4093469338485538,1.51692017219155,0.15402132138194985,1.024867173418848
+2024-08-20,0.0687277179495822,-0.6991963290666516,-1.1197879820897958,-1.2583031319195845,0.3667431649718886,1.5564648192572892,0.03127015372259137,1.0540815871746982
+2024-08-21,0.17763106548304278,-0.6476806502612269,-1.1230978930465747,-1.2758125978765298,0.23982357818242975,1.615346087177649,0.017422790460465656,0.9963676198806558
+2024-08-22,0.09156101634703148,-0.5306322750419594,-1.1920747352299847,-1.2315846507040855,0.28210553691162954,1.6819886296486664,-0.030139787629240734,0.928776265697943
+2024-08-23,0.10917076712119672,-0.5750462010534998,-1.2513594047546637,-1.1776940603586563,0.3483441015173656,1.6664707464973247,-0.017529696966623348,0.8976437479975388
+2024-08-26,0.07333534122722994,-0.5567808927863698,-1.2397469102571368,-1.1557422857889672,0.4062364577604354,1.7034206014184987,-0.08935506218027899,0.858632750606642
+2024-08-27,0.013925950584652317,-0.5949605416167849,-1.2473542606702437,-1.1072111144979055,0.4447741230832144,1.724279849563421,-0.0635253457938796,0.8300713393476149
+2024-08-28,-0.023866397156131702,-0.652266139025912,-1.1743975216618248,-1.0805911301416307,0.38497503751077333,1.75226197472865,-0.0997160942324003,0.8936002699784054
+2024-08-29,0.0481330333178317,-0.5731900565789474,-1.1847278714388398,-1.1450504494925924,0.41747186337058434,1.7530289180739642,-0.14407631380227953,0.828410876550351
+2024-08-30,0.10995228875712891,-0.6277280835584766,-1.2195707034280332,-1.0990738035851995,0.47519997234611333,1.7192867809446242,-0.1843799540904915,0.8263135026143519
+2024-09-02,0.06420074448664963,-0.45702768179152337,-1.2001227714316334,-1.1778907004084271,0.42023386745024677,1.74707278528614,-0.22182479278765002,0.825358549196215
+2024-09-03,0.09185937649251599,-0.3236152774713025,-1.2253794839678054,-1.2474513119214434,0.4663670169895115,1.7121303569069053,-0.2574703768866039,0.7835596998581864
+2024-09-04,-0.03770629490474491,-0.2693178046973758,-1.2143322281721256,-1.2559428457246495,0.4474038888143402,1.7254972849782997,-0.2046991023700726,0.8090971020763459
+2024-09-05,-0.014044624815635941,-0.29531208286882077,-1.177423802958758,-1.3006303931299006,0.47989892469150675,1.6793749225062742,-0.22757069745848457,0.8557077540338189
+2024-09-06,0.041995660809411035,-0.36329117789331733,-1.1279908519106732,-1.3047967676850196,0.47954740401552753,1.6796067239167387,-0.2784622249651025,0.8733912337124526
+2024-09-09,0.04409543737435555,-0.36400099138948944,-1.098269939961723,-1.3297493564007705,0.493516948780724,1.7139483600581753,-0.26076102062840256,0.8012205621670804
+2024-09-10,0.0007995106530295054,-0.35803014290441676,-1.0578897626077108,-1.4226590371639503,0.5807134414213276,1.6495387250121636,-0.18917322732052252,0.7967004929100295
+2024-09-11,0.05431339817481364,-0.3306676504516593,-0.9920866303770025,-1.4657085953129063,0.5188834652500943,1.6915734399689153,-0.23180525190126328,0.7554978246489746
+2024-09-12,0.10428077761095295,-0.2582234017204117,-1.0501156775116067,-1.4883583933353455,0.44339542170013063,1.6485958366779951,-0.20464838434986643,0.8050738209280547
+2024-09-13,0.08343919114290517,-0.23814626209031534,-0.9955229106746815,-1.496009077432228,0.3794843274353158,1.6934439515591637,-0.22866578976385687,0.8019765698237911
+2024-09-16,0.06988463086910529,-0.24496538425860187,-0.9202396424656515,-1.5447920384941718,0.4550263437465148,1.6949447941988849,-0.25586776269185874,0.7460090590957171
+2024-09-17,-0.02008328768812829,-0.27174594628024984,-0.8688103318132354,-1.521873585253009,0.4245743784057478,1.762549155235013,-0.22414829878185163,0.7195379161757449
+2024-09-18,-0.06768405614123463,-0.2503230934284628,-0.8850126397798874,-1.539337546580169,0.5263402624147976,1.7373547076945095,-0.19075920302365848,0.6694215688440897
+2024-09-19,-0.043619884919256995,-0.28159469705822354,-0.8161445598406489,-1.6235219306045916,0.502952905518901,1.6524028757418274,-0.16838051526138012,0.7779058064234511
+2024-09-20,-0.026155213886452654,-0.29014070954485555,-0.7791235861317842,-1.6524208609032793,0.6072609403619756,1.6274405816812194,-0.20636770648948813,0.7195065549126192
+2024-09-23,-0.023910034549763082,-0.25394006272522557,-0.7770700906650915,-1.684662504712078,0.605383711077667,1.6261687388222548,-0.16613693780333577,0.6741671805556175
+2024-09-24,0.011257927006541579,-0.26822251644322764,-0.7581376483755465,-1.664567929434076,0.6104255854409092,1.6502409034387977,-0.23697009676666364,0.6559737751332357
+2024-09-25,0.003681854691057964,-0.2316592221648476,-0.6893587730925187,-1.6685987870075563,0.5227230541753374,1.690838886441285,-0.3064475830493809,0.6788205700066078
+2024-09-26,-0.027115304325675542,-0.12657758391491247,-0.6777427622297559,-1.6954444680968357,0.4774512446168617,1.6914628955105735,-0.3191632948329575,0.6771292732726709
+2024-09-27,0.005001468454811822,-0.21462406059422198,-0.6421838981807861,-1.719993266333223,0.4458620132291969,1.6758485274832304,-0.26208121230149933,0.7121704282425068
+2024-09-30,-0.08027416590220897,-0.14352843157770748,-0.6090126209961426,-1.6918417154178436,0.3125992155983684,1.7396092250316362,-0.2658557122666816,0.7383042055306573
+2024-10-01,-0.11331338244432308,-0.15748019713213401,-0.6288392739435295,-1.709828732629596,0.3779417020476049,1.7460598698749625,-0.1659301361898956,0.6513901504170031
+2024-10-02,-0.11465541566100752,-0.15752733812887038,-0.617606145930653,-1.6904644413718157,0.30206550709037805,1.7746885275772792,-0.16980294024103668,0.673302246665726
+2024-10-03,-0.13861773815497355,-0.2262582984728858,-0.6709927710664197,-1.6615169088460153,0.3437734241583394,1.774120080064519,-0.08783483226532278,0.6673270445827746
+2024-10-04,-0.1322779868615232,-0.21115125088893635,-0.6397167256386291,-1.6699210217213496,0.26691588221194673,1.774217123381654,-0.10251917210626636,0.714453151623119
+2024-10-07,-0.00892499678251143,-0.2857156387658872,-0.5785423735752071,-1.7370063687975856,0.17129715366273726,1.7400450996945345,-0.014644562766170287,0.7134916873300596
+2024-10-08,-0.04918860407906965,-0.31406265413920875,-0.5194013990691247,-1.7892575460314737,0.22238081605033602,1.6725973464587416,0.01505074060801836,0.7618813002019178
+2024-10-09,0.022208555147863657,-0.36420667335153317,-0.5325610345846741,-1.7749655251220389,0.20342247985879486,1.6866593060983592,0.02044485683845834,0.7389980351148142
+2024-10-10,0.07507975451937515,-0.4528293435939602,-0.4399748549175086,-1.814299034163291,0.26081884137723443,1.6546786652333196,0.010874823502004758,0.7056511480428257
+2024-10-11,0.145161613198816,-0.4694303899552744,-0.4032105563990262,-1.8209037558143988,0.1757867412855429,1.649864306005978,-0.003442124376040969,0.7261741660543727
+2024-10-14,0.14625201931698764,-0.5219398294403571,-0.3806286870353859,-1.817323589253153,0.13845825040661336,1.6077109812984858,0.01852242044999514,0.8089484342567845
+2024-10-15,0.22672452660631276,-0.5733291595793193,-0.45992126142622763,-1.732269561097419,0.1364469716259902,1.6250702286620038,-0.08361742218352868,0.8608956773922024
+2024-10-16,0.15168541503224497,-0.5249620053475945,-0.39695697901098587,-1.770567652189642,0.14392668732910113,1.6262250629810853,-0.08724728172027836,0.8578967529260842
+2024-10-17,0.1550009391665216,-0.5514850620148144,-0.3345962045323041,-1.7854349158158362,0.14577956472218237,1.6050851925973808,-0.10781005251152084,0.873460538388421
+2024-10-18,0.19250718430502886,-0.6029887187343663,-0.18699500687760284,-1.8153772918733235,0.03656490871306152,1.5915261012016204,-0.06944381335950903,0.8542066366251345
+2024-10-21,0.16860637414570376,-0.5624431399580779,-0.1584562655255056,-1.8354365030335995,0.04888349538156821,1.555199262369067,-0.12451399321016324,0.9081607698309201
+2024-10-22,0.09366182434898396,-0.584614275037651,-0.12449650909204041,-1.75247370581631,0.002933256668425824,1.599516706163083,-0.21365010683838878,0.9791228096038971
+2024-10-23,0.0969827188705731,-0.6031927637088347,-0.07558361455540859,-1.7608994789204455,-0.06374374726272336,1.5500456405933962,-0.18289571639240304,1.0392869613758458
+2024-10-24,0.089218136131236,-0.5036679075509184,-0.06159809155769594,-1.8306916367655022,-0.01716388804326208,1.4697018730085192,-0.2278741508253475,1.0820756656029007
+2024-10-25,0.09417540741058493,-0.46448852299669463,-0.05311656777180834,-1.8592875926796764,-0.03194293335149868,1.4531948078088146,-0.21415211957919725,1.0756175211594021
+2024-10-28,0.04354735741509533,-0.40280606009501696,-0.08314832451765691,-1.8850817846387928,-0.06168368892448371,1.4247722777878207,-0.14093274388971636,1.105332966862705
+2024-10-29,-0.031588959361037915,-0.3515905021131085,-0.09664112480736622,-1.8637287997290604,-0.10414301942948513,1.437642096024,-0.12932503721868138,1.1393753466347245
+2024-10-30,0.03767321681967389,-0.4930553166408769,-0.1066595417812086,-1.8536552548091438,-0.08373037552528348,1.451973928406537,-0.04383160891523026,1.091284952445547
+2024-10-31,0.050855982869321824,-0.4627667162904527,-0.22555252616743945,-1.8452484714410693,-0.07756948154231603,1.4820485632144993,0.01773979057845388,1.060492858779048
+2024-11-01,0.033978850703180095,-0.42720969722778024,-0.2522474439333644,-1.8978531433691836,-0.005840836219360303,1.3844979507458184,0.05519383970505153,1.1094804795956235
+2024-11-04,-0.0015890850924638543,-0.42654389704663354,-0.2785629214971209,-1.8437250527726927,-0.10677866453681235,1.364431891494634,0.08405027317896291,1.2087174562720653
+2024-11-05,0.07952768688956778,-0.45034348643607003,-0.23824257049090522,-1.8515487568229567,-0.1518790552067686,1.3591837261498956,0.05654483520790076,1.1967576207093675
+2024-11-06,0.09744169721771079,-0.4017148084019997,-0.2641535448481356,-1.8217804527989996,-0.26211453637685245,1.4499941455335787,0.07843702658758367,1.1238904730870825
+2024-11-07,0.1506888272947077,-0.48174382797948173,-0.267043968193672,-1.7995392409461508,-0.23772038045158028,1.4398861136312275,0.05404442297087995,1.1414280536740853
+2024-11-08,0.12849121001791358,-0.49525754440029796,-0.2190208480087973,-1.7191440228568518,-0.3322281560024968,1.500662657501835,-0.03449841601352754,1.1709951197622708
+2024-11-11,0.08935002541684782,-0.527589746323165,-0.27249069830649697,-1.7017079422583934,-0.2699392797878002,1.4888666116071454,-0.012251562408195813,1.2057625920600907
+2024-11-12,-0.012017923137004272,-0.5264443260003536,-0.29062526313142034,-1.6661959684739316,-0.30777359065018633,1.444055842813965,0.06363704891553566,1.2953641796633792
+2024-11-13,-0.02616775020188205,-0.5762248226990365,-0.22831843449192127,-1.7396307476785193,-0.21352833344934663,1.3387145848587725,0.128083238409732,1.3170722652522504
+2024-11-14,0.08065172732547579,-0.5497406981884119,-0.2292322627853646,-1.8095658688379237,-0.20482231971734624,1.2728664497229698,0.1430812460158611,1.2967617264646898
+2024-11-15,0.06729330497223669,-0.5216351505201842,-0.18846991831572316,-1.7698705405688848,-0.3232031633103772,1.3181285844448158,0.11370401327098734,1.3040528700270972
+2024-11-18,0.1025520031121382,-0.4626851086935321,-0.16826663518573054,-1.8490982059462073,-0.28298445776900577,1.2503103114347436,0.11760030334491954,1.2925717897026265
+2024-11-19,0.10066126345004334,-0.44189603797266563,-0.13691753384414343,-1.8596857114632626,-0.31828153204461024,1.1949625183650012,0.13029135507934061,1.3308656784303283
+2024-11-20,0.1629243684202567,-0.4280630799121023,-0.0853736532016383,-1.860569352395143,-0.35132328645273475,1.1498328634143051,0.043720230642719224,1.36885190948437
+2024-11-21,0.1018562906877599,-0.42647838618277994,-0.10741949165127243,-1.842611211853686,-0.37906888053895443,1.117746878689866,0.12443248377206871,1.4115423170769816
+2024-11-22,0.10661512189128476,-0.35973913724416856,-0.07464210371919026,-1.9122143893216295,-0.34214014268267934,1.1011793836293597,0.11965011877428562,1.3612911486727033
+2024-11-25,0.15021491092542055,-0.4046431103255455,-0.021775251792692213,-1.9249045500401805,-0.3260513619449681,1.1002425517173742,0.09173548159300512,1.3351813298675514
+2024-11-26,0.12207877844166522,-0.4934241835149826,0.03374091920708125,-1.8719818332267153,-0.3575636665201399,1.1425056729043934,0.08454902204688336,1.3400952906617651
+2024-11-27,0.14600934227417728,-0.5498264108149356,0.13055128488513087,-1.8310143827563623,-0.44973181603318635,1.1215185345348986,0.0756869635570388,1.3568064843532062
+2024-11-28,0.17337057961380015,-0.5469493949311472,0.14680242361436766,-1.8045548573742394,-0.4726318791607846,1.1605569200611678,-0.006594927263407914,1.3500011354403685
+2024-11-29,0.13144568892897396,-0.5044038107028654,0.055686781592120774,-1.824016633742373,-0.4813446468076989,1.1406934177767307,0.12160900949571989,1.360330193459423
+2024-12-02,0.1667149885608321,-0.4902015997632597,0.12119101822857369,-1.7967203386847985,-0.5613097258877989,1.0479656759816174,0.07350135390240421,1.438858627662383
+2024-12-03,0.20933712118429468,-0.5188787638370371,0.11790541579775811,-1.7587490689052996,-0.5890949425454933,1.1479641232609021,0.007706535163114638,1.3838095798817296
+2024-12-04,0.2617559272027867,-0.5327923218105707,0.10634933864318745,-1.7766042067009695,-0.5940470304784671,1.1031601288969066,0.05104690458322768,1.3811312596639147
+2024-12-05,0.24754878928730095,-0.5294626707972397,0.19410089617705922,-1.7935890950418198,-0.6018572344624691,1.1324827605072367,0.024733263344192836,1.326043290985787
+2024-12-06,0.15359099171560056,-0.5432723105040242,0.2711009309167538,-1.7478042507076943,-0.6246501006492089,1.1112889890473487,-0.008679004649688538,1.3884247548308
+2024-12-09,0.19153804434832516,-0.5312518496384544,0.22952790888061372,-1.75539623089437,-0.608012551207437,1.0961409407858216,-0.02789438296767191,1.4053481206932048
+2024-12-10,0.24131279215375528,-0.5078012972990504,0.17444431015236672,-1.790460973301114,-0.5506277845552546,0.9892323583115945,-0.027559070663711056,1.4714596652014138
+2024-12-11,0.2482307792581213,-0.44749795112135515,0.1912016304837932,-1.7934648568932396,-0.5735751460769497,0.9268340139722552,-0.06589520162737747,1.514166732004675
+2024-12-12,0.2825077768759307,-0.4634151400094172,0.18631444000090697,-1.769388900114795,-0.6173665824081523,0.9539757360882927,-0.07055790095521028,1.497930570522429
+2024-12-13,0.24199174940147994,-0.3986564851889621,0.20751346228572284,-1.769161610165449,-0.6169942279531008,0.8532565644227917,-0.09639720216931896,1.578447749366852
+2024-12-16,0.2755615083606394,-0.491236915354267,0.22879431241590684,-1.7111225045036411,-0.5760458798688265,0.7844252460804381,-0.16233260336233002,1.651956836232096
+2024-12-17,0.32414590868936444,-0.5501307979960246,0.2505487607773858,-1.7412031022318446,-0.5671334241170229,0.6867391821809221,-0.04682746238833874,1.6438609350855586
+2024-12-18,0.42367748803356986,-0.634225223172445,0.20809274096102393,-1.7511903608042216,-0.5587961345956122,0.5994773921881489,0.09178072773510267,1.6211833696543552
+2024-12-19,0.4339002049785505,-0.6729944929194468,0.1212552264852728,-1.7060006660901421,-0.539084839238991,0.6969222051354632,0.03626629281260986,1.6297360688366356
+2024-12-20,0.46485880115612355,-0.6137911747423906,0.041451938004329364,-1.744335938366705,-0.5253428180686232,0.6637542688005537,0.08913893379614707,1.6242659894206137
+2024-12-23,0.5021406301936034,-0.5705406344285245,0.046125862359168754,-1.784086861599313,-0.47740735266722006,0.5797421834945388,0.07054866972289961,1.6334775029248472
+2024-12-24,0.5567112699033592,-0.6505133073406306,0.08776406204553008,-1.692557730870032,-0.5052811545030412,0.5188083794219882,-0.009008982823190102,1.6940774641659087
+2024-12-25,0.4900903930370129,-0.7231447358993287,0.18559823666467679,-1.6910728791847465,-0.42763769363248266,0.45848374996046404,-0.00973455133408615,1.717417480388475
+2024-12-26,0.5863993043123723,-0.7231979837532508,0.3264709533124238,-1.7136451512356883,-0.4768098362066864,0.4441777007775411,-0.07428370970958505,1.630888722502919
+2024-12-27,0.6473866436420721,-0.7354384555149447,0.3304234610529683,-1.6786272082982931,-0.46863499039128986,0.3773744579071674,-0.12628939759113347,1.6538054891934533
+2024-12-30,0.6519546979088366,-0.7271476528899563,0.35264161511175507,-1.67880587581863,-0.4545312633710323,0.43362743354488287,-0.21012444305900402,1.632385488573148
+2024-12-31,0.7005083150026165,-0.7522344565380087,0.3411670027025728,-1.6776102519021003,-0.41857477614693656,0.48796851062144486,-0.27060077815276806,1.5893764344130763
+2025-01-01,0.7042393717487949,-0.7375554956466721,0.3837102948239877,-1.6848757656471371,-0.37951077694597707,0.4380694016864298,-0.3170505355956443,1.5929735055762182
+2025-01-02,0.7429484774544068,-0.7474496535845774,0.3704168108509305,-1.643956254032977,-0.40831612543322854,0.4049424270732785,-0.3334165607110817,1.6148308783832916
+2025-01-03,0.7074472812395152,-0.8241313900686397,0.43947809116968045,-1.6525217541675297,-0.3268958276968135,0.3796907423441224,-0.3181034728536796,1.5950363300333585
+2025-01-06,0.7725166955745724,-0.8568207771410266,0.4848706250504407,-1.6533728298005648,-0.33645628127850463,0.3421695725088504,-0.29635337711690796,1.543446372203198
+2025-01-07,0.7723012182134845,-0.8460331074754444,0.45150873414084935,-1.6847084563235963,-0.27746999262833427,0.33021458329529346,-0.2875518526382433,1.5417388734159767
+2025-01-08,0.7625767379480736,-0.9398860774877413,0.4045878638361731,-1.6545040008762821,-0.2703176525832143,0.3430897094140743,-0.19626107952714045,1.5507144992760433
+2025-01-09,0.816230435551391,-0.9496272173904209,0.4254178918586601,-1.6715733586235952,-0.24598072145743136,0.326648813006975,-0.2008761439654785,1.4997603010198857
+2025-01-10,0.8539662224184881,-0.9217697677583808,0.33660571859775246,-1.6280300232696985,-0.2236146694804096,0.32233735896094723,-0.29412707563957896,1.5546322361708802
+2025-01-13,0.8622014805658169,-0.9716672536573681,0.32635657050287825,-1.5758703435659167,-0.292669923077217,0.31186706189112506,-0.23624626011829042,1.5760286674590007
+2025-01-14,0.9160681123673836,-0.9352539354930766,0.26153145730450666,-1.588945481084376,-0.29866198132273974,0.2798037029466786,-0.2098082775895543,1.5752664028711776
+2025-01-15,1.019571121431234,-0.9305595554447169,0.13318572913814575,-1.5659448290020965,-0.2967941763554479,0.32196432382685664,-0.22488918066713118,1.5434665670731562
+2025-01-16,1.0250424860771765,-1.0529546801325516,0.10984843900308347,-1.529916925133195,-0.2716583710051979,0.39412500690148805,-0.16797618820548,1.4934902324946466
+2025-01-17,0.995261217464423,-1.0803818299243724,0.16695700039446995,-1.4716436166741431,-0.3802695091560124,0.41991988602855823,-0.16641467074178387,1.5165715226087888
+2025-01-20,1.0078156251750754,-1.0867284505731685,0.13631844338236382,-1.4512428119368843,-0.40172562878393697,0.43139745890821096,-0.15478042064633388,1.5189457844746732
+2025-01-21,1.0606678480673806,-1.1206119732580946,0.1384820813821792,-1.450150666806391,-0.3370543746905252,0.4449392765222216,-0.20090787692887738,1.4646356857121647
+2025-01-22,1.030510400189296,-1.1538963913458915,0.040900021637467025,-1.365744455438587,-0.2805527214648682,0.3979909532591059,-0.23377856518299164,1.5645707583465132
+2025-01-23,1.0475842423398196,-1.19366038411371,0.06893691285427837,-1.312814074065535,-0.22770281203126871,0.3472113866241656,-0.3055458936713132,1.5759906220636486
+2025-01-24,1.0459251609469435,-1.2612213581457865,0.0634241914121552,-1.2847117224615574,-0.16365359012103903,0.3879479125393849,-0.32893431070418916,1.5412237165340301
+2025-01-27,1.0970084596012613,-1.344187859562782,0.08518818968207213,-1.2460686919793087,-0.121864717687496,0.3876296466999841,-0.3267000977711152,1.4689950710174269
+2025-01-28,1.0284567392359902,-1.3974694458594212,0.0893154041056187,-1.2292344558661763,-0.08962554056992748,0.39148484589627736,-0.28543965024060236,1.4925121032982984
+2025-01-29,1.0277025518670315,-1.3863229555812966,0.13574699556576852,-1.2435648630519913,-0.09823558660392112,0.3514580515962323,-0.2844409237196516,1.4976567299277734
+2025-01-30,0.9955783969789904,-1.3878629164139633,0.1865274308366273,-1.2627149608577406,-0.1523298580098523,0.3582131466728458,-0.2361248931822768,1.4987136539753974
+2025-01-31,1.0604000938476583,-1.3775623668567805,0.13731261881114445,-1.2944403835186784,-0.14792870913402417,0.31706644441734627,-0.15653373167443702,1.4616860341077436
+2025-02-03,1.0464469708283484,-1.3756290700645697,0.21018123674237163,-1.3272017567471701,-0.15938576280303726,0.3686630867720801,-0.18173868873868831,1.4186639840106792
+2025-02-04,1.0595650131196122,-1.3628772600428842,0.1542311603071736,-1.3382520806777742,-0.12904582088447997,0.44063649480175443,-0.21934096982541323,1.3950834632020654
+2025-02-05,0.9947391064891477,-1.375243573134649,0.14049227304841924,-1.3311518969950156,-0.11510729872062733,0.5049613246562894,-0.23442478467941522,1.41573484933581
+2025-02-06,0.9197060828962024,-1.4357119476557345,0.17956328272781275,-1.2742824901614958,-0.10244022507738026,0.5114436121489523,-0.24846153876395516,1.4501832238856258
+2025-02-07,0.9198774000782591,-1.4451373773773708,0.2225815535731876,-1.2564382954741697,-0.03834704041419536,0.44612975868952814,-0.31144532136259884,1.46277932228736
+2025-02-10,0.9456108307911941,-1.5194258874877045,0.2262080004246781,-1.1793667798931449,-0.02485069710124148,0.448162182980227,-0.32697109984025535,1.43063345012626
+2025-02-11,0.9787483207294492,-1.5035659489594322,0.15901162740791638,-1.2168795936144703,0.00985058469077632,0.4841322589255513,-0.3065724169532289,1.3952751677734123
+2025-02-12,0.9130678308262671,-1.4841235367809533,0.1393298990489828,-1.28517011230085,0.07859761489721234,0.46241025529508345,-0.24309515759739142,1.4189832066115984
+2025-02-13,0.9056023447790252,-1.5231531583713738,0.16626564412548986,-1.270521758055357,0.11481051380486389,0.47054044265166867,-0.24959326566732729,1.386049236732972
+2025-02-14,0.8662326678395006,-1.53834288544273,0.1630924002801204,-1.2683064070029721,0.08996930425934957,0.5168826847559252,-0.21715937291499032,1.3876316082257718
+2025-02-17,0.8538627352544165,-1.580220540993113,0.11783195164587063,-1.222266951973528,0.14449816516660588,0.45482108080251227,-0.18426168887605593,1.4157352489733412
+2025-02-18,0.9165703095106036,-1.5710591343130917,0.12036856181197989,-1.2284650588988775,0.17318318119748954,0.35096279426906485,-0.17072455520349653,1.4091639016263031
+2025-02-19,0.9356167303156627,-1.6372267827312976,0.06583610603917732,-1.1816594695159515,0.24957341275703138,0.33764467832860107,-0.1300267587758016,1.3602420835825781
+2025-02-20,0.8935759237711469,-1.6664001113678022,0.07163636119884813,-1.168195699396629,0.2697875434671656,0.34624612109283964,-0.1070502034232138,1.3604000646576317
+2025-02-21,0.9094518683153981,-1.6875180433613242,0.14107387682292263,-1.1492476203134312,0.23904598601055277,0.3449382449861117,-0.1356467064274063,1.337902393967216
diff --git a/agent/tests/factors/fixtures/goldens/alpha101_001.csv b/agent/tests/factors/fixtures/goldens/alpha101_001.csv
new file mode 100644
index 000000000..eacedfc09
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/alpha101_001.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,,,,,
+2024-01-11,,,,,
+2024-01-12,,,,,
+2024-01-13,,,,,
+2024-01-14,,,,,
+2024-01-15,,,,,
+2024-01-16,,,,,
+2024-01-17,,,,,
+2024-01-18,,,,,
+2024-01-19,,,,,
+2024-01-20,,,,,
+2024-01-21,,,,,
+2024-01-22,,,,,
+2024-01-23,,,,,
+2024-01-24,,,,,
+2024-01-25,-0.2,-0.2,0.4,0.09999999999999998,0.4
+2024-01-26,0.5,-0.3,0.19999999999999996,-0.09999999999999998,0.19999999999999996
+2024-01-27,0.30000000000000004,0.5,0.0,-0.3,0.0
+2024-01-28,0.30000000000000004,0.5,0.0,-0.3,0.0
+2024-01-29,0.30000000000000004,0.30000000000000004,-0.2,0.30000000000000004,-0.2
+2024-01-30,0.30000000000000004,-0.09999999999999998,-0.3,0.30000000000000004,0.30000000000000004
diff --git a/agent/tests/factors/fixtures/goldens/alpha101_005.csv b/agent/tests/factors/fixtures/goldens/alpha101_005.csv
new file mode 100644
index 000000000..04f8c4573
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/alpha101_005.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,-0.32000000000000006,-0.6,-0.6,-0.16000000000000003,-0.08000000000000002
+2024-01-11,-0.36,-0.4,-0.16000000000000003,-0.4,-0.16000000000000003
+2024-01-12,-0.8,-0.2,-0.24,-0.24,-0.16000000000000003
+2024-01-13,-0.6,-0.32000000000000006,-0.04000000000000001,-0.24,-0.8
+2024-01-14,-0.8,-0.24,-0.16000000000000003,-0.24,-0.2
+2024-01-15,-0.6,-0.2,-0.16000000000000003,-0.48,-0.16000000000000003
+2024-01-16,-1.0,-0.36,-0.16000000000000003,-0.6400000000000001,-0.04000000000000001
+2024-01-17,-0.4,-0.48,-0.4,-0.48,-0.04000000000000001
+2024-01-18,-0.4,-0.6,-0.6400000000000001,-0.08000000000000002,-0.12
+2024-01-19,-0.48,-1.0,-0.16000000000000003,-0.24,-0.08000000000000002
+2024-01-20,-0.16000000000000003,-1.0,-0.48,-0.24,-0.08000000000000002
+2024-01-21,-0.08000000000000002,-0.6,-0.8,-0.24,-0.16000000000000003
+2024-01-22,-0.16000000000000003,-1.0,-0.16000000000000003,-0.36,-0.16000000000000003
+2024-01-23,-0.04000000000000001,-0.4,-0.48,-0.6,-0.32000000000000006
+2024-01-24,-0.12,-0.4,-0.12,-0.6400000000000001,-0.4
+2024-01-25,-0.16000000000000003,-0.32000000000000006,-0.4,-0.2,-0.36
+2024-01-26,-0.2,-0.12,-0.24,-0.8,-0.32000000000000006
+2024-01-27,-0.2,-0.16000000000000003,-0.16000000000000003,-0.8,-0.36
+2024-01-28,-0.8,-0.16000000000000003,-0.12,-0.8,-0.12
+2024-01-29,-0.6400000000000001,-0.4,-0.12,-0.4,-0.12
+2024-01-30,-1.0,-0.24,-0.04000000000000001,-0.6400000000000001,-0.24
diff --git a/agent/tests/factors/fixtures/goldens/alpha101_011.csv b/agent/tests/factors/fixtures/goldens/alpha101_011.csv
new file mode 100644
index 000000000..084785e0f
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/alpha101_011.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,0.9600000000000002,0.8,0.24000000000000005,1.2,0.27999999999999997
+2024-01-05,0.6000000000000001,0.72,0.24000000000000005,0.4,1.2800000000000002
+2024-01-06,0.36000000000000004,0.6400000000000001,0.4800000000000001,1.8,0.27999999999999997
+2024-01-07,1.0,0.4,0.2,1.6,0.6
+2024-01-08,0.24000000000000005,0.6400000000000001,1.6,1.08,0.24000000000000005
+2024-01-09,0.6,0.4,0.36000000000000004,0.6400000000000001,0.9600000000000002
+2024-01-10,0.32000000000000006,0.8,1.0,0.24,1.2
+2024-01-11,1.2000000000000002,0.48,0.2,0.8,0.96
+2024-01-12,0.36000000000000004,0.32000000000000006,1.2000000000000002,0.6400000000000001,0.7200000000000001
+2024-01-13,0.32000000000000006,0.96,0.36000000000000004,1.4,0.32000000000000006
+2024-01-14,0.24,0.5599999999999999,1.6,0.32000000000000006,0.8
+2024-01-15,0.4,0.32000000000000006,0.36000000000000004,0.6,1.8
+2024-01-16,0.6400000000000001,0.16000000000000003,0.6400000000000001,0.48,2.0
+2024-01-17,0.96,0.16000000000000003,1.0,0.8,0.4
+2024-01-18,1.4,0.4800000000000001,0.24000000000000005,1.08,0.32000000000000006
+2024-01-19,1.2000000000000002,0.4800000000000001,0.48,0.8,0.27999999999999997
+2024-01-20,1.4400000000000002,0.16000000000000003,0.2,1.8,0.6
+2024-01-21,1.6,0.08000000000000002,0.6,1.2800000000000002,0.5599999999999999
+2024-01-22,0.5599999999999999,0.16000000000000003,0.6400000000000001,1.6,0.84
+2024-01-23,0.32000000000000006,0.8,0.72,0.4,1.2000000000000002
+2024-01-24,1.4400000000000002,0.6,0.7200000000000001,0.4,0.2
+2024-01-25,0.7200000000000001,1.4,0.7200000000000001,0.16000000000000003,0.6400000000000001
+2024-01-26,0.32000000000000006,1.6,0.84,0.32000000000000006,0.4
+2024-01-27,0.72,1.2800000000000002,0.32000000000000006,0.27999999999999997,1.0
+2024-01-28,0.6,0.24,1.2000000000000002,0.24000000000000005,1.6
+2024-01-29,0.32000000000000006,0.8,1.2,0.6400000000000001,0.32000000000000006
+2024-01-30,0.08000000000000002,0.4,2.0,0.8,0.96
diff --git a/agent/tests/factors/fixtures/goldens/alpha101_041.csv b/agent/tests/factors/fixtures/goldens/alpha101_041.csv
new file mode 100644
index 000000000..637f907fe
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/alpha101_041.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,0.12869382970897902,0.038591548076041704,0.03564034667230942,-0.19164736306818497,-0.12258274581353135
+2024-01-02,0.18437446159413184,0.13027713184301604,-0.15824540709932933,0.020818500237936632,0.018005232314237674
+2024-01-03,-0.23372386041546633,-0.10290773822120514,0.040976767391768476,0.0016873532524499524,0.04100424409438119
+2024-01-04,-0.08001418322521658,-0.0635245609039572,-0.03576021007052077,-0.1624511910873423,-0.04901654109245612
+2024-01-05,0.10942014644051312,0.19587681655629297,0.14090305888805688,0.1349543588538893,0.0016414688323465043
+2024-01-06,-0.07795442021965471,0.048282221316028995,-0.017291152983972324,0.027102172383138168,0.09433280416469358
+2024-01-07,0.015393213318745325,0.0803962789460968,0.17064966918468372,-0.05256008114723443,-0.01572078987413761
+2024-01-08,-0.10203048469733744,-0.1340307262092324,-0.032506194679754685,-0.002447243763825213,-0.03597316385102545
+2024-01-09,-0.029410351860093442,-0.15654770858559175,-0.015126758905267934,0.13421007176086164,0.12851638291508038
+2024-01-10,-0.10336414011361228,-0.07963911630575637,-0.00847511392092315,-0.10853024334750216,0.12404114556581192
+2024-01-11,0.05055771306038537,0.022262162462652668,0.04894455547690768,-0.1315648722543301,0.08159657493078498
+2024-01-12,-0.13018341019201785,-0.037302707205768115,-0.08596295293743594,0.13570482447133259,0.1701928659035019
+2024-01-13,-0.08601680423353741,0.003806802953647548,0.07131966722816685,-0.0003317707163432715,-0.20474382960324533
+2024-01-14,-0.018601611650780114,0.060799212503141575,0.06968077522992644,0.10108195725105418,0.09240623726182662
+2024-01-15,-0.07809828010931597,-0.12044322347331615,0.003679641028242031,-0.005364097933750145,0.1799522242976792
+2024-01-16,0.10123363495279136,0.11543300974280157,-0.011723653048335336,0.08943493334383845,-0.07344592147286733
+2024-01-17,0.08833583901093789,0.17023634071210836,0.1815941009070059,-0.1067390566083617,-0.0625159146113674
+2024-01-18,0.00014146618364918595,0.1230477474624081,-0.16511878148394032,0.09925160879447503,-0.07204424126491915
+2024-01-19,-0.10384805532761732,0.12665952990771245,-0.011880179404897717,-0.23719265865909733,0.11121021399522135
+2024-01-20,-0.005962100387208125,-0.17074911980800778,-0.10737966351899786,-0.05553022267399399,-0.1338338404771946
+2024-01-21,0.05697756041308821,0.002557417948537477,-0.1805230411841734,-0.008930593062615344,0.0299058407338606
+2024-01-22,-0.06943019186110178,0.1474470514936712,0.12004856217680526,0.12794463941915524,-0.034927295750279086
+2024-01-23,0.17766216970173332,0.040308254172117586,0.08241172003923225,-0.1534103551507826,-0.178922097953361
+2024-01-24,0.0930413718512142,-0.032988869448260516,0.07667200647564698,0.029042194284841116,-0.17567987444520838
+2024-01-25,-0.01599224082039541,-0.1810779941365439,0.13208909542819924,-0.07345509961572816,0.15454904723128493
+2024-01-26,-0.1643169930546975,0.10201678606405551,-0.06767498680486028,0.1219768508271386,0.013245025575002956
+2024-01-27,-0.1455959658626682,-0.06717295373510979,-0.07098412183179903,0.013301736205548309,-0.11013266644455655
+2024-01-28,-0.1318533562706108,-0.13446977709891428,-0.21456817454226496,0.2013096236481715,0.10148057625289653
+2024-01-29,-0.11988102522489896,-0.20193984400997067,0.003371954855182935,-0.03620995288940776,-0.024225555414275846
+2024-01-30,0.06155968888195673,-0.019070342100050652,0.06152047075822509,0.01156896357734638,-0.005840092458541335
diff --git a/agent/tests/factors/fixtures/goldens/alpha101_054.csv b/agent/tests/factors/fixtures/goldens/alpha101_054.csv
new file mode 100644
index 000000000..39dc8bef3
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/alpha101_054.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,-0.2912941556217383,-0.44124401268751695,-0.4344170201812325,-0.9095881472568397,-0.8005377551913733
+2024-01-02,-0.12033883147184887,-0.675460185485821,-0.9568042378783985,-0.028758865411976822,-0.6110031600568709
+2024-01-03,-0.6804923558955627,-0.4853185410652298,-0.5243187250896176,-0.21496075367319825,-0.1728920784071538
+2024-01-04,-0.41659371942418644,-0.36858347424898835,-0.7329460216293981,-0.45569308509768053,-0.31486175260865257
+2024-01-05,-0.6674386558404116,-0.05291922717277741,-0.19338699516712698,-0.00441635595249766,-0.12017113769600873
+2024-01-06,-0.6770039479217015,-0.0438662868195937,-0.7239726482581827,-0.3574758671212954,-0.019299103286534777
+2024-01-07,-0.3605689827768337,-0.7030710755861611,-0.1180999323307829,-0.32279616146665985,-0.6847503589698828
+2024-01-08,-0.3571475358709229,-0.8186300647557522,-0.25122063447149373,-0.15503949346462645,-0.9280853747862592
+2024-01-09,-0.6710366315653441,-0.8382704012874809,-0.4841930765252412,-0.2467780280534512,-0.141721447529571
+2024-01-10,-0.42791875196579193,-0.4193699720124961,-0.6461557488718667,-0.722495242108317,-0.14586818417041306
+2024-01-11,-0.5165529575243442,-0.38274779990459085,-0.09043201737352614,-0.7709927113929101,-0.6082953730882078
+2024-01-12,-0.8082867862615528,-0.24512564588620067,-0.5133251807576001,-0.4240609042650004,-0.5550785057302355
+2024-01-13,-0.47149136070019015,-0.22532126556045218,-0.1609110176507315,-0.32018845236960175,-0.8882249370060725
+2024-01-14,-0.7364909111488328,-0.39719581285378375,-0.6285430112151138,-0.4714809528244658,-0.197669891739654
+2024-01-15,-0.7271845113791167,-0.820765902409469,-0.4813000497170879,-0.6848723749700226,-0.02608772201450575
+2024-01-16,-0.5655107703001001,-0.20749283145325847,-0.4086152325945645,-0.3940804120125423,-0.2776321475829544
+2024-01-17,-0.27290893602165806,-0.36199161338686886,-0.598981183116755,-0.4801619334572433,-0.35454873162890455
+2024-01-18,-0.1359409582021591,-0.603537259445388,-0.9506008320335342,-0.060977641143569516,-0.6899790557634522
+2024-01-19,-0.7311843168807479,-0.6084885064166181,-0.09592285244081629,-0.7405459443717244,-0.23565891999624966
+2024-01-20,-0.1773868241893497,-0.8836760549810017,-0.6876276848782745,-0.5601317423750315,-0.6307070631501799
+2024-01-21,-0.1634306135853381,-0.12943164839370996,-0.6716272002343404,-0.30397567471307474,-0.37439809040472954
+2024-01-22,-0.657642886590218,-0.6692419612240539,-0.39901076917416506,-0.32946533748011186,-0.5379616745040522
+2024-01-23,-0.018477206534864926,-0.26825307525702863,-0.275680088720717,-0.8578302260770297,-0.7798939522227855
+2024-01-24,-0.4688924549374998,-0.523209979539276,-0.17333931955750448,-0.7321453699157837,-0.8665863868792781
+2024-01-25,-0.8313785976552842,-0.471122838771489,-0.6710562848158392,-0.3352495414469704,-0.4691648958219233
+2024-01-26,-0.8218420262886827,-0.22043025880263736,-0.44185282318859687,-0.2265391071948168,-0.33686265940587773
+2024-01-27,-0.3536331601016523,-0.6989927199819314,-0.3203281541569418,-0.5901635049510724,-0.33909445609859146
+2024-01-28,-0.8789397398748913,-0.42500422045918007,-0.722142011979014,-0.47782242114622697,-0.13149152521071383
+2024-01-29,-0.7033207005878128,-0.8986028808284932,-0.18983112733864765,-0.6208176678938042,-0.7419606471853947
+2024-01-30,-0.6628822638523677,-0.23053920750612308,-0.16108669849701,-0.6165298675859403,-0.8750204899585006
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_001.csv b/agent/tests/factors/fixtures/goldens/gtja191_001.csv
new file mode 100644
index 000000000..b2cfb18c4
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_001.csv
@@ -0,0 +1,31 @@
+,A,B,C,D,E
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,-0.28203803740888295,-0.7470178808339965,-0.6324555320336759,-0.8451542547285172,-0.17407765595569896
+2024-01-08,-0.8374357893586234,-0.7470178808339965,0.11396057645963774,-0.7765802747153223,-0.22395700438234037
+2024-01-09,-0.8720849447020926,-0.7996709849747754,0.33532637550742184,-0.5114083119567584,-0.5165149163404469
+2024-01-10,-0.867109969524119,-0.8669214468630104,0.14744195615489686,-0.4522670168666458,0.11980845957462957
+2024-01-11,-0.8067430836895162,-0.8051175601825409,-0.25000000000000006,-0.6101702158477524,-0.09869275424396683
+2024-01-12,-0.8333094209864278,-0.5677335894338369,0.14744195615489683,-0.6357639532057504,0.2432521277052585
+2024-01-13,-0.8574929257125463,-0.37210420376762776,-6.183475874936608e-16,-0.4264014327112211,0.06201736729460462
+2024-01-14,-0.7833494518006395,-0.2132007163556118,-0.4557327151876503,-0.2814245560747183,0.11111111111111137
+2024-01-15,-0.6250000000000007,-0.0,-0.48266393372395305,-0.3563483225498995,0.37210420376762526
+2024-01-16,-0.806143519483538,-0.0,-0.691939188692768,-0.3563483225498995,0.1324532357065041
+2024-01-17,-0.719194952228077,-0.35687321357316515,-0.5387270543537283,-0.41053541362797996,0.08770580193070293
+2024-01-18,-0.7171371656006357,-0.7655318158241124,-0.7698003589195026,-0.23702273156998963,-0.46767710248334543
+2024-01-19,-0.6528477261068477,-0.6585131215097448,-0.3508232077228124,-0.4105354136279794,0.18835264373920393
+2024-01-20,-0.7606388292556647,-0.27386127875258287,-0.1869893980016926,-0.4303314829119354,0.024390243902438574
+2024-01-21,-0.7108186533109108,0.034482758620689904,-0.03739787960033945,-0.2767829194042753,-0.2357022603955152
+2024-01-22,-0.43440012198666417,0.6109598099719213,0.29230769230769177,-0.18961818525599106,-0.5025189076296059
+2024-01-23,-0.5692307692307691,0.5533985905294665,0.5590169943749462,0.19425717247145252,-0.22111599712911217
+2024-01-24,-0.5965587590013056,0.8007616113427827,0.30302160763142705,-0.055470019622524236,-0.0
+2024-01-25,-0.2105798931586652,0.8908708063747471,0.12126781251816521,-0.3312706744344569,0.08119979429411552
+2024-01-26,0.08119979429411552,0.4173919355648405,0.283473354756919,-0.3872983346207424,-7.037322847196352e-16
+2024-01-27,0.21428571428571447,0.5829752480681677,-0.027639499641140656,-0.23136947512504483,-0.03747658444979425
+2024-01-28,0.19542142471857538,-0.04724555912615367,-0.1837559081124575,-0.44172610429938713,0.17149858514250782
+2024-01-29,0.5516772843673708,-0.35037429748427096,-0.10846522890932876,-0.3015113445777631,0.1373605639486898
+2024-01-30,0.4873159230985381,-0.4455663943395038,-0.10846522890932944,-0.2891216547914563,-0.2491364395612202
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_005.csv b/agent/tests/factors/fixtures/goldens/gtja191_005.csv
new file mode 100644
index 000000000..0dc38d1bc
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_005.csv
@@ -0,0 +1,31 @@
+,A,B,C,D,E
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,,,,,
+2024-01-11,-0.5949422064001083,-0.7844645405527357,-0.15309310892394948,,0.29880715233359756
+2024-01-12,-0.32274861218395107,-0.8838834764831851,-0.7161148740394341,,0.29880715233359756
+2024-01-13,-0.32274861218395107,-0.8882347881956889,-0.7161148740394341,-0.7484551991837497,0.5222329678670927
+2024-01-14,-1.086325978972343e-15,-0.8882347881956889,-0.7161148740394341,-0.4564354645876384,-0.37998029782867476
+2024-01-15,0.09869275424396597,-0.8882347881956889,-0.0,-0.4564354645876384,-0.37998029782867476
+2024-01-16,-0.0,-0.8703882797784893,-0.13363062095621275,-0.19611613513818754,-0.6211299937499438
+2024-01-17,-0.0,-0.8703882797784893,-0.8124207484594868,-0.6201736729460432,-0.7319250547114005
+2024-01-18,-0.0,-0.24253562503633314,-0.8124207484594868,-0.6201736729460432,-0.7906954926148677
+2024-01-19,0.3674842076295849,-0.24253562503633314,-0.8124207484594868,-0.7726228204805202,-0.7906954926148677
+2024-01-20,-0.49009802940980424,-0.5345224838248505,-0.6993786061802371,-0.7726228204805202,-0.7906954926148677
+2024-01-21,-0.49009802940980424,-0.5345224838248505,-0.6993786061802371,-0.7726228204805202,-0.38924947208076194
+2024-01-22,-0.49009802940980424,-0.5345224838248505,-0.6993786061802371,-0.7637626158259783,0.03340765523905229
+2024-01-23,-0.07142857142857106,-0.3952847075210451,-0.14744195615489972,-0.7637626158259783,0.03340765523905229
+2024-01-24,-0.07142857142857106,-0.26382242650554294,0.060192926542884266,-0.7637626158259783,-0.0458349248514119
+2024-01-25,0.21821789023599103,-0.10482848367219487,0.1443375672974066,-0.1454785934906614,-0.0458349248514119
+2024-01-26,0.38069349381344064,-0.10482848367219487,0.12198750911856679,-0.1336306209562126,-0.0458349248514119
+2024-01-27,0.014847846772911866,0.592156525463793,-0.30429030972509263,-0.6123724356957954,0.0845154254728512
+2024-01-28,0.014847846772911866,-0.17568209223157555,-0.63887656499994,-0.6123724356957954,-0.2567180154051354
+2024-01-29,-0.22821773229381873,-0.2721655269759073,-0.63887656499994,-0.6123724356957954,-0.4355724051843773
+2024-01-30,-0.34299717028501886,-0.2721655269759073,-0.8215838362577489,-0.7222222222222219,-0.6546536707079789
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_017.csv b/agent/tests/factors/fixtures/goldens/gtja191_017.csv
new file mode 100644
index 000000000..b30f8d661
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_017.csv
@@ -0,0 +1,31 @@
+,A,B,C,D,E
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,,,,,
+2024-01-11,,,,,
+2024-01-12,,,,,
+2024-01-13,,,,,
+2024-01-14,,,,,
+2024-01-15,1.0,0.9875668011220564,0.562953920107327,0.21589435203616916,0.4879812055553432
+2024-01-16,1.0,0.8888171391883999,0.6828302306480283,0.3476453817871338,0.003788910110558139
+2024-01-17,0.6631602904676617,1.0,0.5877869436230023,0.7571813221122062,0.00021454813474718832
+2024-01-18,0.39505243748829055,1.0,0.5755914266189773,0.4111442284579084,0.00013254156843811536
+2024-01-19,0.882739306726763,1.0,0.6748853507772032,0.7732029788379194,0.00019915885726476184
+2024-01-20,0.3134890271943107,1.0,0.7881917874803348,0.520350230516808,0.00925451157274438
+2024-01-21,0.0403572726695053,1.0,0.7959166088654683,0.32957520336388896,0.1749325718320325
+2024-01-22,0.07147037215007762,1.0,0.939351297386615,0.4898570477299514,0.5700960030527273
+2024-01-23,0.01950919778847001,0.5469850858255441,0.7554857271842884,1.0,0.18311963408063248
+2024-01-24,0.02352914374345864,0.6842436908629206,0.595259182596741,1.0,0.86619289194643
+2024-01-25,0.18568658706699512,0.8954401667368038,1.0,0.42839548717339576,0.2309137214557651
+2024-01-26,0.40523003460423934,0.933617566651855,1.0,0.5646419995138086,0.40052556901102454
+2024-01-27,0.8429932348489217,0.6555252464755212,0.5058214071760223,1.0,0.6408483271703573
+2024-01-28,0.48074158786752313,0.08825254564103696,0.41608902812130477,1.0,0.12046823925036115
+2024-01-29,0.19420514951077988,0.7469524139495382,0.1387711709645867,1.0,0.05456877512133521
+2024-01-30,0.489760726907602,0.2235395217215515,0.0003890478097785163,1.0,0.34261476956
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_042.csv b/agent/tests/factors/fixtures/goldens/gtja191_042.csv
new file mode 100644
index 000000000..fb6e2fe80
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_042.csv
@@ -0,0 +1,31 @@
+,A,B,C,D,E
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,-0.12482748131218302,-0.09967730288896634,-0.1163283246057841,-0.3873463283601986,-0.4454734609757006
+2024-01-11,-0.17828469747658174,-0.08239852887876492,-0.22124076594651984,-0.27298007119247614,-0.32740796886340395
+2024-01-12,-0.16654217497712337,-0.11020791884050683,-0.07884761684132945,-0.05944971915684186,-0.21766769349094892
+2024-01-13,-0.0741812182025443,-0.19611767844064423,-0.14915148209676418,-0.4466432465598801,-0.09415911188180424
+2024-01-14,-0.07484612349436186,-0.26579093975537066,-0.1074324462074529,-0.33020602175313507,0.07563545744281698
+2024-01-15,-0.03477099008578663,-0.2683383586626786,-0.13783669715550514,-0.24271596595231976,0.04747909082149556
+2024-01-16,-0.0700488772816875,-0.034906235656362784,-0.09725338570644432,-0.1996908282918351,0.4028894592338092
+2024-01-17,-0.09183259448857779,-0.045234932441887414,-0.3470810910566536,-0.15609160711516912,0.20361478054161902
+2024-01-18,-0.05304981935157802,-0.19073778470518862,-0.06738926182433959,-0.15820516813944802,0.15244330320585034
+2024-01-19,-0.02897954970330316,-0.1950658832328655,-0.05686479928486951,-0.14424404856592446,-0.20687706749336485
+2024-01-20,-0.025768003640382037,0.06771405178640522,-0.07593005404860528,-0.022386650051462186,-0.31728585862606096
+2024-01-21,0.0428907058190185,0.022307138604400163,-0.08949286920191109,-0.013740335377245536,-0.16992997125107734
+2024-01-22,0.26480231878308536,0.2983853783916926,-0.11059961578107154,0.037059738336052035,-0.5543844293297135
+2024-01-23,0.1742652614723045,0.31414139268977154,-0.0971087759964688,-0.00997458986081931,-0.4352030648731015
+2024-01-24,0.3028772811856616,0.21770202136004724,-0.11780859352610909,-0.10201317666721908,-0.49771006243333704
+2024-01-25,0.4936068865073101,-0.02529261666387635,-0.119361048995451,-0.06485450420528498,-0.012693337417233245
+2024-01-26,0.40267933278379975,0.08872495018688342,-0.09920616457658986,-0.012340718852332417,0.11341557960414238
+2024-01-27,0.20052728213732005,0.14614101673450872,-0.10091510908957131,0.1494417020155326,0.12668807126927115
+2024-01-28,0.10924311345397826,-0.04073915844460155,-0.12103306899102706,0.3331200762062018,0.037789625716839075
+2024-01-29,0.31209179950371335,0.002757830531407618,-0.04975302791824574,0.5747646841852472,-0.05914528717312345
+2024-01-30,0.2870386107853826,0.04210667317673923,-0.07577644718528981,0.49897674351883103,-0.0012994194613048585
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_080.csv b/agent/tests/factors/fixtures/goldens/gtja191_080.csv
new file mode 100644
index 000000000..bc972048c
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_080.csv
@@ -0,0 +1,31 @@
+,A,B,C,D,E
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,566.529562982005,-90.47686563637222,29.231560539039194,-26.54523127302497,-88.19465342561942
+2024-01-07,12.451140643877478,-57.2162017814379,-85.88666648425315,-35.02504923117736,-74.58494346643766
+2024-01-08,-72.06645170335062,107.85312172904466,88.83410485520507,608.1781617756591,-62.601000384763374
+2024-01-09,-62.27309699049736,7.765629380431735,-81.33871898442008,-98.1949081803005,-97.89014952287926
+2024-01-10,-51.110256320593074,-17.272281496761977,21.764207639253012,-76.0934514504082,-79.82598559593688
+2024-01-11,57.101717576879565,4820.198511166251,-82.71058538837501,184.34800780161603,448.1890600106213
+2024-01-12,-61.173608038930674,-1.2443120041879756,1260.4497867390457,-81.28768844221106,-72.73921817072598
+2024-01-13,316.5746549560853,-26.05547540626616,-83.5172854145763,20.734118636937314,85.9567901234568
+2024-01-14,88.33675132775937,-40.028616024973985,466.192537621109,1207.8034682080918,4037.5356125356097
+2024-01-15,-45.285268101947885,45.28062788701304,28.338136407300674,238.17481653709217,380.7728023111845
+2024-01-16,-39.13747954173486,-91.6896976054548,42.62430939226519,-27.712451924254673,21.82631946059056
+2024-01-17,79.55969724098641,107.64149404664818,35.4870888673545,177.34978180597514,556.4124634188328
+2024-01-18,32.357459112677326,37.97717651389656,74.91007194244604,-32.70379985016639,10.167232490883944
+2024-01-19,149.7878043332589,19.010540927428103,-63.23090366271026,14.685082872928175,-72.01976209739891
+2024-01-20,97.12405769314567,-96.83173888576252,5.2137105100144545,69.1102851126915,-58.75119375918793
+2024-01-21,150.71664829106945,563.6970506129384,290.56104332106656,39.480149787349404,5.308777454395089
+2024-01-22,80.3671388101983,-84.38985114488827,-40.6851505143362,125.58322490846925,-79.17442500852326
+2024-01-23,-38.70835608956854,-67.46928484719128,148.70872058532726,98.6874126236214,92.31875456537618
+2024-01-24,6.69766610033086,-0.8346849884274024,186.16694722249727,373.25850274592926,166.50670604158975
+2024-01-25,57.33012069499094,3070.07104795737,30.8237660680993,-43.98607528999225,6.1652922660700815
+2024-01-26,-39.42231374820345,57.98983212025895,46.078949978510266,-74.53381440042762,-15.241259533338367
+2024-01-27,17.739077990124017,836.9354635803244,-72.71292536307698,-91.18881869274207,792.0287117491499
+2024-01-28,39.5485260265835,-46.62921348314607,-26.84858315046274,-90.54791843116816,-78.46435057150657
+2024-01-29,-73.58573583640631,50.182860713432454,25.906574394463668,-92.78290699213143,-70.82736968465765
+2024-01-30,-67.10128840993073,-64.88163608348508,11.089651034146526,-4.191616766467066,107.80426845703363
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_101.csv b/agent/tests/factors/fixtures/goldens/gtja191_101.csv
new file mode 100644
index 000000000..9410ee025
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_101.csv
@@ -0,0 +1,81 @@
+,SYM0,SYM1,SYM2,SYM3,SYM4
+2024-01-01,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-02,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-03,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-04,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-05,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-06,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-07,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-08,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-09,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-10,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-11,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-12,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-13,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-14,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-15,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-16,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-17,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-18,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-19,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-20,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-21,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-22,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-23,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-24,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-25,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-26,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-27,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-28,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-29,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-30,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-01-31,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-01,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-02,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-03,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-04,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-05,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-06,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-07,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-08,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-09,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-10,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-11,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-12,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-13,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-14,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-15,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-16,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-17,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-18,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-19,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-20,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-21,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-22,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-23,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-24,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-25,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-26,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-27,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-28,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-02-29,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-01,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-02,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-03,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-04,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-05,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-06,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-07,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-08,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-09,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-10,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-11,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-12,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-13,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-14,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-15,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-16,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-17,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-18,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-19,-0.0,-0.0,-0.0,-0.0,-0.0
+2024-03-20,-0.0,-0.0,-0.0,-1.0,-0.0
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_130.csv b/agent/tests/factors/fixtures/goldens/gtja191_130.csv
new file mode 100644
index 000000000..b6fd6b448
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_130.csv
@@ -0,0 +1,81 @@
+,SYM0,SYM1,SYM2,SYM3,SYM4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,,,,,
+2024-01-11,,,,,
+2024-01-12,,,,,
+2024-01-13,,,,,
+2024-01-14,,,,,
+2024-01-15,,,,,
+2024-01-16,,,,,
+2024-01-17,,,,,
+2024-01-18,,,,,
+2024-01-19,,,,,
+2024-01-20,,,,,
+2024-01-21,,,,,
+2024-01-22,,,,,
+2024-01-23,,,,,
+2024-01-24,,,,,
+2024-01-25,,,,,
+2024-01-26,,,,,
+2024-01-27,,,,,
+2024-01-28,,,,,
+2024-01-29,,,,,
+2024-01-30,,,,,
+2024-01-31,,,,,
+2024-02-01,,,,,
+2024-02-02,,,,,
+2024-02-03,,,,,
+2024-02-04,,,,,
+2024-02-05,,,,,
+2024-02-06,,,,,
+2024-02-07,,,,,
+2024-02-08,,,,,
+2024-02-09,,,,,
+2024-02-10,,,,,
+2024-02-11,,,,,
+2024-02-12,,,,,
+2024-02-13,,,,,
+2024-02-14,,,,,
+2024-02-15,,,,,
+2024-02-16,,,,,
+2024-02-17,,,,,
+2024-02-18,,,,,
+2024-02-19,,,,,
+2024-02-20,,,,,
+2024-02-21,,,,,
+2024-02-22,,,,,
+2024-02-23,,,,,
+2024-02-24,,,,,
+2024-02-25,,,,,
+2024-02-26,1.666666666663889,3.99999999998,0.5999999999993999,0.499999999999375,0.49999999999875006
+2024-02-27,1.1999999999976,,0.7999999999992,0.5333333333326222,0.7999999999968002
+2024-02-28,2.3999999999904,,1.999999999996,0.5333333333326222,0.1999999999998
+2024-02-29,0.7999999999984001,,3.9999999999840004,1.0666666666652445,0.1999999999998
+2024-03-01,1.5999999999936003,,1.999999999996,0.7999999999992,0.2666666666663111
+2024-03-02,0.7999999999968002,,0.9999999999989999,1.0666666666652445,1.1999999999976
+2024-03-03,0.7999999999968002,,1.3333333333315556,0.7999999999992,1.1999999999976
+2024-03-04,,,,0.5999999999993999,1.5999999999968002
+2024-03-05,,,,0.5999999999993999,1.5999999999968002
+2024-03-06,,,,0.3999999999996,
+2024-03-07,0.1999999999998,,,0.7999999999984001,
+2024-03-08,0.1999999999998,,,0.7999999999984001,
+2024-03-09,0.1999999999998,,,0.7999999999984001,
+2024-03-10,0.1999999999998,,,0.7999999999984001,
+2024-03-11,,,,,
+2024-03-12,,,,,
+2024-03-13,,,,,
+2024-03-14,,,,,
+2024-03-15,,,,,
+2024-03-16,,,,,
+2024-03-17,0.7999999999992,,,,1.999999999996
+2024-03-18,0.9999999999989999,,2.3999999999904,0.5333333333326222,1.5999999999968002
+2024-03-19,0.9999999999989999,,2.3999999999904,0.5333333333326222,1.5999999999968002
+2024-03-20,0.9999999999989999,,2.3999999999904,0.7999999999984001,1.0666666666652445
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_150.csv b/agent/tests/factors/fixtures/goldens/gtja191_150.csv
new file mode 100644
index 000000000..ddcf261c4
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_150.csv
@@ -0,0 +1,81 @@
+,SYM0,SYM1,SYM2,SYM3,SYM4
+2024-01-01,193243979.1876657,797943209.6350979,671778749.7551438,516944658.3557728,565372718.2144791
+2024-01-02,732109849.0900346,240709280.64516684,1018017314.1957991,998568030.715769,662681981.3715829
+2024-01-03,210108262.51722312,696489499.9110495,83668707.6311431,40601064.47141165,266135890.75622866
+2024-01-04,470079156.73872316,879697939.6690931,750460316.0557973,742860985.6350238,425895394.6818103
+2024-01-05,356738935.8829145,380117039.4208401,1016436506.1844933,48884960.27401727,849125350.2065685
+2024-01-06,593626536.4720575,444665175.95885724,751118044.7188148,479817218.9813074,852318438.0580008
+2024-01-07,913302706.6512132,430999595.57686764,294300373.134284,575348001.6878146,895832440.5899113
+2024-01-08,219148096.69307083,636414649.5137452,647778194.1204262,701109352.0888846,137966334.46234745
+2024-01-09,721380425.7314664,926422366.0122622,190667390.96172133,231882161.54467872,945662174.0305148
+2024-01-10,189548805.15329352,867843208.0204902,508145397.17067444,242095561.46886167,836576887.51149
+2024-01-11,451210945.2723143,526922834.3791747,372710708.92679864,568135857.8711193,164747090.21320745
+2024-01-12,401251622.43807214,975002533.335714,269768198.35438484,631569033.1634524,321025808.3323512
+2024-01-13,781514415.9339192,139440386.68946454,976167242.5037717,435324102.4205158,237462019.01405036
+2024-01-14,84148253.2524194,177833777.22475526,529198934.4994118,326565724.2891882,810932170.9258442
+2024-01-15,446632867.4613432,258574285.5234875,627311994.3285772,680492370.411544,167547010.46212965
+2024-01-16,181162970.4889787,46880253.83897032,745302013.3163685,642964084.7842143,447633656.57350487
+2024-01-17,871271003.3158029,820376734.0281136,601481098.3512598,837875240.079284,196858243.4691287
+2024-01-18,124076105.0341866,283606978.53762513,68294359.88392854,513438324.6398596,864276923.8261156
+2024-01-19,50238488.5468802,135241120.0656176,468041637.6674224,893446777.6251925,297010681.54679215
+2024-01-20,520865204.63154435,53079548.38218245,160120694.7993163,938912038.4487579,886338726.5572581
+2024-01-21,14914995.815386366,987799245.3444222,655618413.1327145,821726489.9356557,422819881.3341351
+2024-01-22,521451557.01010036,518517309.60025805,685200821.6699911,140309037.59198225,36288534.048442096
+2024-01-23,311747654.25581354,745338930.583337,214594090.15952447,652195606.7358618,885065961.7395283
+2024-01-24,101268437.67325424,712517600.6170396,455340636.5572133,849341521.8360012,170410388.61494935
+2024-01-25,690549652.5924736,882203754.1277552,963690652.4525583,669576662.1714754,463098907.92344034
+2024-01-26,627053821.2510936,902921940.1222672,586740761.3486464,38799794.61103727,859545903.0477965
+2024-01-27,695393290.3829256,704072141.3562893,226279151.06339046,644526980.4349805,365463146.24178964
+2024-01-28,661772584.5323616,119036624.00460167,664909090.6999127,978727209.7319214,52091619.15682853
+2024-01-29,994477259.4470375,428192698.3228875,866603908.6420949,772241126.7694169,515069716.59391123
+2024-01-30,760055634.0923527,908991473.9186809,402654453.6359147,329248389.6624583,608258294.6982908
+2024-01-31,831456624.1966158,787893831.3370225,778821747.3849742,437435208.8227696,744087094.4642162
+2024-02-01,132145227.64500533,573252536.6414058,15252241.270233087,326193485.7649195,340495423.5833364
+2024-02-02,408142083.34098405,738158039.3767587,387047434.6969443,442818751.668001,225457931.13793847
+2024-02-03,384696365.72655284,250072176.60766485,82218653.19761293,589385436.5489614,618681279.3708084
+2024-02-04,629566753.8282233,498445068.7976747,386625079.8004231,841005960.4092753,482381920.4678127
+2024-02-05,488907626.2965288,37414283.38252588,351495813.38725126,374194890.05662423,380934038.6470781
+2024-02-06,595512254.5773816,567146902.8419778,617578782.8973079,748534817.6162223,770555571.283085
+2024-02-07,740692176.6417917,1008169971.6243341,28229822.346895903,197505436.06702796,16370519.094201218
+2024-02-08,669244151.695369,954214800.5661379,252938411.95353284,891310906.1502117,64874990.41379035
+2024-02-09,957590058.0936362,377937318.84167427,111456995.49140944,468755571.5049682,244395279.95860454
+2024-02-10,300927137.0302365,333104919.7024948,818603476.863032,523018645.2957117,289296179.0993377
+2024-02-11,630393253.0222797,766493851.9545075,287040600.4511493,406002361.4157625,122148604.5643723
+2024-02-12,193958122.32736835,735275923.7228241,195776183.27865878,516370629.1922622,670427732.260003
+2024-02-13,119599646.81926498,612955209.7505841,272966105.6971965,938236617.1304383,460580939.8867891
+2024-02-14,847906469.4919231,586142237.5981045,54999834.333701566,611933396.4854181,892422113.2472603
+2024-02-15,645669837.332441,862861120.0900925,913626254.6108168,224006359.32678118,207299408.5926278
+2024-02-16,655532182.5989017,438482727.99204266,866586045.5544589,853619455.2418001,344328320.8445509
+2024-02-17,260881560.19206303,813883112.5631225,290852448.4998424,773152565.7756966,417052656.3834126
+2024-02-18,713126063.9248325,108116635.2034871,650394130.3237265,431470570.8830929,570063892.4725479
+2024-02-19,186542289.0491552,759735694.67049,892645503.8667593,214924731.84901935,100994741.42268348
+2024-02-20,34971578.7801155,668549557.3110366,638108142.7421733,534471054.1938942,229013630.53029403
+2024-02-21,413693807.386211,624753408.8012257,524312724.7403193,964126204.9719436,138780077.50316554
+2024-02-22,721405560.9361976,430795899.5632598,444066746.21246177,699609526.2853335,666222234.2127255
+2024-02-23,1013351244.2085592,145353909.9664911,113349265.99750559,700828092.6898893,557919766.5302345
+2024-02-24,289157454.75606745,93420981.15632303,95306470.36477059,864101906.4231075,190221776.4574764
+2024-02-25,342005347.11514354,247011085.78148404,363731028.7515176,75804920.2009558,495354758.9972559
+2024-02-26,79910387.72799319,849432328.8190172,244884722.83978587,518525357.03413886,846450890.2607712
+2024-02-27,671692286.4320581,568887578.9619071,338897176.5356381,323836985.6122255,647610117.5042379
+2024-02-28,1013071895.0348405,700838066.1919203,572995222.2961953,703717996.3022902,452384758.8685779
+2024-02-29,70339703.35155022,599827039.0832483,976689550.0283034,177683353.26156402,671069077.63185
+2024-03-01,209753250.9476626,572000894.6945789,108506721.80186597,444273491.0602164,733565697.0085826
+2024-03-02,355122251.66912526,711370984.2157862,818479592.4629446,908972745.5520266,234537159.52716047
+2024-03-03,405835623.73066,173113783.95527914,1020417027.4598697,917380131.6042539,529848326.6863542
+2024-03-04,843726507.1663207,569157172.8813648,646439961.7516919,97269061.64090846,741517008.3688278
+2024-03-05,136583035.345562,905618616.1136842,801584001.8537238,716770831.633571,44413467.40794092
+2024-03-06,308345530.9203188,297744922.421988,377047168.6734743,98391059.00126825,911542654.1946013
+2024-03-07,552001229.1010033,343185100.83813125,415471418.3596605,459175982.42838615,594493643.8029872
+2024-03-08,513838668.92127293,1003554556.6115565,515703127.93108106,1009849189.3575904,838181687.0185553
+2024-03-09,212431103.11840084,1013011312.0142429,128807598.94306596,832901189.6254847,377152559.41175216
+2024-03-10,860886851.4073855,938448444.9943435,824494875.6283324,797242326.132944,303300917.0077199
+2024-03-11,88809555.99678281,443228427.2501214,185424083.73631722,700505082.5715426,342400186.95953417
+2024-03-12,954617990.2103468,701223696.6186163,842082971.4568594,142287542.56204543,833648131.2503144
+2024-03-13,905376557.7480178,541158532.9572961,622301056.7755771,775163589.8699402,177525383.07362697
+2024-03-14,497352648.007125,448115051.6118805,157756523.10101745,378132438.53854144,74831469.2638226
+2024-03-15,34727593.47758416,160090457.9349736,989484653.2154671,563188499.2657022,944941229.1324042
+2024-03-16,424272752.3397565,356444586.0818411,529102566.3323877,460887172.61721593,112236492.59621179
+2024-03-17,620895403.7803202,249710452.24592596,636675761.3307736,679018759.0245941,156199933.57080564
+2024-03-18,67854885.42208698,874916538.7277355,477132073.5058995,70630074.96080403,959510343.8690795
+2024-03-19,64185058.232914396,783490147.8015975,1010139476.6888349,261696953.49281222,146771813.02914092
+2024-03-20,123771769.68725583,344962893.1720912,113448262.72553271,739492134.6115528,70391649.81371453
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_175.csv b/agent/tests/factors/fixtures/goldens/gtja191_175.csv
new file mode 100644
index 000000000..cb3b6e844
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_175.csv
@@ -0,0 +1,81 @@
+,SYM0,SYM1,SYM2,SYM3,SYM4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,1.6102921825011762,2.1040315782822603,1.4436992826101143,2.1347112340585546,1.7978201678211434
+2024-01-08,1.604988024819799,1.609086969446923,1.5295249136986822,2.2275989436438812,1.6949565910213
+2024-01-09,1.6913714865268048,1.4888516789407429,1.6588506016007873,1.9786745152252412,1.6454830184264537
+2024-01-10,1.810985952235633,1.4383282349910023,1.6719271823223185,1.8961064394980387,1.8443767809753833
+2024-01-11,1.7026765172079834,1.3659494985134348,1.705873608561068,1.674820413820927,1.8709294615554413
+2024-01-12,1.8783572061367906,1.2926431944349446,1.51621591390582,1.6409521178967026,1.97640728119737
+2024-01-13,1.8764906088732616,1.096199729365092,1.6071934134117,1.59947837431861,1.9999648688448797
+2024-01-14,1.98563249608695,1.0854415898545255,1.5365134874942565,1.5414668722216025,2.0113335070125324
+2024-01-15,2.001717560955664,1.2423099481461435,1.4685369532543433,1.6958182855927244,2.0642719155309734
+2024-01-16,1.8687286993431538,1.1668515711294773,1.3395011975201665,1.6594503959462348,2.086322953201661
+2024-01-17,1.8774031642993332,1.2014319653066607,1.433763661498304,1.6980048100278087,1.9604289557021133
+2024-01-18,1.8118382563564548,1.3762532947283788,1.3899028590153957,1.7673483031054122,2.0684633038611273
+2024-01-19,1.661053405014549,1.5536036000707962,1.5470628298579854,1.591124333155425,1.9890100648149247
+2024-01-20,1.5407870774500338,1.7310958054079701,1.5099304389332033,1.582497064054176,1.966851985049549
+2024-01-21,1.673067275730233,1.7586775705492361,1.4299547357534053,1.554515671167157,1.6231569577604716
+2024-01-22,1.7152562394299384,2.0071557025863314,1.3811753046270638,1.4583019725328559,1.3083262926143793
+2024-01-23,1.9940864518901005,1.9110178803342588,1.0751503808326959,1.7012564063452444,1.2554776710110929
+2024-01-24,1.8483388222676898,1.5906096191266361,1.35383868304226,1.7078645220420725,1.2386335627691167
+2024-01-25,2.0614809924377675,1.5571800668371434,1.4602256417399104,1.8431469982094886,1.2843718319085344
+2024-01-26,2.275861996240162,1.7114228279091417,1.5258729645773244,1.8367487156369033,1.2683806290353843
+2024-01-27,2.2528085823440116,1.51490791547243,1.7741393616941583,1.8014564674379254,1.4746398193773704
+2024-01-28,2.5236428406816835,1.436479472963055,1.7991055127332511,1.9506199822004906,1.6251662691672688
+2024-01-29,2.177131401220817,1.533903987973164,2.09141261849391,1.5508118831104458,1.6214397783447676
+2024-01-30,2.2601057970038005,1.666298215730201,2.0482084803528244,1.5127282310724677,1.5295752653895487
+2024-01-31,2.1149848843909473,1.6348083050202031,1.8491559168985887,1.5337547868113788,1.587577016071485
+2024-02-01,1.74917920867892,1.6244412604627503,1.8343349183715272,1.7897825346065421,1.7040687228271783
+2024-02-02,1.6755255625309122,1.6911948369095693,1.956195012200645,1.7177027962349125,1.717500233738131
+2024-02-03,1.3367473777868237,1.6545458049095956,2.2353343681967366,1.593409139600361,1.6207633140043758
+2024-02-04,1.4511534416499927,1.6554105595527513,2.045730448530364,1.6626506924266877,1.6436897137453503
+2024-02-05,1.4404723364075924,1.6344296276959465,2.1545402985142914,1.5631304997624464,2.006504417798915
+2024-02-06,1.540039805069057,1.801316192152484,2.180174419874246,1.4414886725627387,1.990343453056023
+2024-02-07,1.618775564927894,1.5870476177569135,2.0135160534241052,1.2286870743679827,2.2143008803683344
+2024-02-08,1.4869281396519891,1.8311791051111708,1.627638365402125,1.3731409755189408,2.1760479341612515
+2024-02-09,1.4926511279151526,1.8103581029904323,1.4697167993812787,1.4893124854864557,2.3418433018934857
+2024-02-10,1.3569703454068243,1.840527816784854,1.5774364963779917,1.5401115592902481,2.5748820304154285
+2024-02-11,1.4236646919444926,1.8451755915810633,1.3676587531012625,1.5791444439122462,2.728555070875276
+2024-02-12,1.5020445786981895,1.848849113029587,1.3430203328531647,1.6296231808427895,2.6957394418801024
+2024-02-13,1.4810573280353576,2.0204856662506807,1.390291451374954,1.4956236131248275,2.5016754622541932
+2024-02-14,1.8356164301022158,2.0822162197079805,1.6968452880797618,1.6619780952689969,2.384496032366132
+2024-02-15,2.059548780905589,2.0117125885417786,1.761583510477467,1.6928553199145995,2.3329432211268966
+2024-02-16,2.2136317802477166,1.9894268201181784,1.7872403222215756,1.6915608304485918,2.475623294467925
+2024-02-17,2.0180043573080035,2.2140054662712956,1.8567193698886701,1.5747178073591475,2.047994486606003
+2024-02-18,2.113432868969099,2.0559485004918514,1.687276999606387,1.6336023351302866,2.1021986642979393
+2024-02-19,2.239096769476314,1.8952479593646363,1.68813519016805,2.002294134466107,1.974666300799529
+2024-02-20,2.034764258653844,1.6748855036830743,1.8814529577726233,1.85406603514096,2.287852555977409
+2024-02-21,1.7852700308718497,1.8018642649149683,1.8635533578202939,1.7298559872742583,2.3535148100168732
+2024-02-22,1.900130613489561,1.6181014967772,2.229041484480298,1.9315890252286725,1.9121538827427358
+2024-02-23,2.123742699584715,1.5973402399501733,2.3938085290684747,1.8728920100249837,1.8511724241754048
+2024-02-24,2.28370385601738,1.8424908029609857,2.6858747590815404,1.721020018410061,1.9376983273260133
+2024-02-25,2.029885477356283,1.769694820754265,2.7225617654970313,1.351990124666192,2.0705784493707924
+2024-02-26,1.9400853093409414,1.8174459440092268,2.507105468458768,1.3742065534516523,2.131869359633202
+2024-02-27,2.252342347348538,1.5322358600430566,2.560201313995293,1.5603138172250368,1.922201707589205
+2024-02-28,2.032937471194046,1.7062840448218992,2.1092681305598497,1.356683116570662,2.1951120977284475
+2024-02-29,1.7716734771754166,1.5698258462215573,1.940363631138581,1.567697838966107,2.2473802833314216
+2024-03-01,1.4760159542627018,1.2717385552861415,1.9169146467082594,1.6358817606845737,2.0294794732135677
+2024-03-02,1.502764632878744,1.4107643907734773,1.795006365964151,1.7549744327826318,1.879059339108224
+2024-03-03,1.5470489024634422,1.3942275181052821,1.8056255781890915,1.6354946652489606,1.6529160984155074
+2024-03-04,1.2501764284872887,1.5927007156683264,1.7743175222437462,1.5337084345166143,1.6210294834139585
+2024-03-05,1.1554783916599074,1.6013764683634026,1.9314218441325863,1.8414357248267994,1.5808459255890952
+2024-03-06,1.421657045768794,1.571358269595244,1.9590582842944262,1.7989090091701503,1.4244007120602522
+2024-03-07,1.2010546731262128,1.6846193394111448,1.6650719721841984,1.7743955992062392,1.5710732343876852
+2024-03-08,1.300751975052009,1.6893898068862068,1.7347846854252775,1.629092778501845,1.605434455428444
+2024-03-09,1.1962634490134885,1.5179187267043563,1.6235471209354013,1.6479964079336422,1.4974566348161698
+2024-03-10,1.1798932725550226,1.7247560751745088,1.5801631990426017,1.6464104834313176,1.3813803727778478
+2024-03-11,1.339115655814048,1.9741536243999604,1.3778278019137058,1.2424731897348995,1.2144829709352791
+2024-03-12,1.3276515964942444,1.826244908012562,1.1424336840333258,1.231518391266924,1.2601743249626078
+2024-03-13,1.4960912554679997,1.8696837016660979,1.0651920209460073,1.1312885008333542,1.225123232499359
+2024-03-14,1.4947124849926396,1.8632843299319788,1.0455040479234203,1.254793980694944,1.2221786577675857
+2024-03-15,1.3472435331385029,1.9621756254980933,1.1111378880247333,1.2558829585636933,1.364399549344019
+2024-03-16,1.408439367357694,1.6678077058034688,1.0197817432224194,1.6052080384121084,1.7139677481243514
+2024-03-17,1.592160621648316,1.4381402604842772,1.3023681085018997,1.7451203214532427,1.8075170333984023
+2024-03-18,1.4148917890781452,1.5907444109086721,1.7524251406761853,1.8294025463867551,1.829703805232216
+2024-03-19,1.491445784176231,1.5991466400695888,2.073102529543424,2.0474794822797455,1.910649993709048
+2024-03-20,1.4458655902482676,1.9087494947259576,2.285385982532304,2.0390245941651464,1.9804895084671443
diff --git a/agent/tests/factors/fixtures/goldens/gtja191_191.csv b/agent/tests/factors/fixtures/goldens/gtja191_191.csv
new file mode 100644
index 000000000..935d5bb75
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/gtja191_191.csv
@@ -0,0 +1,81 @@
+,SYM0,SYM1,SYM2,SYM3,SYM4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,,,,,
+2024-01-11,,,,,
+2024-01-12,,,,,
+2024-01-13,,,,,
+2024-01-14,,,,,
+2024-01-15,,,,,
+2024-01-16,,,,,
+2024-01-17,,,,,
+2024-01-18,,,,,
+2024-01-19,,,,,
+2024-01-20,,,,,
+2024-01-21,,,,,
+2024-01-22,,,,,
+2024-01-23,,,,,
+2024-01-24,0.4379237523070856,0.5239523532751065,0.7897103520669333,-0.785299090219695,0.17868795927039116
+2024-01-25,0.38372536134367863,1.1516051359059105,0.03537559202771945,1.547771945244051,-0.5762814922268262
+2024-01-26,-0.535372516881921,-0.42741785625290163,0.9550390924810159,0.5188875039947476,-0.2964604858564712
+2024-01-27,0.8957994893035135,-0.9700227280403197,1.3087979509919165,0.5296390070352004,0.3308764525915393
+2024-01-28,-0.15619008573528959,-0.4023647563827666,-0.038173397083454574,0.25024166751184396,1.0034847277593855
+2024-01-29,0.6582407128583867,-0.7231861320142343,-0.1637137657841521,0.8805460353586625,0.6776562690203747
+2024-01-30,0.8035138420284227,0.8017619507470783,0.021256965330294975,0.3847232181297642,0.8932517021747515
+2024-01-31,0.6398845680754022,-0.06437872112206833,-0.23712301768496502,0.7382397710057091,-0.020156811300054756
+2024-02-01,1.316477452544646,-1.9983594442323493,-1.1999677579366477,1.3662870550224113,-0.15659997303960438
+2024-02-02,1.2037435563147483,0.24017394509429835,-0.6480425026192762,1.1643015331174666,-0.13472587538291236
+2024-02-03,0.4700622685568163,0.2560799619896983,-1.66025091991051,0.5848670255686841,0.9009153559796061
+2024-02-04,1.052702233485661,1.3918056209901835,-1.098527989588618,-0.045710048523375235,0.32504625201536896
+2024-02-05,-1.2385821177199858,0.6735226518557624,-2.0525206652802694,-0.7010884760991019,-0.6475746635768616
+2024-02-06,-0.7667137435661573,1.124424576178427,-0.6192797097759097,-0.24715030565963048,0.9664049840081077
+2024-02-07,0.3050040431921417,0.02128583032306608,-0.8681945161880549,0.7862766037454207,1.6816767722559405
+2024-02-08,1.3360135659658567,-0.5076697594739272,-0.8466810898988513,1.575613824614237,0.5576192141745651
+2024-02-09,-0.04651274164763208,0.11268132939551379,-0.6276307480575127,0.761855335389626,1.5590058292525697
+2024-02-10,0.5141548906352114,0.34072346796089903,-0.8118534783401969,0.21629269659700867,1.351815196597272
+2024-02-11,0.6864157572741334,-0.05105991049239833,-0.8742283440452638,-0.028556610581333075,-0.625449578688702
+2024-02-12,-0.722145521783986,-0.8748248991815331,-1.3399416389400614,-0.6999669444188328,0.04103801638160576
+2024-02-13,-0.030727714846207732,-0.12377880615649417,-0.8099637391185865,0.15147332339044794,-0.2717610671281392
+2024-02-14,-1.1716012520513175,1.790065407696801,-0.9907264131393418,1.0502327824040947,0.17271318193049012
+2024-02-15,-0.07516507883107693,0.8826064767740149,-0.004840409227156783,-0.4020491287223251,-0.33138307097092934
+2024-02-16,0.8938912501222234,0.6318975259851527,-0.244195526429138,0.04914878746170359,-1.901601538051139
+2024-02-17,-0.7303245710549362,1.022168043077457,-0.12060217563788456,-0.3043600812525966,-0.5010875275231399
+2024-02-18,-0.038448094410213685,-0.3926958960884832,-0.5780215552461385,-0.05377023201198483,0.4758473117244506
+2024-02-19,0.629670974197964,-0.40080196526157863,-0.028155056389849165,-0.3361213274123571,-0.01957532591978861
+2024-02-20,1.337555667652424,-0.4574456020315125,-1.724348327891505,-0.5824195754821773,1.1747729583057094
+2024-02-21,1.3247180507820104,-0.46001931094068027,0.47761464164196354,0.44160773887188043,0.5229088016453289
+2024-02-22,1.0330954913164163,-0.6231569580060352,1.3391932889255145,1.3686384343099576,0.9557103930354458
+2024-02-23,0.10973240415110297,-1.6748585758490577,0.24780488177927396,0.8941144445340541,0.8221992786638452
+2024-02-24,-1.6493334392617953,-0.09272242162245448,-0.7827188248647872,0.6249850663924832,1.338142759522185
+2024-02-25,-0.965122225171072,-0.3619158652291361,0.7941060998441429,-0.5660189253773353,1.0003664329909867
+2024-02-26,-0.6472833513664114,0.491169490985925,-0.6975527683779887,1.1002689579214717,0.07831952189368963
+2024-02-27,0.7848582870508665,-0.008475694528939925,-0.6646327074403047,0.8694429585097794,1.3996325533668
+2024-02-28,0.17315326245650908,0.3185085220063115,0.3523733860260876,0.3563866244576417,0.5608835740384421
+2024-02-29,0.9878474422735337,-0.40653504055556766,0.0694726443281013,-0.6372302222056163,0.6758860936202069
+2024-03-01,1.1239493317648197,0.5016269798846764,0.013109944077470459,-1.2123333207827613,0.5046552734206387
+2024-03-02,0.9604245207103475,0.07121982156103002,0.7037118940600209,-0.769555018254664,0.8082793534748447
+2024-03-03,0.9548850294204669,-0.9073922505089769,-0.508358542820261,0.4354973519979666,-0.10785599785457123
+2024-03-04,-0.35761348022104755,-1.4734475123858601,0.5048003074622898,-0.05209645566790755,0.7620438281698796
+2024-03-05,-0.6318876045178996,-0.3915568091733661,-0.0042749076414736464,-1.0278834771467729,0.6310183614745171
+2024-03-06,0.8108285650876326,-1.193719987923771,-0.6906487730419002,-1.1524096522863516,0.1267351319477399
+2024-03-07,0.3919812423019948,-0.01235092013536132,-0.28486620059639733,-0.6575437437564489,0.4718830368243232
+2024-03-08,0.31585581203340496,0.12051214557665446,-0.8077629235375667,-0.7594472058435429,1.4697799920641899
+2024-03-09,0.9567389154063761,-0.9742533715412662,-0.7334635231029267,0.03991385982948259,0.9258191727102627
+2024-03-10,-0.8976863224630733,-0.1793163031408227,1.2027938376701002,-0.6341581606472033,0.8339906873620322
+2024-03-11,-0.25230537894370286,-1.6714471400107271,0.27949025735320276,-0.9220571604909651,-0.2739012511897556
+2024-03-12,-0.09183613672512081,-0.7182025682566859,0.9186105347016849,-0.6718827712277573,-0.4565756009333626
+2024-03-13,-0.36992046584740024,-0.8842374668275994,0.7181538265095213,-0.7294815178748735,-1.006127942545703
+2024-03-14,0.23819601116079525,0.6091209840270579,0.003689285200124459,-0.7441495364253399,-0.13175625795871326
+2024-03-15,-0.5600129927694155,1.0790221063478924,-1.3032532652079283,-1.4748726848027331,-1.3889557113921143
+2024-03-16,0.1562747567890881,0.6206704303908168,0.2571877792420878,-1.3976107315398565,0.07885562581613215
+2024-03-17,0.22670239089671895,0.45863556616986045,1.059847902814127,0.3086537002649692,0.18430451291654038
+2024-03-18,-0.7781066051076664,-0.11800192800782838,-1.2949533360229566,-0.0728671818367701,0.1550283681055049
+2024-03-19,0.5576928518733837,0.20526402009544142,0.8185170697177568,-1.2072240275103496,-0.20196649958086255
+2024-03-20,1.098137206539917,1.5844063978399845,-0.7634753635597349,-0.761595730565972,-1.1649943548512596
diff --git a/agent/tests/factors/fixtures/goldens/qlib158_corr10.csv b/agent/tests/factors/fixtures/goldens/qlib158_corr10.csv
new file mode 100644
index 000000000..2deae3ea1
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/qlib158_corr10.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,0.2215256891,0.735784617,-0.1495648172,0.3988512729,0.5698029935
+2024-01-11,0.475428065,0.6523844043,0.04206282724,0.3210469523,0.4131962238
+2024-01-12,0.3869913279,0.6782801638,-0.09357847821,0.1797256582,0.2988122446
+2024-01-13,0.388748964,0.6370925044,0.03614852375,0.442736494,0.206612544
+2024-01-14,0.4075750237,0.5659227608,-0.09794980383,0.3792282915,0.1203467293
+2024-01-15,0.1549025433,0.5930114382,-0.122190212,0.3486139488,-0.2387744432
+2024-01-16,0.1688114697,0.02938689347,-0.3275937746,0.4723597581,-0.3437208857
+2024-01-17,0.2829022225,0.09688757749,0.402428059,0.4329280592,-0.3481614044
+2024-01-18,0.006495245304,0.1689237038,0.3491706879,0.5125401837,-0.3823945844
+2024-01-19,0.02993367265,0.1503963028,0.2868953156,0.2961897839,-0.1277012002
+2024-01-20,0.03282995511,-0.3798120824,0.3270651625,0.06699179161,-0.1172701827
+2024-01-21,-0.2082929645,-0.256681873,0.4125939277,-0.1225729524,-0.2275486679
+2024-01-22,-0.450112529,-0.4494679963,0.5162428762,-0.1473984857,0.3547436516
+2024-01-23,-0.1034494543,-0.3728222504,0.3137126867,0.1059582421,0.3386609895
+2024-01-24,-0.2702495737,-0.2168821318,0.2582815323,0.2324141903,0.4087098067
+2024-01-25,-0.2130914245,-0.04388056423,0.2853030748,0.2058492092,0.1513207869
+2024-01-26,-0.08125441886,-0.3309925683,-0.2434447934,0.02722969978,0.05949448596
+2024-01-27,0.01578151876,-0.3608455132,0.1901628878,-0.237750155,-0.08620017218
+2024-01-28,0.05162811567,-0.1209910255,0.3025677942,-0.4258647377,0.1858825962
+2024-01-29,-0.3379947321,-0.1011530991,0.06294085062,-0.6003180823,0.4403730166
+2024-01-30,-0.4921427177,-0.1445613947,0.01724789387,-0.4597241485,0.2843813131
diff --git a/agent/tests/factors/fixtures/goldens/qlib158_kmid.csv b/agent/tests/factors/fixtures/goldens/qlib158_kmid.csv
new file mode 100644
index 000000000..73ad59303
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/qlib158_kmid.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,0,0,0,0,0
+2024-01-02,-0.002306842728,0.01565720444,0.007549947669,-0.004579209048,0.005384364462
+2024-01-03,-0.004576396391,-0.004546324105,0.002362563886,-0.01874780585,-0.01702640372
+2024-01-04,-0.005578295811,-0.00993212991,0.003061136316,-0.009067521269,-0.01418210707
+2024-01-05,0.01462185262,-0.002236241691,0.00065579616,-0.01435771304,-0.005545239408
+2024-01-06,0.001090657231,-0.01142577224,0.003646177902,-0.006141028773,-0.002987844963
+2024-01-07,-0.005909893552,0.01859985635,-0.0001305157113,-0.01088103126,0.008450649754
+2024-01-08,-0.0120622735,0.002059029252,-0.01895212765,-0.01381380909,0.002005561754
+2024-01-09,0.007385338378,0.001685919767,-0.001140050234,-0.003175496983,-0.01503257876
+2024-01-10,-0.007146319711,-0.004524133185,0.01043290866,0.003635408225,-0.01819893767
+2024-01-11,0.003240531343,-0.003799248423,-0.006611672722,0.006447963712,0.01083973837
+2024-01-12,0.009281837037,-0.008311355053,-0.003040258658,0.003469629564,0.01014671339
+2024-01-13,-0.004731889675,-0.001854120278,-0.01091095304,-0.01248566228,0.008366248229
+2024-01-14,0.01345667051,-0.0007204792493,0.01000627113,0.003822378219,-0.006587423949
+2024-01-15,0.00353817038,0.01539953498,-0.0003536839708,0.01647481479,-0.02692803464
+2024-01-16,0.008018299667,0.0008583375937,-0.00295292269,0.0009505294019,-0.02099533725
+2024-01-17,-0.002126023424,0.003518329529,0.01463854279,-0.005363547297,-0.008723534583
+2024-01-18,-0.00486643967,0.008987066964,0.003209300761,-0.005512020447,0.005586821719
+2024-01-19,0.000946139769,0.009425081236,-0.006831586938,-0.003428137426,-0.004244312994
+2024-01-20,-0.0142502652,0.002854397951,0.002557768365,5.368313973e-05,-0.002550074822
+2024-01-21,-0.01398071328,-0.004043193764,-0.003349282939,-0.008422179714,-0.001757735515
+2024-01-22,0.00404771324,0.01820339868,0.001711848795,0.002726687868,-0.0008127604386
+2024-01-23,-0.01914443478,-0.000251308198,0.0005895870274,0.02600744805,-0.002101801739
+2024-01-24,0.003067395659,-0.0003290935387,-0.01143332229,0.01176031697,0.008233182188
+2024-01-25,0.008021917715,-0.008624511497,0.01388243319,-0.01425818873,0.006373235021
+2024-01-26,0.02203680678,-0.009475841256,-0.00552750085,0.00102821174,-0.005433090912
+2024-01-27,-0.01526388948,0.0006621737341,-0.01042653294,0.004881549989,-0.009975862135
+2024-01-28,0.01549319984,-0.007559569138,-0.003194346406,0.008344587344,-0.01348959435
+2024-01-29,0.002239008252,0.0127119854,-0.0159948119,0.00187819418,0.002887118208
+2024-01-30,0.00767870271,-0.01187836894,-0.01335240303,0.005299514738,0.003289796407
diff --git a/agent/tests/factors/fixtures/goldens/qlib158_ma5.csv b/agent/tests/factors/fixtures/goldens/qlib158_ma5.csv
new file mode 100644
index 000000000..95ca1ad91
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/qlib158_ma5.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,0.9940714151,1.00653952,0.9952169229,1.026008434,1.019096636
+2024-01-06,0.9936105807,1.015610076,0.9950184314,1.021410273,1.015101331
+2024-01-07,0.9994171598,0.9950871452,0.9970553322,1.020364777,1.000175169
+2024-01-08,1.010002912,0.9923961659,1.013919856,1.023437649,0.9956742007
+2024-01-09,1.003576227,0.9924068007,1.011828978,1.016726714,1.008196268
+2024-01-10,1.007414037,0.9981421104,1.000100199,1.006837027,1.021598445
+2024-01-11,1.001210177,1.00469563,1.003396631,0.9967590175,1.008165475
+2024-01-12,0.9921075292,1.010510054,1.002503077,0.9925971236,0.995900768
+2024-01-13,0.9984016243,1.008986899,1.01126668,1.004701533,0.9867751174
+2024-01-14,0.9879107812,1.00582432,1.001185106,1.001827642,0.9941632674
+2024-01-15,0.9892935506,0.9906805745,0.9993177589,0.9890562986,1.020733152
+2024-01-16,0.9872149294,0.9908717415,1.000797901,0.9905037311,1.035147382
+2024-01-17,0.9928887428,0.9907839,0.9883900631,0.9964766933,1.032831417
+2024-01-18,1.001288146,0.9874576602,0.9900456207,1.004029466,1.015083275
+2024-01-19,1.001430177,0.9856912814,0.9983641162,1.008072662,1.007898896
+2024-01-20,1.013406142,0.9879306794,0.9979018602,1.005333582,1.004134002
+2024-01-21,1.020756204,0.9960267776,1.003261452,1.00927179,1.003536937
+2024-01-22,1.010895093,0.9851309221,1.000998026,1.003577263,1.003590228
+2024-01-23,1.021884825,0.9905053498,0.9993341987,0.9814230659,1.003394169
+2024-01-24,1.010460307,0.994056767,1.008882063,0.9762531364,0.9953943593
+2024-01-25,0.9987217724,1.003651537,0.9953144772,0.9937986241,0.9910561504
+2024-01-26,0.9806689422,1.013108163,1.000655514,0.9980581922,0.9977037378
+2024-01-27,0.9954971369,1.008784494,1.008552067,0.9989076987,1.007150989
+2024-01-28,0.9867709075,1.01131561,1.008368052,0.9929355865,1.018001133
+2024-01-29,0.9908683828,0.9961100378,1.020399912,0.9914184482,1.011067105
+2024-01-30,0.9895537321,1.004906458,1.024209118,0.9904206226,1.003121437
diff --git a/agent/tests/factors/fixtures/goldens/qlib158_std20.csv b/agent/tests/factors/fixtures/goldens/qlib158_std20.csv
new file mode 100644
index 000000000..572cfbea2
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/qlib158_std20.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,,,,,
+2024-01-11,,,,,
+2024-01-12,,,,,
+2024-01-13,,,,,
+2024-01-14,,,,,
+2024-01-15,,,,,
+2024-01-16,,,,,
+2024-01-17,,,,,
+2024-01-18,,,,,
+2024-01-19,,,,,
+2024-01-20,0.009984854418,0.01136816991,0.008373819261,0.02521342591,0.03218760295
+2024-01-21,0.01077112437,0.01223320491,0.008350845474,0.02155027282,0.03214775226
+2024-01-22,0.01103159229,0.01452845619,0.008302716164,0.01652288326,0.03068301534
+2024-01-23,0.01315104996,0.01655074058,0.008194384581,0.01301115242,0.03031374548
+2024-01-24,0.01423177154,0.01799314282,0.008269409965,0.01166801474,0.02970858401
+2024-01-25,0.01455691172,0.01854436007,0.007856300974,0.01115476294,0.0289169903
+2024-01-26,0.01418689705,0.01779782741,0.007101515624,0.01101398892,0.02859072471
+2024-01-27,0.01455150591,0.01774924857,0.006519489095,0.01163579845,0.0278160722
+2024-01-28,0.01422325641,0.01774176324,0.007056832012,0.01256162659,0.02711165923
+2024-01-29,0.01428060992,0.0176593114,0.009514858576,0.013215023,0.02652740863
+2024-01-30,0.01432519514,0.01755788816,0.01303039262,0.01417965025,0.0265904106
diff --git a/agent/tests/factors/fixtures/goldens/qlib158_vsumd20.csv b/agent/tests/factors/fixtures/goldens/qlib158_vsumd20.csv
new file mode 100644
index 000000000..28f25f3af
--- /dev/null
+++ b/agent/tests/factors/fixtures/goldens/qlib158_vsumd20.csv
@@ -0,0 +1,31 @@
+,S0,S1,S2,S3,S4
+2024-01-01,,,,,
+2024-01-02,,,,,
+2024-01-03,,,,,
+2024-01-04,,,,,
+2024-01-05,,,,,
+2024-01-06,,,,,
+2024-01-07,,,,,
+2024-01-08,,,,,
+2024-01-09,,,,,
+2024-01-10,,,,,
+2024-01-11,,,,,
+2024-01-12,,,,,
+2024-01-13,,,,,
+2024-01-14,,,,,
+2024-01-15,,,,,
+2024-01-16,,,,,
+2024-01-17,,,,,
+2024-01-18,,,,,
+2024-01-19,,,,,
+2024-01-20,,,,,
+2024-01-21,0.1633794128,0.04719840846,0.01605664732,0.05748177973,-0.02654672887
+2024-01-22,0.04677973995,-0.06956475852,0.02709410718,-0.03346307277,-0.134552829
+2024-01-23,-0.003055192297,-0.01535758963,0.02255036834,0.1144706517,0.04411029121
+2024-01-24,0.07907620096,-0.02391207611,0.007973978205,0.03828518173,-0.0359928284
+2024-01-25,-0.0261694624,0.0171876469,0.04042533298,-0.02253105917,-0.0893964169
+2024-01-26,0.03341090647,0.1258345898,0.03635722151,-0.01307536941,0.08539970088
+2024-01-27,0.0564027811,0.07525968868,0.01424314992,-0.0998327119,0.09008954931
+2024-01-28,0.05484363195,-0.08990760748,-0.06258667163,-0.07237716758,-0.005378753922
+2024-01-29,0.01144766715,0.006559088044,0.1025430921,0.01117465042,0.01910708849
+2024-01-30,-0.03561665955,-0.03112405392,0.04777659746,0.05338860236,0.1018911767
diff --git a/agent/tests/factors/test_academic_samples.py b/agent/tests/factors/test_academic_samples.py
new file mode 100644
index 000000000..8da6ef03f
--- /dev/null
+++ b/agent/tests/factors/test_academic_samples.py
@@ -0,0 +1,76 @@
+"""Golden-output regression for ``zoo/academic`` factors.
+
+Generates the same seeded panel used to bake the golden CSVs in
+``tests/factors/fixtures/goldens/academic_*.csv`` and asserts the live
+``Registry.compute()`` output is numerically identical (``rtol=1e-6``,
+NaNs treated as equal). Three representative factors are exercised here;
+the remaining academic factors are covered by the AST purity gate plus
+the registry health check.
+"""
+from __future__ import annotations
+
+from pathlib import Path
+
+import numpy as np
+import pandas as pd
+import pytest
+
+from src.factors.registry import Registry
+
+_GOLDEN_DIR = Path(__file__).parent / "fixtures" / "goldens"
+
+
+def _build_panel() -> dict[str, pd.DataFrame]:
+ """Recreate the exact seeded panel used to write the golden CSVs."""
+ rng = np.random.RandomState(42)
+ n_rows, n_cols = 300, 8
+ codes = [f"C{i:02d}" for i in range(n_cols)]
+ dates = pd.date_range("2024-01-01", periods=n_rows, freq="B")
+
+ log_rets = rng.normal(0, 0.02, size=(n_rows, n_cols))
+ close = pd.DataFrame(
+ 100 * np.exp(np.cumsum(log_rets, axis=0)), index=dates, columns=codes
+ )
+ high = close * (1 + np.abs(rng.normal(0, 0.005, size=(n_rows, n_cols))))
+ low = close * (1 - np.abs(rng.normal(0, 0.005, size=(n_rows, n_cols))))
+ open_ = close.shift(1).fillna(close.iloc[0])
+ volume = pd.DataFrame(
+ rng.uniform(1e5, 1e7, size=(n_rows, n_cols)), index=dates, columns=codes
+ )
+ return {
+ "open": open_,
+ "high": high,
+ "low": low,
+ "close": close,
+ "volume": volume,
+ }
+
+
+def _load_golden(alpha_id: str) -> pd.DataFrame:
+ path = _GOLDEN_DIR / f"{alpha_id}.csv"
+ df = pd.read_csv(path, index_col="date", parse_dates=True)
+ return df
+
+
+ "alpha_id",
+ ["academic_mkt_rf", "academic_smb", "academic_carhart_mom"],
+)
+def test_academic_factor_matches_golden(alpha_id: str) -> None:
+ registry = Registry()
+ panel = _build_panel()
+ result = registry.compute(alpha_id, panel)
+ golden = _load_golden(alpha_id)
+
+ assert list(result.columns) == list(golden.columns), (
+ f"{alpha_id}: column mismatch"
+ )
+ assert result.shape == golden.shape, f"{alpha_id}: shape mismatch"
+
+ np.testing.assert_allclose(
+ result.to_numpy(dtype=np.float64),
+ golden.to_numpy(dtype=np.float64),
+ rtol=1e-6,
+ equal_nan=True,
+ err_msg=f"{alpha_id} output diverged from golden",
+ )
diff --git a/agent/tests/factors/test_alpha101_samples.py b/agent/tests/factors/test_alpha101_samples.py
new file mode 100644
index 000000000..ade1fdd79
--- /dev/null
+++ b/agent/tests/factors/test_alpha101_samples.py
@@ -0,0 +1,137 @@
+"""Numerical golden tests for a representative slice of the alpha101 zoo.
+
+Five alphas (#1, #5, #11, #41, #54) are pinned against pre-computed CSV
+fixtures in ``fixtures/goldens/``. The fixtures were generated from a
+``np.random.RandomState(42)`` 30-row x 5-symbol panel; any change in the
+operator semantics or the alpha implementation will surface here.
+
+The chosen alphas span the operator surface:
+
+* alpha101_001 — ``ts_argmax``, ``signed_power``, ``ts_std``, ``rank``
+* alpha101_005 — ``rolling_sum`` via ``DataFrame.rolling``, ``rank``, ``abs``
+* alpha101_011 — ``ts_max``, ``ts_min``, ``delta``, ``rank``
+* alpha101_041 — power on element-wise product, vwap subtraction
+* alpha101_054 — ``safe_div`` over a degree-5 polynomial ratio
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+
+import numpy as np
+import pandas as pd
+import pytest
+
+from src.factors.registry import Registry
+
+
+GOLDEN_DIR = Path(__file__).parent / "fixtures" / "goldens"
+
+SAMPLED_ALPHAS = (
+ "alpha101_001",
+ "alpha101_005",
+ "alpha101_011",
+ "alpha101_041",
+ "alpha101_054",
+)
+
+
+def _build_panel(n_rows: int = 30, n_cols: int = 5) -> dict[str, pd.DataFrame]:
+ """Reproduce the seeded panel used to generate the golden CSVs.
+
+ Keep this in lockstep with the generator block in the docstring of
+ ``fixtures/goldens/`` — any drift here breaks every golden assertion.
+ """
+ rng = np.random.RandomState(42)
+ idx = pd.date_range("2024-01-01", periods=n_rows, freq="D")
+ cols = [f"S{i}" for i in range(n_cols)]
+
+ close_arr = 100.0 + np.cumsum(rng.randn(n_rows, n_cols), axis=0)
+ close = pd.DataFrame(close_arr, index=idx, columns=cols).abs() + 1.0
+ open_ = close.shift(1).fillna(close.iloc[0])
+ high = pd.DataFrame(
+ np.maximum(close.to_numpy(), open_.to_numpy()) + rng.rand(n_rows, n_cols),
+ index=idx,
+ columns=cols,
+ )
+ low = pd.DataFrame(
+ np.minimum(close.to_numpy(), open_.to_numpy()) - rng.rand(n_rows, n_cols),
+ index=idx,
+ columns=cols,
+ ).abs() + 0.01
+ volume = pd.DataFrame(
+ rng.randint(1_000, 100_000, size=(n_rows, n_cols)).astype(float),
+ index=idx,
+ columns=cols,
+ )
+ vwap = (high + low + close + open_) / 4.0
+ amount = volume * close
+
+ return {
+ "open": open_,
+ "high": high,
+ "low": low,
+ "close": close,
+ "volume": volume,
+ "amount": amount,
+ "vwap": vwap,
+ }
+
+
+def _load_golden(alpha_id: str) -> pd.DataFrame:
+ """Load a golden CSV and coerce the index dtype to match the live panel."""
+ path = GOLDEN_DIR / f"{alpha_id}.csv"
+ df = pd.read_csv(path, index_col=0, parse_dates=True)
+ return df.astype(np.float64)
+
+
[email protected](scope="module")
+def panel() -> dict[str, pd.DataFrame]:
+ """Module-scoped panel reused by every parametrized sample."""
+ return _build_panel()
+
+
[email protected](scope="module")
+def registry() -> Registry:
+ return Registry()
+
+
[email protected]("alpha_id", SAMPLED_ALPHAS)
+def test_alpha101_sample_matches_golden(
+ alpha_id: str,
+ panel: dict[str, pd.DataFrame],
+ registry: Registry,
+) -> None:
+ """Recomputed factor must match the checked-in golden CSV to 1e-6 rtol."""
+ actual = registry.compute(alpha_id, panel)
+ expected = _load_golden(alpha_id)
+
+ assert actual.shape == expected.shape, (
+ f"{alpha_id}: shape mismatch — got {actual.shape}, expected {expected.shape}"
+ )
+ assert list(actual.columns) == list(expected.columns), (
+ f"{alpha_id}: column mismatch — got {list(actual.columns)}, "
+ f"expected {list(expected.columns)}"
+ )
+
+ actual_arr = actual.to_numpy(dtype=np.float64, na_value=np.nan)
+ expected_arr = expected.to_numpy(dtype=np.float64, na_value=np.nan)
+
+ np.testing.assert_allclose(
+ actual_arr,
+ expected_arr,
+ rtol=1e-6,
+ atol=1e-9,
+ equal_nan=True,
+ err_msg=f"{alpha_id}: numerical drift vs golden",
+ )
+
+
+def test_all_sampled_goldens_exist() -> None:
+ """Sanity gate: every sampled alpha must have a corresponding golden CSV."""
+ missing = [
+ alpha_id
+ for alpha_id in SAMPLED_ALPHAS
+ if not (GOLDEN_DIR / f"{alpha_id}.csv").is_file()
+ ]
+ assert not missing, f"missing golden CSVs for: {missing}"
diff --git a/agent/tests/factors/test_gtja191_part1_samples.py b/agent/tests/factors/test_gtja191_part1_samples.py
new file mode 100644
index 000000000..6046fae3a
--- /dev/null
+++ b/agent/tests/factors/test_gtja191_part1_samples.py
@@ -0,0 +1,75 @@
+"""Numerical regression for sampled GTJA Alpha 1-100 modules.
+
+Five alphas (1, 5, 17, 42, 80) cover the operator surface — log/rank/corr,
+ts_rank composition, signed_power, rolling std, and pure volume change —
+so a regression here catches most operator-mapping mistakes. The seeded
+panel and golden CSVs are reproducible via the docstring of the conftest.
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+
+import numpy as np
+import pandas as pd
+import pytest
+
+from src.factors.registry import Registry
+
+
+GOLDENS_DIR = Path(__file__).resolve().parent / "fixtures" / "goldens"
+
+SAMPLED_IDS = ("gtja191_001", "gtja191_005", "gtja191_017", "gtja191_042", "gtja191_080")
+
+
+def _seeded_panel() -> dict[str, pd.DataFrame]:
+ """Same seeded panel used to generate the goldens (np.random.RandomState(42)).
+
+ 30 rows × 5 codes; A-share convention amount = volume * close * 100.
+ """
+ rng = np.random.RandomState(42)
+ n_rows = 30
+ codes = ["A", "B", "C", "D", "E"]
+ idx = pd.date_range("2024-01-01", periods=n_rows, freq="D")
+
+ close_arr = 100.0 + np.cumsum(rng.normal(0, 1, (n_rows, 5)), axis=0)
+ close_arr = np.abs(close_arr) + 1.0
+ close = pd.DataFrame(close_arr, index=idx, columns=codes)
+ open_ = close.shift(1).fillna(close.iloc[0])
+ high = pd.DataFrame(
+ np.maximum(close.to_numpy(), open_.to_numpy()) + rng.uniform(0, 1, (n_rows, 5)),
+ index=idx, columns=codes,
+ )
+ low = pd.DataFrame(
+ np.minimum(close.to_numpy(), open_.to_numpy()) - rng.uniform(0, 1, (n_rows, 5)),
+ index=idx, columns=codes,
+ ).abs() + 0.01
+ volume = pd.DataFrame(
+ rng.randint(1000, 100000, (n_rows, 5)).astype(float),
+ index=idx, columns=codes,
+ )
+ amount = volume * close * 100.0
+ return {"open": open_, "high": high, "low": low, "close": close, "volume": volume, "amount": amount}
+
+
[email protected]("alpha_id", SAMPLED_IDS)
+def test_gtja191_sample_matches_golden(alpha_id: str) -> None:
+ """Recompute the sampled alpha and check it matches the committed golden CSV."""
+ golden_path = GOLDENS_DIR / f"{alpha_id}.csv"
+ assert golden_path.is_file(), f"missing golden fixture: {golden_path}"
+
+ expected = pd.read_csv(golden_path, index_col=0, parse_dates=True)
+ expected.index.freq = None
+
+ registry = Registry()
+ actual = registry.compute(alpha_id, _seeded_panel())
+
+ # CSV round-trip may not preserve exact float bits; we still want a tight
+ # tolerance so any operator-mapping regression is caught.
+ np.testing.assert_allclose(
+ actual.to_numpy(dtype=np.float64),
+ expected.to_numpy(dtype=np.float64),
+ rtol=1e-6,
+ equal_nan=True,
+ err_msg=f"{alpha_id}: numerical regression vs golden",
+ )
diff --git a/agent/tests/factors/test_gtja191_part2_samples.py b/agent/tests/factors/test_gtja191_part2_samples.py
new file mode 100644
index 000000000..5d2ad3efe
--- /dev/null
+++ b/agent/tests/factors/test_gtja191_part2_samples.py
@@ -0,0 +1,118 @@
+"""Golden-fixture regression tests for the GTJA-191 part-2 port (alphas 101-191).
+
+Five representative alphas spanning the 101-191 range are pinned against
+CSV goldens generated from a seeded synthetic panel. ``assert_allclose`` with
+``rtol=1e-6, equal_nan=True`` detects any drift in either the operator algebra
+or the alpha formula transcription.
+
+Note on panel size: the task spec calls for a 30-row × 5-column panel, but
+``gtja191_130`` requires a 40-day rolling volume mean (warmup ≥ 60 bars by
+the registry's ``min_warmup_bars`` field), so a 30-row panel returns >95 %
+NaN and fails the registry's sanity check. We use ``N=80`` here as the
+minimum row count that lets all five sample alphas produce a non-trivial
+output. The seed (``np.random.RandomState(42)``) is unchanged.
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+
+import numpy as np
+import pandas as pd
+import pytest
+
+from src.factors.registry import Registry
+
+
+GOLDENS_DIR = Path(__file__).parent / "fixtures" / "goldens"
+SAMPLED_ALPHAS = (
+ "gtja191_101",
+ "gtja191_130",
+ "gtja191_150",
+ "gtja191_175",
+ "gtja191_191",
+)
+
+
+def _build_panel() -> dict[str, pd.DataFrame]:
+ """Reproducible 80-row × 5-symbol OHLCV+amount+benchmark panel (seed=42)."""
+ rng = np.random.RandomState(42)
+ n_rows, n_syms = 80, 5
+ idx = pd.date_range("2024-01-01", periods=n_rows, freq="D")
+ cols = [f"SYM{i}" for i in range(n_syms)]
+ close = (
+ pd.DataFrame(
+ 100.0 + np.cumsum(rng.normal(0, 1, (n_rows, n_syms)), axis=0),
+ index=idx,
+ columns=cols,
+ ).abs()
+ + 1.0
+ )
+ open_ = close.shift(1).fillna(close.iloc[0])
+ high = pd.DataFrame(
+ np.maximum(close.to_numpy(), open_.to_numpy())
+ + rng.uniform(0, 1, (n_rows, n_syms)),
+ index=idx,
+ columns=cols,
+ )
+ low = (
+ pd.DataFrame(
+ np.minimum(close.to_numpy(), open_.to_numpy())
+ - rng.uniform(0, 1, (n_rows, n_syms)),
+ index=idx,
+ columns=cols,
+ ).abs()
+ + 0.01
+ )
+ volume = pd.DataFrame(
+ rng.uniform(1e5, 1e7, (n_rows, n_syms)), index=idx, columns=cols
+ )
+ amount = volume * close
+ benchmark_close = pd.DataFrame(
+ np.tile(close.mean(axis=1).to_numpy().reshape(-1, 1), (1, n_syms)),
+ index=idx,
+ columns=cols,
+ )
+ return {
+ "open": open_,
+ "high": high,
+ "low": low,
+ "close": close,
+ "volume": volume,
+ "amount": amount,
+ "benchmark_close": benchmark_close,
+ }
+
+
[email protected](scope="module")
+def panel() -> dict[str, pd.DataFrame]:
+ return _build_panel()
+
+
[email protected](scope="module")
+def registry() -> Registry:
+ return Registry()
+
+
[email protected]("alpha_id", SAMPLED_ALPHAS)
+def test_gtja191_sample_matches_golden(
+ alpha_id: str,
+ panel: dict[str, pd.DataFrame],
+ registry: Registry,
+) -> None:
+ """Each sample alpha must reproduce its pinned CSV golden bit-equivalently."""
+ out = registry.compute(alpha_id, panel)
+ golden_path = GOLDENS_DIR / f"{alpha_id}.csv"
+ assert golden_path.is_file(), f"golden fixture missing: {golden_path}"
+ golden = pd.read_csv(golden_path, index_col=0, parse_dates=True)
+ golden.columns = list(golden.columns)
+ assert out.shape == golden.shape, (
+ f"{alpha_id}: shape {out.shape} != golden {golden.shape}"
+ )
+ np.testing.assert_allclose(
+ out.to_numpy(dtype=np.float64),
+ golden.to_numpy(dtype=np.float64),
+ rtol=1e-6,
+ equal_nan=True,
+ err_msg=f"{alpha_id} drift vs. golden",
+ )
diff --git a/agent/tests/factors/test_qlib158_samples.py b/agent/tests/factors/test_qlib158_samples.py
new file mode 100644
index 000000000..3580d864f
--- /dev/null
+++ b/agent/tests/factors/test_qlib158_samples.py
@@ -0,0 +1,105 @@
+"""Golden-fixture regression tests for sampled qlib158 alphas.
+
+We pin 5 alphas across the family taxonomy (K-bar, momentum, momentum-std,
+volume-microstructure, volume-volatility) against CSV fixtures generated
+from a fixed-seed panel. Any algebraic drift in the operators, in
+``safe_div``, or in a per-family formula will break exactly one of the
+parametrized cases — making the bisect surface as small as possible.
+
+Panel construction matches the spec in the task brief:
+ np.random.RandomState(42), 30 rows × 5 codes, OHLCV synthesised the
+ same way as ``test_lookahead._baseline_panel`` (random walk close;
+ open from shift; high/low bracketing; volume integer-cast).
+"""
+from __future__ import annotations
+
+from pathlib import Path
+
+import numpy as np
+import pandas as pd
+import pytest
+
+from src.factors.registry import Registry
+
+
+GOLDEN_DIR = Path(__file__).parent / "fixtures" / "goldens"
+
+
+# ---------------------------------------------------------------- fixtures
+
+
+def _build_panel(seed: int = 42, n_rows: int = 30, n_cols: int = 5) -> dict[str, pd.DataFrame]:
+ """Deterministic panel matching the golden generation procedure."""
+ rs = np.random.RandomState(seed)
+ idx = pd.date_range("2024-01-01", periods=n_rows, freq="D")
+ cols = [f"S{i}" for i in range(n_cols)]
+ close = pd.DataFrame(
+ 100.0 + np.cumsum(rs.normal(0.0, 1.0, size=(n_rows, n_cols)), axis=0),
+ index=idx, columns=cols,
+ ).abs() + 1.0
+ open_ = close.shift(1).fillna(close.iloc[0])
+ high = pd.DataFrame(
+ np.maximum(close.to_numpy(), open_.to_numpy()) + rs.uniform(0.0, 1.0, size=(n_rows, n_cols)),
+ index=idx, columns=cols,
+ )
+ low = pd.DataFrame(
+ np.minimum(close.to_numpy(), open_.to_numpy()) - rs.uniform(0.0, 1.0, size=(n_rows, n_cols)),
+ index=idx, columns=cols,
+ ).abs() + 0.01
+ volume = pd.DataFrame(
+ rs.randint(1000, 100_000, size=(n_rows, n_cols)).astype(float),
+ index=idx, columns=cols,
+ )
+ return {"open": open_, "high": high, "low": low, "close": close, "volume": volume}
+
+
[email protected](scope="module")
+def panel() -> dict[str, pd.DataFrame]:
+ return _build_panel()
+
+
[email protected](scope="module")
+def registry() -> Registry:
+ return Registry()
+
+
+# ---------------------------------------------------------------- cases
+
+
+SAMPLED_ALPHAS = [
+ "qlib158_kmid", # K-bar microstructure
+ "qlib158_ma5", # momentum / moving average
+ "qlib158_std20", # momentum / volatility window
+ "qlib158_corr10", # volume × close correlation
+ "qlib158_vsumd20", # volume directional sum delta
+]
+
+
[email protected]("alpha_id", SAMPLED_ALPHAS)
+def test_alpha_matches_golden(alpha_id: str, panel: dict[str, pd.DataFrame], registry: Registry) -> None:
+ """Compute the alpha and compare against the pinned golden CSV."""
+ actual = registry.compute(alpha_id, panel)
+
+ golden_path = GOLDEN_DIR / f"{alpha_id}.csv"
+ assert golden_path.is_file(), f"missing golden fixture: {golden_path}"
+
+ expected = pd.read_csv(golden_path, index_col=0, parse_dates=True)
+
+ # Column / shape match
+ assert list(actual.columns) == list(expected.columns), (
+ f"{alpha_id}: column mismatch actual={list(actual.columns)} "
+ f"expected={list(expected.columns)}"
+ )
+ assert actual.shape == expected.shape, (
+ f"{alpha_id}: shape mismatch actual={actual.shape} expected={expected.shape}"
+ )
+
+ # Value equality at 1e-6 relative tolerance, NaN-equal.
+ np.testing.assert_allclose(
+ actual.to_numpy(dtype=np.float64),
+ expected.to_numpy(dtype=np.float64),
+ rtol=1e-6,
+ atol=1e-9,
+ equal_nan=True,
+ err_msg=f"{alpha_id}: values diverged from golden fixture",
+ )