Scan your whole stack
From OX Research Newsroom
Are you using py-alpha-lib?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.5.3
py-alpha-lib was last scanned on 26 Nov 2026 at version 0.5.3. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.5.3 LATEST | 26 Nov 2026 | No rules fired |
| 0.5.2 | 25 Nov 2026 | No rules fired |
| 0.5.1 | 19 Nov 2026 | No rules fired |
| 0.5.0 | 18 Nov 2026 | Not shown |
| 0.4.2 | 11 Nov 2026 | Not shown |
Findings for v0.5.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.5.3; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
High-performance quantitative finance algorithm library, implemented in Rust with Python bindings (PyO3).
Provides efficient rolling-window calculations commonly used in factor-based quantitative trading.
Benchmarked on Alpha 101, 4000 stocks x 261 trading days (1,044,000 data points per factor):
| Implementation | Factors | Data Load | Compute | Total | Speedup |
|---|---|---|---|---|---|
| pandas | 75 | 31.2s | 2,643s | 2,675s (44min) | 1x |
| polars_ta | 81 | 0.3s | 58s | 58s | 46x |
| alpha-lib | 101 | 0.3s | 3.6s | 3.9s | 729x |
See COMPARISON.md for per-factor timing and correctness analysis.
pip install py-alpha-lib
Control computation behavior via alpha.set_ctx():
groups — Number of securities in the data array. Each group is processed independently and in parallel. Required for cross-sectional operations like RANK.
start — Starting index for calculation (default: 0).
end — Ending index for calculation (default: len(data)). end can be used when you want to calculate only a part of the data. for example, when back test iteratively.
flags — Bitwise flags:
FLAG_SKIP_NAN (1): Skip NaN values in rolling windows.FLAG_STRICTLY_CYCLE (2): Return NaN until window is full (matches pandas rolling() default).|: flags=FLAG_SKIP_NAN | FLAG_STRICTLY_CYCLEimport alpha
import numpy as np
data = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=np.float64)
# 3-period moving average (partial results during warm-up)
result = alpha.MA(data, 3)
# [1. 1.5 2. 3. 4. 5. 6. 7. 8. 9.]
# Strict mode: NaN until window is full
alpha.set_ctx(flags=alpha.FLAG_STRICTLY_CYCLE)
result = alpha.MA(data, 3)
# [nan nan 2. 3. 4. 5. 6. 7. 8. 9.]
# Skip NaN values
alpha.set_ctx(flags=alpha.FLAG_SKIP_NAN)
data_nan = np.array([1, 2, np.nan, 4, 5, 6, 7, 8, 9, 10], dtype=np.float64)
result = alpha.MA(data_nan, 3)
#[1. 1.5 nan 2.333 3.667 5. 6. 7. 8. 9. ]
import alpha
from alpha.context import ExecContext
# ExecContext auto-infers groups from securityid/tradetime columns
# and calls alpha.set_ctx(groups=...) automatically
data = pl.read_csv("data.csv").sort(["securityid", "tradetime"])
ctx = ExecContext(data)
# Call operators directly on numpy arrays
close = data["close"].to_numpy()
ma20 = alpha.MA(close, 20)
rank = alpha.RANK(close) # cross-sectional rank (groups auto-configured)
corr = alpha.CORR(close, data["vol"].to_numpy().astype(float), 10)
Data layout: flat 1D array [stock1_day1, stock1_day2, ..., stockN_dayM], sorted by security then time. The groups parameter tells the library where each stock's data begins.
Convert factor expressions to Python code, then run:
python -m alpha.lang examples/wq101/alpha101.txt
# 3. Use generated code
from alpha.context import ExecContext
from factors import alpha_001
data = pl.read_csv("data.csv").sort(["securityid", "tradetime"])
ctx = ExecContext(data) # auto-infers groups
result = alpha_001(ctx)
You can convert factor expressions to Python code using the lang module. For example:
python -m alpha.lang examples/wq101/alpha101.txt
This will read the factor expressions from examples/wq101/alpha101.txt and generate corresponding Python code using alpha-lib functions.
After generating the code, you may need to adjust the code
float and bool.Implementation of 190/191 factors from the GTJA (国泰君安) Alpha 191 factor set in examples/gtja191/:
| Metric | Value |
|---|---|
| Computable | 190 / 191 |
| Compute time | ~4.5s (4000 stocks × 261 days) |
| Avg per factor | 24ms |
python -m examples.gtja191.al 143 # run specific factor
python -m examples.gtja191.al # run all factors
Full implementation of 101 Formulaic Alphas in examples/wq101/:
al/ — alpha-lib implementation (Rust backend)pd_/ — pandas reference (DolphinDB port)pl_/ — polars_ta referenceexamples/wq101/main.py --with-al 1 2 3 4 # Run specific factors
examples/wq101/main.py --with-al -s 1 -e 102 # Run all factors
examples/wq101/main.py --with-pd --with-al -s 1 -e 15 # Compare with pandas
Benchmark scripts in benchmarks/.
Naming Rules:
CC_ means it is a cross-commodity/cross-security/cross-group operation.Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.