Polars-native factor signal validation toolkit for quantitative finance
Project description
Tests one factor. Screens a thousand.
Where factrix fits
Does this factor possess predictive edge?
factrix is the first Polars-native Python toolkit that picks the right statistical test for each factor type. Cross-sectional, event, common factor — each gets the tests that fit its data-generating process.
factor construction → factrix (inference) → strategy construction → backtest → live trading
▲ you are here
For each candidate factor factrix answers — is the predictive power real? — and corrects for multiple testing when you screen at scale. Kill fakes before they cost you a backtest.
Why factrix?
- Type-routed evaluation — Information Coefficient + Fama-MacBeth for cross-sectional factors; Cumulative Average Abnormal Return for events. Each type ships its own multi-metric diagnostic battery.
- Batch factor screening — screen hundreds of candidate factors with cross-test multiple-testing correction in a single API call.
- Financial statistics built in — autocorrelation-robust standard
errors (Newey-West), overlapping-forward-return correction,
persistent-predictor flagging (Stambaugh bias), false-discovery-rate
control across batches (Benjamini-Hochberg-Yekutieli). Hand-rolled
Information Coefficient loops typically run
scipy.stats.ttest_1sampon the IC series and ignore the autocorrelation induced by overlapping forward returns. - Polars-native — modern Polars alternative to the pandas-based alphalens.
factrix stops at the inference — primary test plus diagnostic battery. It does not size positions, model slippage, optimise weights, or compose alphas; those belong to the later stages of the pipeline above.
Is factrix the right tool?
| You want to… | Use this |
|---|---|
| Inference on a factor (cross-sectional / event / common factor) | factrix |
| Screen many factors with multiple-testing correction | factrix |
| Backtest with positions / slippage / margin | zipline-reloaded, backtrader, bt, vectorbt, nautilus_trader |
| Optimise portfolio weights | skfolio, riskfolio-lib |
| Returns-level tear-sheet (P&L diagnostics) | pyfolio-reloaded, QuantStats |
| Familiar cross-sectional tear-sheet | alphalens-reloaded |
| End-to-end machine-learning pipeline | qlib |
| Deflated / probabilistic Sharpe today (commercial) | mlfinlab |
Where factrix fits — full comparison →
Installation
pip install factrix
# or
uv add factrix
See the installation guide for version pinning and development setup.
Typical usage
Single factor — IC evaluation
import factrix as fx
from factrix.preprocess import compute_forward_return
raw = fx.datasets.make_cs_panel(n_assets=100, n_dates=500, ic_target=0.08, seed=2024)
panel = compute_forward_return(raw, forward_periods=5)
cfg = fx.AnalysisConfig.individual_continuous(metric=fx.Metric.IC, forward_periods=5)
profile = fx.evaluate(panel, cfg)
print('primary_p =', round(profile.primary_p, 4))
print(profile.diagnose()) # WarningCode / InfoCode list
Multi-factor BHY screening
profiles = [fx.evaluate(p, cfg) for p in [panel_a, panel_b, panel_c, panel_d, panel_e]]
survivors = fx.multi_factor.bhy(profiles, threshold=0.05)
Single-asset (timeseries) fallback
cfg = fx.AnalysisConfig.individual_continuous(metric=fx.Metric.IC, forward_periods=5)
profile = fx.evaluate(single_asset_panel, cfg) # mode auto-switches to TIMESERIES
print(profile.stats.get(fx.StatCode.TS_BETA))
Documentation
- Get Started — install, quickstart, where factrix fits
- User Guide — concepts (three-axis design, architecture), how-to (PANEL vs TIMESERIES, BHY screening, slice analysis), examples
- API Reference — entry points, results, lookup tables, per-metric pages
- Development — contributing, design notes
- Release Notes — changelog
License
Released under the Apache License 2.0.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file factrix-0.13.0.tar.gz.
File metadata
- Download URL: factrix-0.13.0.tar.gz
- Upload date:
- Size: 310.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d17771898648fc4a29b5e4c80d36d65b8fa2e2d7da6f9137a7c7152cf22071fa
|
|
| MD5 |
84a970f8999d0d02507c483cb057da86
|
|
| BLAKE2b-256 |
bf2a3afc0156749972961dd64c3c09b00b838ef0c52602c8d1f53d3f3604a0d2
|
Provenance
The following attestation bundles were made for factrix-0.13.0.tar.gz:
Publisher:
release.yml on awwesomeman/factrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
factrix-0.13.0.tar.gz -
Subject digest:
d17771898648fc4a29b5e4c80d36d65b8fa2e2d7da6f9137a7c7152cf22071fa - Sigstore transparency entry: 1546796758
- Sigstore integration time:
-
Permalink:
awwesomeman/factrix@0a31254bf03d1b8e7e379f98c4732f4e8238caff -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/awwesomeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0a31254bf03d1b8e7e379f98c4732f4e8238caff -
Trigger Event:
push
-
Statement type:
File details
Details for the file factrix-0.13.0-py3-none-any.whl.
File metadata
- Download URL: factrix-0.13.0-py3-none-any.whl
- Upload date:
- Size: 265.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51bd8f0c7c6bbf7c649c29747691fbbf5ed77a6b862b97c61dbdcfa6053bf1b4
|
|
| MD5 |
0505c28007582581507597b6be01b9e1
|
|
| BLAKE2b-256 |
689f80bae133fda198cc43372faadbba63d19a1af30d343f3572c2bd132de41f
|
Provenance
The following attestation bundles were made for factrix-0.13.0-py3-none-any.whl:
Publisher:
release.yml on awwesomeman/factrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
factrix-0.13.0-py3-none-any.whl -
Subject digest:
51bd8f0c7c6bbf7c649c29747691fbbf5ed77a6b862b97c61dbdcfa6053bf1b4 - Sigstore transparency entry: 1546796805
- Sigstore integration time:
-
Permalink:
awwesomeman/factrix@0a31254bf03d1b8e7e379f98c4732f4e8238caff -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/awwesomeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0a31254bf03d1b8e7e379f98c4732f4e8238caff -
Trigger Event:
push
-
Statement type: